Source Control
Jump to:
centralized scm distributed scm
============================= ====================================
task: svn rcs git hg/mercurial
----------------------------- --------------- ------------- ----------------------- -------------
update repo: up co?
check out co co clone clone
checkout tags/2.2
lock file for edit not needed? co -l not needed
check in ci ci commit -a, push
what has changed? status status
diff b/w current and repo: diff rcsdiff diff diff
change list: log rcs log log --oneline
git (and mercurial hg) is a distributed source control system.
Traditional scm like svn, cvs, p4, rcs, are centralized system and has a single primary repo.
git has a very different mode operandi than the traditional system, thus the table of
"equivalent" commands above is somewhat misleading. RTFM!! =)
SVN Subversion commands
svn checkout http://svn-server/path/to/project localDirName
# download all files related to a svn project/repo
# storing all files in a subfolder called "localDirName"
# .svn/entries should have the URL of the source
svn info # tell where svn tree source info
svn add file # add a file into svn repo (this auto check in the file??)
svn mkdir foo # create a new dir and have it added to repo (after ci)
svn ci # check in, ie, commit changes into svn
svn ci file1 file2 # check in only specified file(s). note that removing entry in the comment window does NOT remove the file from being commited!!
svn diff file # diff b/w working copy and last version in repo
svn diff file # diff b/w working copy and last version in repo
proxy settings. Unfortunately don't seems to have a cli method to change it.
playing with exceptions maybe the trick.
it does NOT heed environment variable http_proxy
edit $HOME/.subversion/server
in the global section, there are several proxy clauses, eg
### http-proxy-host Proxy host for HTTP connection$
### http-proxy-port Port number of proxy host service$
### http-proxy-username Username for auth to proxy service$
### http-proxy-password Password for auth to proxy service$
### http-proxy-exceptions List of sites that do not use proxy$
If cached password has been changed,
rm ~/.subversion/auth
(caching password is not recommended, svn does warn that it is not secure...
but didn't see cleartext password stored there,
maybe is is simple obfuscation rather than real encryption.
and file could be copied... )
--
svnadmin create # these are admin commands, such as create a new svn repository.
Granting user read (r) or read/write (rw) access to a svn repo, edit
/etc/opt/CollabNet_Subversion/conf/svn_access_file
be careful with typo. a single mistake will render the file unparseable and no one would be able to use svn !!
--
svnlook info somerepo # these will look at a repo w/o checking it out
svnlook log somerepo
svnlook tree somerepo
--
Tortoise SVN is a simple, lightweight SVN client avail in windows.
cvs
$CVSROOT the source dir
$PROJROOT the local dir where copy of cvs is placed, this is the
edit place till changes are commited
so far, only successful by checking out files while pwd=$PROJROOT, and then spe
cify full path for file. if just specify dir name, the whole sub dir is checke
d out
cvs co dir/filename check out file
cvs add add file to c vs tree
cvs commit make changes permanenet
RCS
RCS is pretty old school. It does work out of a simple directory on the file system, no external server needed.
co -l {filename} check out file (with lock) from rcs sys
co -r1.123 {filename} check out revision 1.123
co -r {filename} check out latest verstion,
will prompt to overwrite co -l files (at least then when you do ci, it will say file not changed
and effectively reversed to original content)
ci {filename} put file back into rcs
ci -u {filename} (the -u leave a read only copy of the file, as if run co immediately after ci, always use it:))
rlog {file} display rcs edit log
rcsdiff {file} display diff b/w current file content and its previous version
rcsdiff -r1.1 display diff b/w current file and version 1.1 of the file
rcs -u {file} forces an unlock a file locked by some other user.
rcs -aUID FILE add access for user UID to the FILE (but didn't work, maybe file need to be group writable).
ref: http://pages.cs.wisc.edu/~plonka/sysadmin/article.html
or ch 39.5 of Unix Power Tools 3rd Ed.
perforce
if submit has problems, can do:
p4 revert -a = revert files that have not been edited (no changes)
very useful after accidental p4 edit ... !!!
p4 revert = note, old changes to file will be DELETED.
p4 change -d {change#} = remove change request
p4 changes -m100 = check for list of changes, use grep to find my own. (-m100 show last 100 changes only. the cmd shows all historical data).
to sync files in selected dir only.
cd to the desired dir, then do:
p4 sync ...
or, pf sync /path/to/dir/...
the '...' indicate the 'files in this position at the depot'.
sync against a known date/time
p4 sync ...@"2002/06/22 00:01"
Time can be omitted, it will default to the beginning of that date (not the end!)
sync against a label?
p4 diff FILE
the entries marked by '<' is my own file
and those in '>' is the file in p4
(diff file1 file2, < is left file1, > is right file2, so I guess p4 diff check
out a file as temp and use that as file2).
p4 diff FILE#1 FILE#3
compare version 1 and 3 of FILE
p4 sync -n ... # just see changes for current dir
p4 sync -f ... # force all update on current dir (only force refresh of
files not checked out, as in refresh accidental removal of non locked file.
those that have been updated remains open, no accidental erasure cuz of
refresh )
p4 opened ... # list of files opened
p4 edit {file} # open a file for editing
p4 branches # list p4 branches that can be added to client view.
p4 log... ? # see revision history of file
zmbl stuff?
p4rename : script to rename a file checked into P4.
-t {FILETYPE}
FILETYPE one of symlink, etc
change file to executable
p4 edit -t kxtext FILE
p4 submit
mercurial hg commands
hg clone https://bitbucket.org/galaxy/galaxy-dist/
hg update stable
# setup and download the galaxy repo from bitbucket
git
section about git moved to git.html
Git the Princess
Thanks to the folks at
toggl
hoti1
bofh1