Pagine

Friday, 25 November 2016

SVN tutorial n 14 - resolve

The svn "resolve" command resolves the “conflicted” state on working copy files or directories. The synopsis is:
 svn resolve <path>
This routine does not semantically resolve conflict markers; however, it replaces <path> with the version specified by the "--accept" argument and then removes conflict-related artifact files. This allows <path> to be committed again that is, it tells Subversion that the conflicts have been “resolved.”
Example:
Using the same example used in [1]
> svn update
 Updating '.':
 C    MyFile.txt
 Updated to revision 31.
 Summary of conflicts:
 Text conflicts: 1
After a postponed conflict resolution during update, svn resolve replaces the all conflicts in file MyFile.txt with your edits:
> svn resolve --accept mine-full MyFile.txt

Link

[1] http://informaticaamodomio.blogspot.com/2016/11/svn-step-13-resolved.html

Thursday, 24 November 2016

SVN tutorial n13 - resolved

The svn resolved command removes “conflicted” state on working copy files or directories. The synopsis is:
 svn resolved <path>
Example:
> svn update
 Updating '.':
 C    MyFile.txt
 Updated to revision 31.
 Summary of conflicts:
 Text conflicts: 1
> ls MyFile.txt*
 MyFile.txt
 MyFile.txtmine
 MyFile.txt.r30
 MyFile.txt.r31
where:
MyFile.txt – the original with markers
MyFile.txt.mine – your version
MyFile.txt.r30 – the original your worked with
MyFile.txt.r31 – the most update version from other user
If you want use your version
> cp MyFile.txt.mine MyFile.txt
> svn resolved MyFile.txt
> svn commit -m "resolved..." MyFile.txt
This command has been deprecated in favor of running "svn resolve --accept working PATH."
The svn resolve command will be described in next posts.

Monday, 31 October 2016

SVN tutorial n 12 - cleanup

The svn cleanup executes recursively the clean up the working copy.
The synopsis is:
svn cleanup <local_path>
If <local_path> is omitted, “.” is assumed (default value).
If you ever get a working copy locked error, run this command to remove stale locks and get your working copy into a usable state again. If, for some reason, an svn update fails due to a problem running an external diff program (e.g., user input or network failure), pass the --diff3-cmd to allow the cleanup process to complete any required merging using your external diff program. You can also specify any configuration directory with the --config-dir option, but you should need these options extremely infrequently.

Examples:

Clean up current folder (recursively)
svn cleanup
Clean up of a subfolder (recursively)
svn cleanup myfolder

Friday, 28 October 2016

SVN tutorial n 11 - import

The svn import command commits an unversioned file or tree into the repository.
The synopsis is:
 svn import -m "initial commit" <local_path> <url_svn_repository>
If <local_path> is omitted, “.” is assumed (default value).
After importing data, note that the original tree (<local_path>) is not under version control. To start working, you still need to svn checkout a fresh working copy of the tree.

Examples:

This imports the local directory myproject into trunk/project in your repository. The directory trunk/project need not exist before you import into it—svn import will recursively create directories for you.
 svn import -m "initial commit" myproject https://mysvnrepo/svn/trunk/project
Adding         myproject/file.txt
…
Transmitting file data .........
Committed revision 30.
Be aware that this will not create a directory named module-a in the repository. If that's what you want, simply add module-a to the end of the <url_svn_repository>:
 svn import -m "initial commit" module-a https://mysvnrepo/svn/trunk/project/module-a
Adding         module-a/file2.txt
…
Transmitting file data .........
Committed revision 32.

Thursday, 27 October 2016

SVN tutorial n 10 - merge

The svn merge command applies the differences between two sources to a working copy path.

The synopsis is:
 svn merge [-c M[,N...] | -r N:M ...]  <source>[@svn_revision] <target>

or
 svn merge --reintegrate  <source>[@svn_revision] <target>

or
 svn merge <source1>[@svn_revision_N] <source2>[@svn_revision_M] <target>

In all three forms <target> is the working copy path that will receive the differences. If <target> is omitted, the changes are applied to the current working directory, unless the sources have identical basenames that match a file within the current working directory.  In this case, the differences will be applied to that file.

In the first two forms, <source> can be either a URL or a working copy path (in which case its corresponding URL is used). If the peg revision "svn_revision" is not specified, then HEAD (latest svn revision) is assumed. In the third form the same rules apply for <source1>, <source2>, "svn_revision_N", and "svn_revision_M" with the only difference being that if either source is a working copy path, then the peg revisions must be explicitly stated.


Sync and Cherrypick Merges

The first form, when used without either the -c or -r options, is called a “sync” merge and -r 1:svn_revision is implied. This variant is used to merge all eligible changes to a branch from its immediate ancestor branch.

When the first form is used with the -c or -r options, this is called a “cherrypick” merge and is used to merge an explicitly defined set of changes from one branch to another.



Multiple -c and/or -r instances may be specified, and mixing of forward and reverse ranges is allowed— the ranges are internally compacted to their minimum representation before merging begins (which may result in a no-op merge or conflicts that cause the merge to stop before merging all of the requested revisions).

In both variants of the first form, <source> in revision "svn_revision" is compared as it existed between revisions "svn_revision_N" and "svn_revision_M" for each revision range provided.




Reintegrate Merges


The second form is called a “reintegrate merge” and is used to bring changes from a feature branch (<source>) back into the feature branch's immediate ancestor branch (<target>). Reintegrate merges support only this specialized use case and as such have a number of special requirements and limitations that the other two merge forms do not posses.



2-URL Merges


In the third form, called a “2-URL Merge”, the difference between <source1> at revision "svn_revision_N" and <source2> at revision "svn_revision_M" is generated and applied to <target>.
The revisions default to HEAD if omitted.

If Merge Tracking is active, then Subversion will internally track metadata (i.e. the svn:mergeinfo property) about merge operations when the two merge sources are ancestrally related—if
the first source is an ancestor of the second or vice versa—this is guaranteed to be the case when using the first two forms. Subversion will also take preexisting merge metadata on the working copy target into account when determining what revisions to merge and in an effort to avoid repeat merges and needless conflicts it may only merge a subset of the requested ranges.

Merge Tracking can be disabled by using the --ignore-ancestry option.


Unlike svn diff, the merge command takes the ancestry of a file into consideration when performing a merge operation. This is very important when you're merging changes from one branch into another and you've renamed a file on one branch but not the other.







Examples:


Merge a branch back into the trunk (assuming that you have an up-to-date working copy of the trunk):
 svn merge --reintegrate https://mysvnrepo/svn/branches/myproject-branch-1.0
 svn commit -m "Merge myproject-branch-1.0 back into trunk."



To merge changes to a single file:
 svn merge -c 31 ^/trunk/myfile.txt myfile.txt 


Merge between two revision revisions:
 svn merge https://mysvnrepo/svn/branches/myproject-branch-1.0 -r103:HEAD

Wednesday, 26 October 2016

SVN tutorial n 9 - move

The svn move command move a file or directory. The synopsis is:
 svn move <src> <dst>
or
 svn mv <src> <dst>
The <src> and <dst> can be local path or url.

Examples:

Use move command in your working copy
 svn move myfile.txt myfile2.txt
A myfile2.txt
D myfile.txt
Use the commit command to update the svn repository  
svn ci -m "move example"
Committed revision 1233
Use move command with url
 svn move -m "move example 2" https://mysvnrepo/svn/trunk/myfile.txt https://mysvnrepo/svn/trunk/myfile2.txt
Committed revision 1234

Tuesday, 25 October 2016

SVN tutorial n 8 - revert

The svn revert command undo all locat edits. Yuo can revert all files or folders with status A, M and D. The synopsis is:
 svn revert <path>

Examples:

Revert a folder edited
 svn revert myfolder
Reverted myfolder
Revert a file added
 svn add myfile.txt
A myfile.txt
 svn revert myfile.txt
Reverted myfile.txt
 svn status
? myfile.txt
If you want to revert a whole directory of files, use the "--depth=infinity" option:
 svn revert --depth=infinity .
Reverted myfolder Reverted myfile.txt