How to apply (export/import) a patch in BitKeeper

Posted on December 4th, 2009 by David Luhman and tagged .

Let's say you need to backport a fix from one BitKeeper repository to another. Here's one way to do it. I suppose there are other or better ways to apply a patch, especially if you have a lot of changesets to backport. But if you're limited to a few changesetd, this seems to work for me.

The following documentation is useful :
http://www.bitkeeper.com/Documentation.FAQS.Linux.html

1. Create personal clone of target repository :

 
$ pwd
/usr/me 
$ mkdir target
$ cd target
$ bk clone /share/source/code code

2. Identify and create patch from source repository

 
$ cd /source/code
$ bk changes -uyour_user_name

ChangeSet@1.6813.1.10, 2009-10-23 16:53:29-07:00, me@localhost +3 -0
  Fix the foobar.
...
(My change set is 1.6813.1.10)

3. Export (create) patch from source repo and then import into your target repo :


$ mkdir /tmp/dkl

$ bk export -tpatch -r1.6813.1.10 > /tmp/dkl/bk.patch  (export from source repo)

$ less /tmp/dkl/bk.patch   (examine diff file)

$ cd /usr/me/target/code

$ bk import -tpatch /tmp/dkl/bk.patch .
Patching...
Patching file foo.php
Patching file bar.php
Checking for potential renames in /usr/me/target/code ...
Checking in new or modified files in /usr/me/target/code ...
Creating changeset for bk-ssd.patch in /usr/me/target/code ...
ChangeSet revision 1.6751: +3 -0 = 12471
Done.

$ bk revtool (to see how patch applied - select your new changeset (1.6751) and hit "View Changeset" in revtool to see diffs)

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options