Tuesday, January 17, 2012

SVN tutorial

Some SVN command line help tutorial ...

It was copied from http://www.yolinux.com/TUTORIALS/Subversion.html#COMMAND


Subversion Introduction:

Subversion is a software source code "Change Management" (CM) system for collaborative development. It maintains a history of file and directory versions. The files and directories are checked out of the repository and into your local project work area. This called your "working directory". Changes are made to files in your "working directory". After changes are made to the create the next working version, the files are checked into the Subversion CM repository.


Subversion Commands:
Subversion command summary cheat sheet:

CommandDescription
svn --helpList Subversion commands
svn help command
Also: ? or h
Help on given "command"
svn add filename

svn add directory

Add a file or directory to Subversion CM control.
Must also perform: svn ci filename (or svn commit) to upload the file or directory. File will not be available in the repository until a "commit" is performed. If adding a directory, the directory and all of its contents recursively are added. i.e.:
svn ci directory
svn commit directory
svn commit .
svn blame filename
svn blame -r RevisionNumber filename
Also: praise, annotate, ann
Show file contents with revisions annotated with author information.
svn cat filenameList contents of file under Subversion control.
svn checkout http://node-name/repos/svn/trunk/parentPath/path
This creates:
path/file1
path/file2
...

svn checkout http://node-name/repos/svn/trunk/parentPath .
This creates:
path/file1
path/file2
...
Note the difference a "." makes.

svn checkout file:///repos/svn/trunk/path/
svn co -r 497 http://node-name/repos/svn/trunk/path file-name
Also: svn co https://..., svn://..., and svn+ssh://
MS/Windows: svn co file:///c:/repository/project/trunk

Checkout every file from the path and subdirectories specified below. Creates "working" copy of files and directories.
Checkout a repository.

Use option "-r" to specify a specific revision other than the latest.

The URL "svn://" communicates with an SVN server (port 3690)

The URL "http://" comunicates with the Apache server and module mod_dav_svn(port 80) [more common server]

svn cleanupCleanup subversion files resulting from escaped processes and crashed.
svn commit filename
svn commit --message "Message goes here." filename
svn commit -m "Message goes here." filename
svn ci filename1 filename2 filename3
svn ci .
Check-in (commit) local "working" file, files or directory and contents (recursively) into Subversion repository. Atomic, i.e. all committed or none, no incomplete check-in.
svn copy source destination_clone
Also: svn cp ...
Copy file or directory tree. One can copy from one local working copy to another or to repository server URL's. The sources and destinations can be working copies or URLs.
svn copy http://host/repos/project/trunk http://host/repos/project/tags/TagName-1.4.5 -m "Tag Release 1.4.5"Tag a release. Takes a snapshot of the repository and assigns a name. This can be performed at any directory branch.
svn copy . http://host/repos/project/tags/TagName-1.4.5 -m "Tag Release 1.4.5"Tag a release. Takes a snapshot of your local working copy and assigns a name. This can be performed at any directory branch.
svn delete filename
svn delete directory
Also: del, remove or rm
svn rm http://host/repos/project/trunk/file-or-directory
Delete file from repository. The UNIX command rm file-name. Must perform a "commit" to update the repository and local working directory with the changes. i.e.:
svn commit .
svn diff filename
svn di filename
Show file diffs between SVN repository and your file changes using GNU file diff format. Use GUI diff tools as shown below.
svn diff -r rev1:rev2 filenameShow file diffs between specified versions.
Example: svn diff -r 456:459 subfn.cpp
Using GUI diff tool: svn diff -r 457:459 --diff-cmd kdiff3 file-name
svn diff filename > patch-fileGenerate patch file used by the patch command.
svn export directoryExport directory tree to your file system but it will not be a "working directory" under SVN control.
svn export -r Rev-Number http://node-name/pathExport directory tree of specified version and create local directory tree and files not under SVN control.
svn import local-directory http://node/repos/svn/trunk/directoryAdd directory (and files in it recursively) to path in repository specified.
svn info filenameDisplay information about file or directory. (Date modified, author, revision, path in repository.)
Can not specify a URL.
svn list directory
svn list file-name
List file or directory of files in repository. Used to browse repository before checkout. If current directory is given (svn list ./), then Subversion will list the repository URL of the current directory.
svn list -r RevisionNumber directoryList directory of files in repository in specified revision.
svn lock filename -m "comment as to why its locked or by whom"

(Comment is not required but is often useful)
Lock file to grant exclusive access to one and forbid all others. A commit will unlock the file (unless the "--no-unlock" option is used). A lock can be removed with the commands: svn unlock filename, svnlook and the svnadmin comands (i.e. List: svnadmin lslocks and remove: svnadmin rmlocks filename).
svn log filename
svn log .
svn log http://URL/path/file
svn log -v .
svn log -r RevisionNumber http://URL/path/file
Show the Subversion log messages for a set of revision(s) and/or file(s) and/or all directory contents in repository.
List verbose. Includes list of all files in change
Shows the file changes associated with revision number.
svn merge http://url/path/branch1 http://url/path/branch2 working-local-dir
svn merge file1@revJ file2@revK
svn merge -r 414:411 http://url/path working-dir
svn merge -r 413:HEAD file-name
Merge directory changes into your current working directory or merge a file in Subversion into the file in your working directory. If target is not specified, the identical basename or current directory is assumed. Used to incorporate changes checked in which are not accounted for in your file or to merge branches.
Example using GUI merge tool:
svn diff -r 459:454 --diff-cmd kdiff3 --extensions '-m' file-name
Next, tell subversion that the conflicts have been resolved:
svn resolve file-name
Finally, check-in file: svn ci file-name
or abort changes: svn revert file-name
svn merge --dry-run -r 414:413 http://url/pathTest merge. No changes are made to your local working copy but shows Subversion feedback as if merge was performed.
svn merge -r 414:413 http://url/path
svn merge -r 414:413 .
Undo changes committed in revision 414.
svn mkdir directory
svn mkdir http://URL/directory
Create a new directory under version control.
svn move directory1 directory2
svn mv directory1 directory2
svn mv file-old-name file-new-name
Rename or move a file or directory. Moves/renames file/directory in repository and in local work area.
Must perform svn ci file-new-name after the move for changes to to take place in repository.
svn revert filenameUndo changes in local work files. Throw away local changes.
svn resolved filenameRun this command after resolving merge conflicts. Next "commit" your changes.
svn status
svn status -u
svn status -u .
svn status -uq .
Show status of file changes in current directory and recursively in directories below.
Show out of date file info: svn status --show-updates
(equivalent: svn status -u)
-u: Determines status by comparing your local repository with the server repository. Without this option, the status shown will only be the changes you have made in your local repository.

-q: Quiet. Do not print "?: File/directory not under version control" or "!: File/directory missing" extraneous information.

First collumn:

  • A: File to be added
  • C: Conflicting changes
  • D: File to be deleted
  • G: File to be merged with updates from server
  • M: File has been modified
  • R: File to be replaced
  • G: File to be merged
  • X: Resource is external to repository (svn:externals)
  • ?: File/directory not under version control
  • !: File/directory missing
  • ~: Versioned item obstructed by some item of a different kind.
Second collumn: Modification of properties
  • ' ' no modifications. Working copy is up to date.
  • 'C' Conflicted
  • 'M' Modified
  • '*' Local file different than repository. A newer revision exists on the server. Update will result in merge or possible conflict.
  • Third collumn: Locks
    • ' ' not locked
    • 'L' locked
    • 'S' switched to a branch
svn switch http://server/new-branch
svn switch --relocate http://server/old-path http://server/new-path
Switch your local working copy to mirror a new repository branch instead of main trunk or previous branch. Also allows you to point your repository to a new path on the server if the server path changes since you performed a check-out.
svn update
svn update filename
svn update -r458 filename
svn update --ignore-externals ./
Migrate all updates from Subversion repository to your local copy (recusively for all files in the current directory and all below it). If there have been updates to the svn repository since you downloaded the files, subversion will give you the opportunity to merge. Status of files will use the coding as stated above for "status". Files marked with a "C" (conflict) should be merged of reverted. If merged then one can perform a "resolve" and then a "check-in".
If a file name is specified, only that file is updated.
Can also syncronize to a specified revision given by -r.
Use --ignore-externals to avoid the slow processing of externals to a potentially slow distant internet server.

Where RevisionNumber is:

  • HEAD: The latest revision in the repository.
  • BASE: The "pristine" revision of an item in a working copy. Matches checked out version before any modifications.
  • COMMITTED: The last revision in which an item changed before (or at) BASE.
  • PREV: The revision just before the last revision in which an item changed. (Technically, COMMITTED - 1.)

Sunday, January 15, 2012

Ubuntu

Wonderful world of ubuntu!

Find files related to an application you've installed:
dpkg -L (example dpkg -L tomcat7-examples)
Find package you've installed :
apt-cache search tomcat7

For getting list of port being used by your server:
netstat -ntlp 

looking for 
apt-get search tomcat


For disabling firewall


# service iptables save
# service iptables stop
# chkconfig iptables off

http://www.cyberciti.biz/faq/disable-linux-firewall-under-centos-rhel

In order to change name of your host server in ubuntu:

1) edit /etc/hosts
192.162.23.116 youNewName

2) sudo hostname yourNewName

3) Unclear if it's really required:
/etc/hostname
==> yourNewName

Notice: this change will be overwritten after reboot ... Dont know how to make the change permanent.


Mount Windows folder 

    1. First, edit your /etc/hosts file and give the Windows machine a name you want to mount from: 192.168.1.2   pootie
    2. Next, install the samba and smbfs packages using your method of choice. (e.g. synaptic || Ubuntu software center) Create a directory where the share will appear on your local filesystem. $ sudo mkdir /mnt/music
    3. Edit /etc/fstab and add a line for the mount. Here "pootie" is the name of the machine and "music" is the name of the share.//pootie/music  /mnt/music  cifs exec,credentials=/etc/cifspw 0 0
    4. Create a password file /etc/cifspw with the login credentials for your Windows account. (if your windows account is going to change you'll need tp change that either):username=Jason
      password=ImNotGonnaTellYouThat
    5. And secure the file: $ sudo chmod 600 /etc/cifspw
    6. then excute the followed: $ sudo mount -a