svn merge individual files. Add new file - linux

I am trying to merge individual files between two branches . All is well except for newly added files in source branch .
how can I merge newly added files from source to target .
svn merge -c123 https://my.svn.domain/svn/foo/branches/bar/newfile.txt ./newfile.txt
svn: E200009: Merge target './newfile.txt' does not exist in the working copy
EDIT 1:
I am using svn version 1.7.19
EDIT 2: Getting this error while trying to merge a file with status "A" .

To merge individual file you should confirm the target file exist then use the command like :
$ svn merge -c 31 ^/brunchs/xxxx xxxx

Related

Using git diff to replicate changes in another directory

I have multiple websites structured (simplified) as follows under a single GIT repository:
/
/site-1
/site-1/index.js
/site-1/about.js
/site-1/package.json
/site-1/node_modules(not versioned)
/site-1/package-lock.json(not versioned)
/site-2
/site-2/index.js
/site-2/about.js
/site-2/package.json
/site-2/node_modules(not versioned)
/site-2/package-lock.json(not versioned)
/site-3
/site-3/index.js
/site-3/about.js
/site-3/package.json
/site-3/node_modules(not versioned)
/site-3/package-lock.json(not versioned)
I did some amendments in /site-1/index.js, /site-1/package.json and added a file /site-1/changes.md.
The changes were done in 2 separate git commit in a feature branch called feature/carousel.
I want to apply the same changes in /site-2 and /site-3.
I've tried the following:
git format-patch master -o patches to retrieve the new diff in this feature branch with regards to master branch, but i was unable to apply the diff in /site-2 and /site-3.
diff -ruN site-1 site-2 > PatchFile1 to generate a consolidated diff, but it takes into account files that have been modified in /site-2 as well and its not a generic diff that can be applied directly to /site-3
Any idea how to achieve this?
You can use git apply with the --directory option to apply a patch to another main directory, as explained here:
https://blog.soltysiak.it/en/2017/08/how-to-use-git-patch-system-to-apply-changes-into-another-folder-structure/
First, create a patch file changes.patch based on the changes applied to directory site-1. Then you can do the following:
git apply -p1 --directory='site-2' changes.patch
git apply -p1 --directory='site-3' changes.patch
-p1 removes the site folder from the patch headers, which is the main part that differs between the different directories.
--directory='site-2' will cause the site-2 prefix to be added to each header in the patch

In perforce, how to remove a symlink to a directory and add files in the same directory?

This can be done like this:
1. p4 delete dir,
p4 submit;
2. p4 add dir/file,
p4 submit;
Is there a way to do this in one go?
I don't want to do p4 submit in step 1 because not having that directory will break things at my end.
There does not seem to be anything preventing this:
C:\Perforce\test\dir>p4 opened
//stream/main/dir#1 - delete default change (symlink)
//stream/main/dir/bar#1 - add default change (text)
//stream/main/dir/foo#1 - add default change (text)
C:\Perforce\test\dir>p4 submit -d "presto"
Submitting change 106.
Locking 3 files ...
delete //stream/main/dir#2
add //stream/main/dir/bar#1
add //stream/main/dir/foo#1
Change 106 submitted.

Can't add files in perforce

As far as I can tell, my client is setup correctly:
$ p4 client -o
# A Perforce Client Specification.
# ...
Client: stephen-dev1-stephen
Update: 2014/06/26 17:41:14
Access: 2014/06/26 17:45:47
Owner: StephenRasku
Host: stephen-dev1
Description:
Created by StephenRasku.
Root: /home/stephen/Code
Options: noallwrite noclobber nocompress unlocked nomodtime rmdir
SubmitOptions: submitunchanged
LineEnd: local
View:
//depot/labs/products/component/SpamView-URI/... //stephen-dev1-stephen/SpamView-URI/...
//version/... //stephen-dev1-stephen/version/...
//thirdparty/... //stephen-dev1-stephen/thirdparty/...
//starteam/... //stephen-dev1-stephen/starteam/...
//specs/... //stephen-dev1-stephen/specs/...
//release/... //stephen-dev1-stephen/release/...
//projects/... //stephen-dev1-stephen/projects/...
//main/... //stephen-dev1-stephen/main/...
//features/... //stephen-dev1-stephen/features/...
//dev/... //stephen-dev1-stephen/dev/...
//depot/... //stephen-dev1-stephen/depot/...
The files exist:
$ pwd
/home/stephen/Code/SpamView-URI
$ ls mainline/EBUILD_VERSION mainline/package.sh mainline/ebuild
mainline/ebuild mainline/EBUILD_VERSION mainline/package.sh
But it complains when I try and add them:
$ p4 add mainline/EBUILD_VERSION mainline/package.sh mainline/ebuild
mainline/EBUILD_VERSION - file(s) not in client view.
mainline/package.sh - file(s) not in client view.
mainline/ebuild - file(s) not in client view.
What's the problem? I checked out the file using git p4 clone if that makes a difference.
Check the "View" lines in the client workspace specification to confirm
that the file specification used in your Perforce command (or appearing in the error message)
falls within your workspace view. If you see an error attempting to add a file,
for example, you might want to check your mapping to confirm that the
file resides in a directory that is within your client view.
See the section under 'Client Workspace View':
http://answers.perforce.com/articles/KB_Article/Common-Permissions-and-File-Access-Problems
Are the files under this exact directory structure below?
/home/stephen/Code/SpamView-URI/mainline/EBUILD_VERSION
/home/stephen/Code/SpamView-URI/mainline/package.sh
/home/stephen/Code/SpamView-URI/mainline/ebuild
Judging by the first View mapping line of:
//depot/labs/products/component/SpamView-URI/... //stephen-dev1-stephen/SpamView-URI/...
I would guess that is the path they should be under.
If you 'cd' into the '/home/stephen/Code/SpamView-URI/mainline'
directory are you able to add these files?
Your client spec isn't right, as you noticed. With these 2 lines,
//depot/labs/products/component/SpamView-URI/... //stephen-dev1-stephen/SpamView-URI/...
//depot/... //stephen-dev1-stephen/depot/...
Your trying to map the files under //depot/labs/products/component/SpamView-URI/... to both //stephen-dev1-stephen/SpamView-URI/... and //stephen-dev1-stephen/depot/labs/products/component/SpamView-URI/... Since perforce reads top to bottom, it will overwrite your first mapping with the second mapping, basically removing the second mapping. \
Move your //depot/labs/products/component/SpamView-URI/... //stephen-dev1-stephen/SpamView-URI/... to the last line, and you should be ok.

How to revert a subversion ignore?

I've run the following command via commandline:
svn propset svn:ignore "*.classpath" .
I wanted to only ignore the .classpath file.
However, this seems to have messed things up and now a lot of directories seem to be ignored.
How do I revert this and start over?
svn propedit svn:ignore . should bring up your editor, where you can remove the offending ignores one at a time.
Note
For this svn:ignore you effectively said "ignore in the currect directory only files with extension classpath": patterns for filenames in Subversion uses only OS-specific glob-pattern, not regexps
Fixes for syntax of DaFunix
List all svn-properties and their values in somepath: svn proplist -v <PATH>|<URL>. For your case
svn proplist -v .
Sample output for my URL
>svn proplist -v http://mayorat.ursinecorner.ru:8088/svn/Hello/trunk/
Properties on 'http://mayorat.ursinecorner.ru:8088/svn/Hello/trunk':
bugtraq:logregex
([Ff][Ss])\s#
(\d+)
svn:mergeinfo
/branches/Greetings:3-12
/branches/i18n:18-20
List single svn:property value (with known name): svn propget <PROPERTY> <PATH>|<URL>. For your case
svn propget svn:ignore .
Sample output for my URL (same as before for proplist)
>svn propget bugtraq:logregex http://mayorat.ursinecorner.ru:8088/svn/Hello/trunk/
([Ff][Ss])\s#
(\d+)
Both proplist and propget operations are RO, will change nothing
In order to fix bad definition of property you can
or
Delete bad property and re-create it in correct form:
svn propdel svn:ignore . & svn propset svn:ignore "classpath" . (maybe use propset with -R option to define ignore resursively for the whole subtree)
or (as suggested by John Brodie) edit and fix current definition
svn propedit svn:ignore . and in editor window "*.classpath" change to "classpath", save
PS Don't forget:
commit correct form of added property
remove from versioned code previously (possibly) added classpath files: svn:ignore affect only unversioned new files, already added to repo files with current ignore-pattern must be unversioned by hand

Tortoise SVN merge

I have a file a.c in the branch branch_1 with below versions.
Previous version: 10
Next version : 20
Current version :25
My working copy is branch_2
I want to merge the difference between versions 20 and 10 in branch_1 to working copy only for a.c file.
How can I merge it using tortoise svn?
I had written below batch file to work manually execute the bat file, but I want to do this with tortoise svn + external diff program.
#ECHO OFF
set svn_url="https://Project/branches/"
SET DIFF3="C:\Program Files\Beyond Compare 3\BComp.exe"
SET BRANCH=%1
SET FOLDER=%2
SET FILE=%3
SET NV=%4
SET PV=%5
svn co %svn_url%/%BRANCH%/%FOLDER%/ --depth empty
cd %FOLDER%
svn update -r %NV% %FILE%
del %FILE%_%NV%
rename %FILE% %FILE%_%NV%
svn update -r %PV% %FILE%
del %FILE%_%PV%
rename %FILE% %FILE%_%PV%
%DIFF3% %FILE%_%NV% D:\Projct\%FOLDER%\%FILE% %FILE%_%PV%
pause
I'm not sure what current version 25 means when next version is 20.
But to merge in tortoise, right click on your working copy, either a directory or a file, select merge. Choose the source file/directory you want to merge changes from and pick the revisions from the dialog that pops up. Its really simple.

Resources