2011年1月12日 星期三

CVS to SVN Crossover Guide, command comparison

CVS to SVN Crossover Guide

link from http://svn.apache.org/repos/asf/subversion/trunk/doc/user/cvs-crossover-guide.html

Purpose
This document provides an alternate method of learning Subversion. Many users dislike learning new technology via a theoretical "top down" approach, as provided by the Subversion Book. Instead, this document presents Subversion from the "bottom up": it shows a CVS command or task, and then shows the equivalent task in Subversion (along with relevant book links.) It's essentially a re-indexing of topics covered by the book, keyed on CVS tasks.

Table of Contents
Setup
Repository creation
Importing data
Installing a server
Authenticating to a server
Browsing a repository
Checking out a working copy
Basic Work Cycle
Seeing locally changed items
Seeing out-of-date items
Scheduling additions or deletions
Copying and moving
Undoing local changes
Updating and committing
Resolving conflicts
Adding a binary file
Using native line-endings
Examining history
Seeing history of an item
Comparing two versions of an item
Branching/Tagging/Merging
Creating a branch
Moving a working copy to a branch
Finding the beginning of a branch
Porting a single change
Merging a whole branch
Reverting a committed change
Resurrecting deleted items
Creating a tag
Tweaking a tag
Seeing all tags
Comparing two tags
Seeing logs between two tags
Other tasks
Using modules
Line endings and keywords
Repository creation
Create a new repository for holding versioned data.

CVS Subversion
Commands:
$ cvs -d /usr/local/repos init
Explanation:
Creates a new directory repos ready to hold RCS files and config scripts. Commands:
$ svnadmin create /usr/local/repos
Explanation:
Creates a new directory repos containing BerkeleyDB files and config scripts.

Book References:
Repository Creation and Configuration
Importing data
Populate a new repository with initial data. Assuming that you have a tree of code in the local directory myproj/, and you want to move this tree into the repository.

CVS Subversion
Commands:
$ cd myproj
$ cvs -d /usr/local/repos import myproj/ none start
Explanation:
This copies the contents of the current working directory to a new directory (myproj) in the CVS repository. The CVS repository now contains a directory /myproj/ at the top level. Commands:
$ svn mkdir file:///usr/local/repos/tags
$ svn mkdir file:///usr/local/repos/branches
$ svn import myproj/ file:///usr/local/repos/trunk
Explanation:
Though not strictly required, we deliberately create /tags and /branches top-level directories in the repository, to hold tags and branches later on. Then we import the contents of the local myproj/ directory into a newly created /trunk directory in the repository.

Book References:
Choosing a repository layout
svn import
Installing a server
Make the repository available to clients via a network.

CVS Subversion
Commands:
(too complex to demonstrate here)
Explanation:
Export the repository via the cvs pserver program. It can be launched by either inetd or a client's ssh remote request. Commands:
(too complex to demonstrate here)
Explanation:
Export the repository with the Apache 2.0.x server, or via the svnserve program. The latter can run as a standalone daemon, can be launched by inetd, or invoked by a client's ssh remote request.

Book References:
Server configuration
Authenticating to a server
Have a network client prove its identity to a version control server.

CVS Subversion
Commands:
$ cvs -d :pserver:user@host:/repos command…
Explanation:
When contacting a repository, the client pre-emptively "pushes" its authentication credentials at the server. Commands:
$ svn command URL…
Password for 'user': XXXXXXX
Explanation:
The client's authentication credentials are "pulled" from the user interactively, and only when the server deems that a challenge needs to be made. (And contrary to popular belief, the --username and --password options are merely values to be used if the server issues a challenge; they do not "push" the credentials at the server.)

Book References:
Network Model
Browsing a repository
Browse the repository as a filesystem, perusing file contents and history as well (older versions of files or trees.)

CVS Subversion
Commands:
(not possible with commandline client)
Explanation:
Not possible with commandline client. A third-party web server tool such as ViewCVS must be used. Commands:
$ svn list URL [-r rev] [-v]
$ svn cat URL [-r rev]
Explanation:
The svn list and svn cat commands allow interactive browsing of a repository (and all previous states of a repository) from the commandline. (The --verbose [-v] switch displays full listing information.) If Apache is being used as a Subversion server process (i.e. clients access via http://), then the latest version of the repository can be directly browsed by entering URL into any web browser. Additionally, a third-party web server tool (such as ViewCVS) can be used with Subversion.

Book References:
svn list
Checking out a working copy
Create a workspace on local disk which mirrors a directory in the repository.

CVS Subversion
Commands:
$ cvs -d /usr/local/repos checkout myproj
U myproj/foo.c
U myproj/bar.c

Explanation:
Creates a local directory myproj which is a mirror of the repository directory /myproj. Commands:
$ svn checkout file:///usr/local/repos/trunk myproj
A myproj/foo.c
A myproj/bar.c

Explanation:
Assuming that the original project data was imported into the repository /trunk directory, this creates a local directory myproj which is a mirror of the repository directory /trunk. Standard Subversion convention is to do "mainline" development in /trunk. See branching and tagging sections for more details.

Book References:
Initial Checkout
svn checkout
Seeing locally changed items
Discover which items in the working copy have local modifications or are scheduled for addition/deletion.

CVS Subversion
Commands:
$ cvs status

File: baz.c Status: Up-to-date

$ cvs update
M foo.c
U bar.c

Explanation:
The cvs status command shows whether a file is locally modified or out of date, including information about working revision and branch info. Unfortunately, because the output is so verbose and hard to read, many users run cvs update instead, which shows a more compact listing of modified files (and of course, it also causes the server to merge changes into your working copy.) Commands:
$ svn status
M foo.c

Explanation:
Shows modified files only. Very fast, as it does not use the network. Does not update your working copy, yet still shows a single-line display, much like svn update. To see working revision and branch information, run svn info.

Book References:
Examine Your Changes
svn status
Seeing out-of-date items
Discover which items in the working copy are out-of-date (i.e. newer versions exist in the repository.)

CVS Subversion
Commands:
$ cvs status

File: baz.c Status: Needs Patch

$ cvs -n update
M foo.c
U bar.c

Explanation:
The cvs status command shows whether a file is locally modified or out of date, including information about working revision and branch info. A less verbose option is to run cvs -n update instead, which shows a compact listing of both out-of-date and locally modified files, without actually updating the working copy. Commands:
$ svn status -u
M 46 foo.c
M * 46 bar.c
* 46 baz.c

Explanation:
Shows modified files (M) as well as out-of-date files (*). Contacts repository, but doesn't modify the working copy. To see working revision and branch information, run svn info.

Book References:
Examine Your Changes
svn status
Scheduling additions or deletions
Schedule a working-copy file or directory to be added or removed from the repository.

CVS Subversion
Commands:
$ touch foo.c
$ cvs add foo.c
cvs server: scheduling file `blah' for addition
cvs server: use 'cvs commit' to add this file permanently

$ mkdir new-dir
$ cvs add new-dir
Directory new-dir added to the repository

$ rm bar.c
$ cvs rm bar.c
cvs remove: scheduling `bar.c' for removal
cvs remove: use 'cvs commit' to remove this file permanently

$ rm -rf old-dir/*
$ cvs rm old-dir
cvs remove: Removing 3bits

Explanation:
Schedules a file or directory for addition or removal to/from the repository. The repository will not be changed until the user runs cvs commit, except for the case of adding a directory, which immediately changes the repository. Also, directories cannot be truly removed from the repository, just emptied out. (cvs update -P will prune empty directories from your working copy.) Commands:
$ touch foo.c
$ svn add foo.c
A foo.c

$ mkdir new-dir
$ svn add new-dir
A new-dir

$ svn rm bar.c
D bar.c

$ svn rm old-dir
D old-dir/file1
D old-dir/file2

Explanation:
Schedules a file or directory for addition or removal to/from the repository. The repository will not be changed until the user runs svn commit. The scheduled operations are shown as A or D by svn status, and svn revert can un-do the scheduling. Directories really can be deleted (though as with all deleted items, continues to exist in history.)

Book References:
Make Changes to Your Working Copy
svn add
svn delete
Copying and moving
Copy or move/rename a file or directory.

CVS Subversion
Commands:
(not possible.)
Explanation:
Not possible, unless an administrator directly mucks with RCS files in the repository. (And in that case, no history records the act of copying or renaming.) Commands:
$ svn copy foo.c foo2.c
A foo2.c

$ svn copy dir dir2
A dir2

$ svn move bar.c baz.c
A baz.c
D bar.c

$ svn move dirA dirB
A dirB
D dirA/file1
D dirA/file2

Explanation:
The svn copy command schedules a file or directory for addition to the repository, recording the "source" of the copy. After committing, svn log on the copied item will trace history back through the original copy-source. The svn move command is exactly equivalent to running svn copy, followed by an svn delete on the copy-source: the result is a new item scheduled for addition (with copy-history attached) and the original item scheduled for deletion.

Book References:
Make Changes to Your Working Copy
svn copy
svn move
Finding the beginning of a branch
If you're attempting to merge an entire branch into another, you need to compare the "root" and "tip" of the source branch, and then merge those differences into a working copy of the target branch. Obviously the "tip" of the branch can be represented by using the HEAD keyword. But how do you find the "birth" revision of the source branch?

The easiest solution is to run

$ svn log -v --stop-on-copy source-branch-URL


This command will display every change ever made to the branch, but --stop-on-copy option will cause the output to stop as soon as detects a copy operation in the branch's history. By definition, then, the very last log entry printed will show the copy being made. It will look something like:

r9189 | joe | 2004-03-22 10:10:47 -0600 (Mon, 22 Mar 2004) | 1 line
Changed paths:
A /branches/mybranch (from /trunk:9188)

In this case, you would then know to compare revisions 9189 and HEAD of the branch in order to perform the merge:

$ svn merge -r9189:HEAD source-branch-URL target-branch-WC


Seeing all of a project's tags
Assuming you've been following a consistent policy for creating tag-copies, then this is just a matter of running svn ls on a directory containing your tags. Typically you would run it on the /tags directory in your repository, although you're certainly free to organize this directory in a more complex way, or invent a different convention altogether.

As an example, you can see all of Subversion's tags by running:

$ svn ls --verbose http://svn.apache.org/repos/asf/subversion/tags

7739 kfogel Nov 13 22:05 0.33.0/
7796 josander Nov 18 12:15 0.33.1/
7932 josander Dec 03 17:54 0.34.0/
8045 josander Dec 19 15:13 0.35.0/
8063 josander Dec 20 11:20 0.35.1/
8282 josander Jan 13 14:15 0.36.0/
8512 josander Jan 24 17:31 0.37.0/
8810 kfogel Feb 23 03:44 1.0.0/


Seeing the differences between two tags
Just use svn diff in its fully expanded form, which compares any two URLs:

$ svn diff tagURL1 tagURL2


Seeing logs between two tags
This is a somewhat common practice in CVS, and is doable in Subversion, but requires a little bit more work. Assuming that you've made two tags of /trunk at different points in time, the ultimate goal here is to run

$ svn log -rX:Y trunkURL

…where X and Y are the revisions from which the two tags were copied. To discover X and Y, you can use the same technique described in the previous section ("finding the beginning of a branch".) Just use the --stop-on-copy option when logging the history of each tag. No commits happen on tag directories, so the following commands should each produce exactly one log entry:

$ svn log -v --stop-on-copy tag1-URL

r3520 | joe | 2004-03-12 15:28:43 -0600 (Fri, 12 Mar 2004) | 1 line


$ svn log -v --stop-on-copy tag2-URL
a
r4177 | joe | 2004-03-12 15:28:43 -0600 (Fri, 12 Mar 2004) | 1 line


So in this example, the values of X and Y are 3520 and 4177. Now you can view all /trunk changes between those two points in time:

$ svn log -r3520:4177 trunkURL


Fixing an incorrect tag
If your tag is a bit off, you can "adjust" it just as people often do in CVS. Simply check out a working copy of the tag directory, make any changes you wish, and commit.

Remember, because branches and tags are directories, they can also be deleted when they're no longer of any use to your project. They'll continue to exist in the repository's history.

Creating/using "modules"
Compare CVS Modules vs. svn:externals.

Linux Command - grep, egrep, fgrep

Use regular expression extension patten of grep to filter the text-string

--> Use "-E" to represent using the extended regular expression in the grep
# svn info ./* | grep -E "Last Changed Rev|Path"
or
--> Use twice "-e" to indicate the search pattern double times, means we search the two patterns in the source text string
# svn info ./* | grep -e "Last Changed Rev" -e "Path"
or
--> Directly use the egrep as the program to instead of the grep program
# svn info ./* | egrep "Last Changed Rev|Path"

various type from simplest to complicated one
fgrep -> grep -> egrep

2011年1月7日 星期五

Linux Command - chkconfig, service, boot service

If you want to have the NTP server start up automatically, you can use the checkconfig command as follows:

# chkconfig --level 345 ntpd on // In this example, we turn on runlevel 3,4,5 on
# chkconfig --level 0126 ntpd off // In this example, we turn off runlevel 0,1,2,6 off

# chkconfig --list | grep ntpd
ntpd 0:off 1:off 2:off 3:on 4:on 5:on 6:off

// Set vsftpd run on the boot time
# chkconfig vsftpd on
# chkconfig --list vsftpd // list which runlevel the vsftpd was turn on, here the runlevel 2,3,4,5 was turn on automatically
vsftpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off


// Do some experiments on the rc runlevels
# pwd
/etc/rc.d/rc3.d ==> Here we will show the runlevel 3 files

# chkconfig --list xinetd ==> list the xinetd runlevel on/off status
xinetd 0:off 1:off 2:off 3:on 4:on 5:on 6:off ==> run level 3 was "on"
# ls -la *xin* ==> show the file naming (it is always a linked file with different linked name). Here the name is S56xinetd. we find that the name was start with "S"
lrwxrwxrwx 1 root root 16 2009-11-30 16:11 S56xinetd -> ../init.d/xinetd

# chkconfig --list qemu
qemu 0:off 1:off 2:on 3:on 4:on 5:on 6:off
# ls -la *qemu*
lrwxrwxrwx 1 root root 14 2008-04-16 03:13 S35qemu -> ../init.d/qemu ==> The same as above one. The linked file was started with "S".

# chkconfig --list ypbind
ypbind 0:off 1:off 2:off 3:off 4:off 5:off 6:off
# ls -la *ypbin*
lrwxrwxrwx 1 root root 16 2008-04-16 03:31 K73ypbind -> ../init.d/ypbind ==> This time the ypbind was off. Here the linked file was started with "K".

# chkconfig --list psacct
psacct 0:off 1:off 2:off 3:off 4:off 5:off 6:off
# ls -la *psacct*
lrwxrwxrwx 1 root root 16 2008-04-16 03:13 K10psacct -> ../init.d/psacct ==> The same as above one, the config was off. The linked file was started with "K".


// Again, we set the qemu config as off (before was on), and then the linked file was started with "K" as we think.
# chkconfig qemu off
# chkconfig --list qemu
qemu 0:off 1:off 2:off 3:off 4:off 5:off 6:off
# ls -la *qemu*
lrwxrwxrwx 1 root root 14 2009-12-25 16:30 K98qemu -> ../init.d/qemu


Add a new service into chkconfig maintain list, this will add related symbolic link into /etc/rc.d/ folder
# chkconfig --add tscRC

# find ./* -name *tscRC* -print
./init.d/tscRC
./rc0.d/K92tscRC
./rc1.d/K92tscRC
./rc2.d/S08tscRC
./rc3.d/S08tscRC
./rc4.d/S08tscRC
./rc5.d/S08tscRC
./rc6.d/K92tscRC
# find ./* -name *tscRC* -exec file {} \;
./init.d/tscRC: Bourne shell script text executable
./rc0.d/K92tscRC: symbolic link to `../init.d/tscRC'
./rc1.d/K92tscRC: symbolic link to `../init.d/tscRC'
./rc2.d/S08tscRC: symbolic link to `../init.d/tscRC'
./rc3.d/S08tscRC: symbolic link to `../init.d/tscRC'
./rc4.d/S08tscRC: symbolic link to `../init.d/tscRC'
./rc5.d/S08tscRC: symbolic link to `../init.d/tscRC'
./rc6.d/K92tscRC: symbolic link to `../init.d/tscRC'


If you restart the network service, like following command
# service network restart

All the kernel profile about network settings will be reset to default. So you need to reconfigure those network setting of kernel. For example,

/sbin/sysctl -w net.ipv4.ip_forward=1

GUI service config command to set the boot service
text-mode
# ntsysv

X GUI system
# serviceconf

2011年1月3日 星期一

Check the Market Capitalization

Check the Market Capitalization from Yahoo! Finance

Apple Inc.
http://finance.yahoo.com/q?s=AAPL

Microsoft Inc.
http://finance.yahoo.com/q?s=msft