Monday, 3 August 2009

HOWTO: Version control using BZR vs RCS

No matter programming or documents editing, BZR will work for you to provide easier and better version control.

Here are some simple steps for docs processing:
======================

  1. bzr init
    create a folder, 'text', then create a file, 'test1.txt', in which we type in a paragraph. Then 'bzr init' to let bzr know this is the folder where bzr should monitor.
  2. bzr add
    'bzr add test1.txt'. Now bzr knows where and what to monitor.
  3. bzr diff
    add more text into the test1.txt, then run 'bzr diff' to test whether there is any changes.
  4. bzr commit -m 'description'
    if there are some changes, and you want to create another version for that for the current version backup. run 'bzr commint -m "some description"'.
  5. bzr log
    to check verisons.
    ...
    more changes and more commits here.
    ...
  6. bzr branch -r
    For example we just want to retrive the first version, run 'bzr branch `pwd` -r 1'. A new folder with the name of current folder 'text' will be created, in which our text1.txt 1st version is there.
RCS: (same procedure)
===================
  1. create folder RCS
    this step can be ignored, the rcs information will be saved in the same folder with the file you are editing. Otherwise, the file info file will be saved in the RCS folder.
  2. ci -u test1.txt
    ver 1.1 is created. RCS uses the concept of 'lock'. -l -r -u are similar, to keep the text file locked when new version is registered.
  3. co -l test1.txt
    (if without this step, new version can not be registered. because 'no lock', prompted by 'ci', is this for synchronization?) So to lock the text file to make it writable (very weird concept, locked == writable???). Then add more text in it.
  4. rcsdiff test1.txt
    To check what's different from the registered version.
  5. ci -u test1.txt (same with step2)
    The version number increment with 0.1.'ci -r2 -u test1.txt' to make the version increment by 1.0.
    ...
    more changes and more commits here.
    ...
  6. co -l1.1 test1.txt
    Retrive version 1.1 to replace the current editing file. -l -r -u are similar, just -u makes the file non-writeable, while -l make the file writeable. Good practice is 'ci -u' and 'co -l', so that when the new version is registered by ci, the file will become 'non-writable'='can not modify'='No lock'. (weired)
Note: no space between '-r2' and '-u1.1'.

Conclusion:
==================
BZR is more user friendly, and Ubuntu uses it on launchpad.net.
RCS is quite mature (old), LYX uses it as version control. So even I don't like it, but I have to still use it, because I love Lyx.

No comments:

My photo
London, United Kingdom
twitter.com/zhengxin

Facebook & Twitter