Categories: Contributing | Development | MySQLUniversity

How to Use BitKeeper


Contents


← Back to MySQL University main page

[edit] How to Use BitKeeper

[edit] Presentation

[edit] basic concepts

[edit] our setup

[edit] workflow

[edit] bk commands overview

% bk -R log -r+ -h -d':P:::I:' ChangeSet
serg:1.2598
bk rset -r+ -ah | bk gnupatch -h -dup -T

[edit] FAQ, bk tips and tricks

[edit] bk tuning

[serg:]checkout:get
checkout:edit
% cat ~/bin/_grepw
#!/bin/sh
bk grep -Hn "\<$1\>"
% cat ~/bin/bk-e
#!/bin/sh
# was bk_manual_resolve by Monty
file=/tmp/resolve.$$
diff -u $BK_GCA $BK_REMOTE > $file
cp $BK_LOCAL $BK_MERGE
patch $BK_MERGE $file
if test -f ${BK_MERGE}.rej
then
  echo Patch failed. You need to do this manually.
  gvim -o -f $BK_MERGE ${BK_MERGE}.rej
fi
rm $file
% cat ~/bin/bk-eb
#!/bin/sh
file=/tmp/resolve.$$
diff -ub $BK_GCA $BK_REMOTE > $file
cp $BK_LOCAL $BK_MERGE
patch -l $BK_MERGE $file
if test -f ${BK_MERGE}.rej
then
  echo Patch failed. You need to do this manually.
  gvim -o -f $BK_MERGE ${BK_MERGE}.rej
fi
rm $file
% cat ~/bin/bk-dl
#!/bin/sh
diff -up $BK_GCA $BK_LOCAL
% cat ~/bin/bk-dlm
#!/bin/sh
diff -up $BK_LOCAL $BK_MERGE
% cat ~/bin/bk-dr
#!/bin/sh
diff -up $BK_GCA $BK_REMOTE
% cat ~/bin/bk-drm
#!/bin/sh
diff -up $BK_REMOTE $BK_MERGE
if {[winfo screenwidth .] <= 1024} {
     # These show up better on LCD displays.
     set gc(oldColor) lightseagreen
     set gc(newColor) gray
     set gc(fm3.handColor) yellow
}
proc csettool_mod {} {
  proc nextCset {} {
    global  fileCount lastFile Files
    set line $Files($lastFile)
    if {$lastFile == $fileCount} { return }
    while {$lastFile < $fileCount} {
            incr lastFile
            incr line
            if {$Files($lastFile) > $line} { break }
    }
    dotFile
  }

  proc prevCset {} {
    global  fileCount lastFile Files
    set line $Files($lastFile)
    if {$lastFile == 1} { return }
    while {$lastFile > 1} {
            incr lastFile -1
            incr line -1
            if {$Files($lastFile) < $line} { break }
    }
    dotFile
  }

  bind all <Alt-n>                nextCset
  bind all <Alt-p>                prevCset

  pack .menu.nextCset -after .menu.help -side left -fill y
  pack .menu.prevCset -after .menu.help -side left -fill y
}

switch [file tail $::argv0] {
  csettool {
    after 2000 csettool_mod
  }
  difftool {
    while {$::argc >= 0} {
      set a [lindex $::argv 0]
      if {[regexp -- {^-[-A-Za-qs-z].*} $a]} {
        set ::sdiffw [concat $::sdiffw $a]
        incr ::argc -1
        set ::argv [lreplace $::argv 0 0]
      } else {
        break
      }
    }
  }
}

[edit] vim tricks

let bkroot=system('echo -n `bk root`')
let &tags=bkroot . "/tags"
let &path=".," . bkroot . "/include,/usr/include,,"

menu 90.400 B&K.&Edit            :!bk edit %<CR><CR><CR>:e!<CR>
menu 90.500 B&K.&Unedit          :!bk unedit %<CR><CR><CR>:e!<CR>
menu 90.600 B&K.&Difftool        :!sh -c 'bk difftool -b % >/dev/null 2>/dev/null' &<CR><CR>
menu 90.700 B&K.&Revtool         :!sh -c 'bk revtool % >/dev/null 2>/dev/null'&<CR><CR>

[edit] Questions

[edit] Questions asked during the session

  1. bk collapse - in order to have multiple changesets to collapse, you have to have pushed several changesets already, right? If you haven't pushed any changesets then the next changeset you push is already a collapsed set of your changes, right?
    • No. If you haven't pushed any changesets, you push a set of changesets. If you want a set of changesets to be pushed as one changeset, you collapse them.
  2. so pushing is not how to create changesets?
    • No. You can create any number of changesets locally. push is how you exchange changesets.
  3. about repogca: You said it leaves unmerged changesets - but I feel you can still merge them up and so avoid them, at the cost of having empty merge changesets in the tree. Any negative side of that ?
    • [listen to voice stream for example]
  4. If I pull the main tree from 5.1 will I also get all changesets back to 4.0? or will the history of 5.1 start only at the point it was cloned from 5.0 ?
    • If you pull from 5.1, you get the history all the way back to 3.23, the original repository.
  5. Why not create a "clean" clone as we branch new versions? (with no history before the clone ?)
    • A repository w/o history is not very useful. Also, you cannot pull changesets from earlier releases (e.g., cannot pull 5.0 changes into 5.1)
  6. Is there an alternative to "repogca" to avoid unmerged changesets ?
    • Not that I know of.
  7. is it better to try to merge locally before pushing a changeset or to push and merge into the destination tree?
    • You cannot merge remotely.

[edit] Voice recording and other links

Retrieved from "http://forge.mysql.com/wiki/How_to_Use_BitKeeper"

This page has been accessed 5,387 times. This page was last modified 09:27, 24 February 2008.

Find

Browse
MySQLForge
Main Page
Current events
Recent changes
Random page
Help
Edit
Edit this page
Editing help
This page
Discuss this page
Post a comment
Printable version
Context
Page history
What links here
Related changes
My pages
Special pages
New pages
File list
Statistics
Bug reports
More...