Pagine

Wednesday 21 December 2016

SVN tutorial n 25 - mergeinfo

The svn mergeinfo command shows the query information related to merges (or potential merges) between a "source url" and "target". If the --show-revs option is not provided, display revisions which have been merged from "source url" to "target". Otherwise, display either merged or eligible revisions as specified by the --show-revs option. The svn mergeinfo command requires a "source" URL (where the changes come from), and takes an optional "target" URL (where the changes merge to). If no target URL is given, it assumes that the current working directory is the target.
The synopsis is:
 svn mergeinfo <source_url>[@<svn_revision>] [<target>[@<svn_revision>]]

Examples

Merge info between a branch and a working copy
 svn mergeinfo https://svnrepo/svn/myproject/branches/myproject-1.1
Merge info between a branch and trunk
 svn mergeinfo https://svnrepo/svn/myproject/branches/myproject-1.1@33 https://svnrepo/svn/myproject/trunk

Tuesday 20 December 2016

SVN tutorial n 24 - unlock

The svn unlock command unlocks files or directories previously locked.  If any file (or directory) is locked by another user or no valid lock token exists in the working copy,
print a warning and continue unlocking the rest of the files (and directories). Use "--force" to break a lock belonging to another user or working copy. The synopsis is:
 svn unlock <path>
When a commit fails due to someone else's locks, it's fairly easy to learn about them. The easiest way is to run:
 svn stat -u

Examples:

1) unlock the files in working copy
 svn unlock file1.txt file2.txt fileN.txt
2) unlock a file already locked by another user
 svn unlock --force file1.txt
3) unlock a file via url
 svn unlock https://svnrepo/svn/myproject/trunk/file3.txt

Monday 19 December 2016

SVN tutorial n 23 - lock

The svn lock command locks working copy a path or an Url in the repository so that no other user can commit changes to them.
If any files are already locked by another user, print a warning and continue locking the rest of files. Use the option "--force" to steal a lock from another user or working copy.
The synopsis is:
 svn lock <path>

Examples:

1) lock the files in working copy
 svn lock file1.txt file2.txt fileN.txt
2) lock a file already locked by another user
 svn lock --force file1.txt
3) lock a file via url
 svn lock https://svnrepo/svn/myproject/trunk/file3.txt

Friday 16 December 2016

SVN tutorial n 22 - log

The "svn log" command shows log messages from the repository. If no arguments are supplied, svn log shows the log messages for all files and directories inside (and including) the current working directory of your working copy. You can refine the results by specifying a path, one or more revisions, or any combination of the two. The default revision range for a local path is BASE:1.
Instead If you specify a URL alone, it prints log messages for everything the URL contains. If you add paths past the URL, only messages for those paths under that URL will be printed. The default revision range for a URL is HEAD:1. The synopsis is:
 svn log [PATH]
or
 svn log URL[@REV] [PATH...] 

Examples:

1) log of current folder
 svn log
2) log of a local file target
 svn log MyFile.txt
3) log of a file via url
 svn log https://mysvnrepo/svn/myproject/trunk/MyFile.txt
4) log for revision
 svn log -r 3:6 MyFile.txt
5) log for revision of a file via url
 svn log -r 3:6 https://mysvnrepo/svn/myproject/trunk/MyFile.txt
6) log in xml format
 svn log --xml https://mysvnrepo/svn/myproject/trunk/MyFile.txt

Thursday 15 December 2016

SVN tutorial n 21 - list

The "svn list" command shows the entry list on repository, this command is simalar to onomimus bash command. The synopsis is:
 svn list <target>[@<svn_revision>]
or
 svn ls <target>[@<svn_revision>]
Where <target> can be the local working copy or remote url. If <target> is not present the command will show the current local directory.
You can use this command for a precise revision using -r option or the sintax with "@".
An other helpful option is --xml for the output format in xml.

Examples:

1) List of trunk via url
 svn list https://svnrepo/svn/myproject/trunk
2) List in myfolder (local copy)
 svn list myfolder
3) List of trunk via url with revision number 40 with xml format
 svn list --xml https://svnrepo/svn/myproject/trunk@40

Wednesday 14 December 2016

SVN tutorial n 20 - export

The svn export command can be used in two modes: the first exports a clean directory tree from the repository specified by <svn_url> at revision <svn_revision> if it is given; otherwise, at <head>, into <path>. If <path> is omitted, the last component of the <svn_url> is used for the local directory name. The synopsis is:
 svn export [-r <svn_revision>] <svn_url> [<path>]
Example:
 svn export https://svnrep/svn/myproject/trunk/folder folder-new
A    folder-new
Exported revision 4.
Instead the second mode exports a clean directory tree from the working copy specified by <path1> into <path2>. All local changes will be preserved, but files not under version control will not be copied.
The synopsis is:
 svn export [-r <svn_revision>] <path1> [<path2>]
Example:
 svn export folder folder-new
Export complete. When rolling operating-system-specific release packages, it can be useful to export a tree that uses a specific EOL character for line endings. The --native-eol option will do this, but it affects only files that have svn:eol-style = native properties attached to them. For example, to export a tree with all CRLF line endings (possibly for a Windows .zip file distribution):
 svn export https://svnrep/svn/myproject/trunk/folder folder-new --native-eol CRLF
A    folder-new
Exported revision 4.
You can specify LR, CR, or CRLF as a line-ending type with the --native-eol option.

Tuesday 13 December 2016

SVN tutorial n 19 - changelist

The svn changelist command associates (or deassociates) local paths with a changelist. I suggest to use this command when a svn commit is associated to a specific issue. The synopsis for associate is:
 svn changelist <clname> <files>
or
 svn cl <clname> <files>
instead the synopsis for deassociate is:
 svn changelist --remove <files>

Examples: 

1) Create a changelist:
 svn changelist issue1 Myfile.txt Myfile2.txt
 svn status
M       Myfile3.txt
--- Changelist 'issue1':
M       Myfile.txt
A       Myfile2.txt
 svn commit --changelist issue1 -m "Issue 1"
 svn status
M       Myfile3.txt
2) Deassociate files:
 svn changelist issue2 Myfile3.txt
 svn status
--- Changelist 'issue2':
M       Myfile3.txt
 svn changelist --remove Myfile3.txt
 svn status
M       Myfile3.txt

Monday 12 December 2016

SVN tutorial n 18 - cat

The svn cat command displays on standard output the contents of the specified files or URLs. This command is similar as homonym bash command. The synopsis is:
svn cat <path>
The option -r is used for display the file with a specific revision number.
Examples:
svn cat MyFile.txt
svn cat https://mysvnrepo/svn/trunk/MyFile.txt
svn cat -r 123 MyFile.txt

Wednesday 7 December 2016

SVN tutorial n 2 - status

Display the status of working copy files and directories. Diff between your workspace and code repository.
 svn stat <path>
or
 svn st <path>
or
 svn status <path>
<path> is optional parameter, the default value is current folder ( . ). The command output shows the file list with the status for each file. The following status are the most common:  'A' Item is scheduled for addition.
 'D' Item is scheduled for deletion.
 'M' Item has been modified.
 '?' Item is not under version control.
 '!' Item is missing (e.g., you moved or deleted it without using svn). This also indicates that a directory is incomplete (a checkout or update was interrupted).
 '~' Item is versioned as one kind of object (file, directory, link), but has been replaced by a different kind of object.
The full list you can see the following link: http://svnbook.red-bean.com/en/1.7/svn.ref.svn.c.status.html The option '--xml' gets the output in XML format
svn status --xml 
This XML can be redirected to a file, this can be useful, for example, for an automation procedure
svn status --xml > myproject-status.xml

SVN tutorial n 17 - blame

The "svn blame" command shows author and revision information inline for the specified files or URLs. In detail for each line of a file gets three fields:
  1. author
  2. svn revision number
  3. text
The synopsis is:
 svn blame <path>[@<svn_revision>]
Examples:
Usage in local working copy:
 svn blame MyFile.txt
Use in remote url and svn revision number
 svn blame https://mysvnrepo/svn/myproject/trunk/MyFile.txt@123
The option "--extensions (-x)" does not consider the minimal modifications as whitespace.
 svn blame --extensions MyFile.txt
Instead with option --xml you can get XML output:
 svn blame --xml MyFile.txt

Tuesday 6 December 2016

SVN tutotial n 16 - diff

The "svn diff" command displays the differences between two revisions or paths. You can use svn diff in the following ways:
1) Use just svn diff to display local modifications in a working copy.
 svn diff [-c M | -r N[:M]] [TARGET[@REV]...]
Examples:
Compare BASE and your working copy
 svn diff MyFile.txt 
See what changed in the file MyFile.txt revision 3000:
 svn diff -c 3000 MyFile.txt
2) Display the changes made to TARGETs as they are seen in REV between two revisions. TARGETs may be all working copy paths or all URLs. If TARGETs are working copy paths, N defaults to BASE and M to the working copy; if TARGETs are URLs, N must be specified and M defaults to HEAD. The -c M option is equivalent to -r N:M where N = M-1. Using -c -M does the reverse: -r M:N where N = M-1.
 svn diff [-r N[:M]] --old=OLD-TGT[@OLDREV] [--new=NEW-TGT[@NEWREV]] [PATH...]
Example:
Compare revision 3000 to revision 5000 using range notation (pass only the one URL in this case):
 svn diff -r 3000:5000 http://mysvnrepo/svn/trunk/MyFile.txt
3) Display the differences between OLD-TGT as it was seen in OLDREV and NEW-TGT as it was seen in NEWREV. PATHs, if given, are relative to OLD-TGT and NEW-TGT and restrict the output to differences for those paths. OLD-TGT and NEW-TGT may be working copy paths or URL[@REV]. NEW-TGT defaults to OLD-TGT if not specified. -r N makes OLDREV default to N; -r N:M makes OLDREV default to N and NEWREV default to M.
 svn diff OLD-URL[@OLDREV] NEW-URL[@NEWREV]
Example:
Compare two tags:
 svn diff http://mysvnrepo/svn/tags/tag-1 http://mysvnrepo/svn/tags/tag-2
The versions are managed via the --revision (-r) option or by using the “@” notation as described earlier. Example:
 svn diff http://mysvnrepo/svn/trunk/MyFile.txt@3000 http://mysvnrepo/svn/trunk/MyFile.txt@5000
You can use the --xml option along with the --summarize option to view XML describing the changes that occurred between revisions, but not the contents of the diff itself:
 svn diff --summarize --xml http://mysvnrepo/svn/trunk/MyFile.txt@3000 http://mysvnrepo/svn/trunk/MyFile.txt@5000

Thursday 1 December 2016

SVN tutorial n 15 - mkdir - How to create a new directory by CLI

The svn "mkdir" command creates a new directory under version control. This command can be used in two modes. First, using a local path as below:
 svn mkdir <path>
Example:
 svn mkdir myDirectory
 A         myDirectory
 ...
 svn commit -m "created a new directory" myDirectory
Second mode, using the remote url as below:
 svn mkdir <svn_url> -m "comment..."
Example:
 svn mkdir https://my-svn-repo/svn/trunk/myDirectory -m "created a new directory"