-
Set up environment variables
Assign a text editor to the SVN.
> export SVN_EDITOR=vim
Project developers can access the SVN through SSH protocol.
> export SVN_ROOT=svn+ssh://exact@access.cims.nyu.edu/home/exact/svn/exact
-
Checking out the SVN remotely (assuming pre-existing
repository, e.g., corelib2)
For developers who has access to the repository,
(see the section B of
Collaboration Using CVS
to obtain access.)
> svn co $SVN_ROOT/corelib2 [LOCALDIR]
This will check out corelib2 to [LOCALDIR].
Although [LOCALDIR] is optional,
it is useful to have (else you get a long path).
-
Commitment after your modifications to a file
First resolve conflicts (if any) and then commit:
> svn resolved [filename]
> svn commit [filename]
-
Adding or deleting a file or directory
> svn add [file-or-dirname]
> svn delete [file-or-dirname]
-
Renaming or Copying
> svn move [orig-filename] [new-filename]
> svn copy [source-filename] [destination-filename]
-
Creating a new repository from a current directory NEWDIR:
> cd NEWDIR
> svn import [PATH=.]
https://subversive.cims.nyu.edu/exact/collab/etc/etc.
Note that PATH is optional (defaults to ".").
-
Selective Checkouts of a directory [foobar]:
> svn co --depth immediates $(SVN_ROOT)/[foobar] [local-foobar]
will checkout only the top-level files and folders to [local-foobar].
Instead of "immediates", you may want
"files" or "empty". Default depth is "infinity".
For selective checkouts, use "empty" or "immediates".
If [foobar] has file1, folder1 and folder2, you now see a copy
of these 3 files in [local-foobar].
To check out the all the contents of folder1, do this:
> svn up --set-depth infinity [local-foobar]/[folder1]
Note that we call "svn up" not "svn co" here.
If you want to find out the current depth of a folder foobar,
do this:
> svn info [foobar] | grep "Depth"
Nothing is printed if the Depth is infinity.
Otherwise, it might print "Depth: immediates" or similar.
-
How to lookup or revert to older versions of file [foo]:
First, find out which versions are available by doing:
> svn log [foo]
There are probably many output lines with this format:
r4321 | yap | 2019-02-01 15:32:49 -0400 (Sat, 01 Feb 2019) | 1 line
indicating revision No.4321 with one line change
was commited by yap on Feb 1st, 2019.
You can put a version of the file in [foo-v4321] with
> svn cat -r 4321 [foo] > foo-v4321
or just look at this version on the screen using programs
such as "more" or "less":
> svn cat -r 4321 [foo] | less
Of course, you can also update your latest version to v.4321:
> svn update -r 4321 [foo]
-
How to compare (i.e., diff) two versions of file [foo]:
(1) The simplest usage is to compare your local copy of [foo]
with the version in svn.
Here are 3 equivalent ways to do this:
> svn diff [foo]
> svn diff [foo] > [bar]
> svn diff -r4321 [foo]
The first form is simplest.
The second form is used to re-direct the
screen output into a file called [bar].
The third form is equivalent the first two forms
provided the latest revision number of [foo] is 4321.
Of course, you can replace 4321 by
any older revision number.
(2) Suppose you want to compare two previous revisions of [foo]
that are already in svn.
First, find out which revisions are available:
> svn log [foo]
From the output, suppose you decide to compare
revisions 4321 and 4322. Then do:
> svn diff -r 4321:4322 [foo]