HowtoForge

Using The Bazaar Version Control System (VCS) On Debian Etch - Page 2

Now let's publish the project to our server (using SFTP):

bzr push --create-prefix sftp://falko@192.168.0.101/~/public_html/myproject

falko@server1:~/myproject$ bzr push --create-prefix sftp://falko@192.168.0.101/~/public_html/myproject
The authenticity of host '192.168.0.101 (192.168.0.101)' can't be established.
RSA key fingerprint is 68:fc:30:ab:b1:e0:8d:6b:46:0b:08:cf:a6:34:b3:a1.
Are you sure you want to continue connecting (yes/no)?
<-- yes
Warning: Permanently added '192.168.0.101' (RSA) to the list of known hosts.
falko@192.168.0.101's password:
<-- enter the user's password
2 revision(s) pushed.
falko@server1:~/myproject$

After you have published the project, you can delete your working copy (if you want - you can as well leave it as it is):

cd ~
rm -fr myproject/

Now anyone can download a copy of your branch. To test this, we create the directory test/ and download a copy of the branch to it:

cd ~
mkdir test/
cd test/
bzr branch http://192.168.0.101/myproject
falko@server1:~/test$ bzr branch http://192.168.0.101/myproject
Branched 2 revision(s).
falko@server1:~/test$

While you're working on your copy, it's possible that other people commit their changes to the server. To merge these changes into your working copy, run

cd myproject/
bzr merge

In my case no changes have to be merged:

falko@server1:~/test/myproject$ bzr merge
Merging from remembered location http://192.168.0.101/myproject/
Nothing to do.
falko@server1:~/test/myproject$

To check what exactly has changed, run

bzr diff

Now you can change your working copy, e.g.:

vi test1.txt
some text...
bla

Take a look at the changes:

bzr diff
falko@server1:~/test/myproject$ bzr diff
=== modified file 'test1.txt'
--- test1.txt   2007-12-19 15:22:52 +0000
+++ test1.txt   2007-12-19 15:41:37 +0000
@@ -1,1 +1,2 @@
 some text...
+bla

falko@server1:~/test/myproject$

When you're finished, commit your changes:

bzr commit -m "Some changes"
falko@server1:~/test/myproject$ bzr commit -m "Some changes"
modified test1.txt
Committed revision 3.
falko@server1:~/test/myproject$

Afterwards, upload the changes to the server:

bzr push --create-prefix sftp://falko@192.168.0.101/~/public_html/myproject

Afterwards, you can (if you like) delete your working copy again.

To find out what else you can do with Bazaar, take a look at

bzr help
falko@server1:~/test/myproject$ bzr help
Bazaar -- a free distributed version-control tool
http://bazaar-vcs.org/

Basic commands:

  bzr init           makes this directory a versioned branch
  bzr branch         make a copy of another branch

  bzr add            make files or directories versioned
  bzr ignore         ignore a file or pattern
  bzr mv             move or rename a versioned file

  bzr status         summarize changes in working copy
  bzr diff           show detailed diffs

  bzr merge          pull in changes from another branch
  bzr commit         save some or all changes

  bzr log            show history of changes
  bzr check          validate storage

  bzr help init      more help on e.g. init command
  bzr help commands  list all commands
falko@server1:~/test/myproject$

and

bzr help commands
falko@server1:~/test/myproject$ bzr help commands
bzr add [FILE...]
        Add specified files or directories.
bzr annotate FILENAME
        Show the origin of each line in a file.
bzr bind LOCATION
        Bind the current branch to a master branch.
bzr branch FROM_LOCATION [TO_LOCATION]
        Create a new copy of a branch.
bzr break-lock [LOCATION]
        Break a dead lock on a repository, branch or working directory.
bzr bundle-revisions [BASE]
        Generate a revision bundle.
bzr cat FILENAME
        Write a file's text from a previous revision.
bzr check [BRANCH]
        Validate consistency of branch history.
bzr checkout [BRANCH_LOCATION] [TO_LOCATION]
        Create a new checkout of an existing branch.
bzr commit [SELECTED...]
        Commit changes into a new revision.
bzr conflicts
        List files with conflicts.
bzr deleted
        List files deleted in the working tree.
bzr diff [FILE...]
        Show differences in the working tree or between revisions.
bzr export DEST
        Export past revision to destination directory.
bzr help [TOPIC]
        Show help on a command or other topic.
bzr ignore [NAME_PATTERN]
        Ignore a command or pattern.
bzr ignored
        List ignored files and the patterns that matched them.
bzr info [LOCATION]
        Show information about a working tree, branch or repository.
bzr init [LOCATION]
        Make a directory into a versioned branch.
bzr init-repository LOCATION
        Create a shared repository to hold branches.
bzr inventory [FILE...]
        Show inventory of the current working copy or a revision.
bzr log [LOCATION]
        Show log of a branch, file, or directory.
bzr merge [BRANCH]
        Perform a three-way merge.
bzr missing [OTHER_BRANCH]
        Show unmerged/unpulled revisions between two branches.
bzr mkdir DIR...
        Create a new versioned directory.
bzr mv [NAMES...]
        Move or rename a file.
bzr nick [NICKNAME]
        Print or set the branch nickname.
bzr pull [LOCATION]
        Turn this branch into a mirror of another branch.
bzr push [LOCATION]
        Update a mirror of this branch.
bzr reconcile [BRANCH]
        Reconcile bzr metadata in a branch.
bzr register-branch BRANCH_URL
        (From plugin "launchpad")
        Register a branch with launchpad.net.
bzr remerge [FILE...]
        Redo a merge.
bzr remove [FILE...]
        Make a file unversioned.
bzr renames [DIR]
        Show list of renamed files.
bzr resolve [FILE...]
        Mark a conflict as resolved.
bzr revert [FILE...]
        Revert files to a previous revision.
bzr revno [LOCATION]
        Show current revision number.
bzr root [FILENAME]
        Show the tree root directory.
bzr serve
        Run the bzr server.
bzr sign-my-commits [LOCATION] [COMMITTER]
        Sign all commits by a given committer.
bzr status [FILE...]
        Display status summary.
bzr testament [BRANCH]
        Show testament (signing-form) of a revision.
bzr unbind
        Unbind the current branch from its master branch.
bzr uncommit [LOCATION]
        Remove the last committed revision.
bzr unknowns
        List unknown files.
bzr update [DIR]
        Update a tree to have the latest code committed to its branch.
bzr upgrade [URL]
        Upgrade branch storage to current format.
bzr version
        Show version of bzr.
bzr version-info [LOCATION]
        Generate version information about this tree.
bzr whoami [NAME]
        Show or set bzr user id.
falko@server1:~/test/myproject$

The Bazaar User Guide is available here: http://doc.bazaar-vcs.org/bzr.dev/en/user-guide/index.html

 

Using The Bazaar Version Control System (VCS) On Debian Etch - Page 2