centralized workflow and tracking upstream questions
Neil Martinsen-Burrell
nmb at wartburg.edu
Thu Apr 3 21:52:48 BST 2008
Tom Vaughan <tom <at> software6.net> writes:
> P.S. I understand that I could just start with the vendor branch, copy
> in each release, "add" and "rm" as needed, "ci", and "tag." But that
> means a person is responsible for incorporating each vendor release
> into the vendor branch. I really want some automated way to do this so
> a person doesn't have to figure out what's been added or removed in
> each release.
``bzr add .`` will add all new files by default. Removed files are the problem,
since unzipping an archive that lacks a file will not delete it, unless you do
the following:
$ cd vendor
$ rm -r *
$ unzip ../vendor-drop.zip
$ bzr add
$ bzr ci -m 'updated to new vendor version'
$ bzr tag vendor-3.1415
which works because bzr assumes that files deleted by the OS are intended to be
removed.
This is what I would do to track a vendor branch updated by zip files:
nmb at guttle[~/tmp]$ bzr init --create-prefix site/vendor
nmb at guttle[~/tmp]$ cd site/
nmb at guttle[~/tmp/site]$ cd vendor
# unzip instead here
nmb at guttle[~/tmp/site/vendor]$ echo "first" > 1
nmb at guttle[~/tmp/site/vendor]$ bzr add .
added 1
nmb at guttle[~/tmp/site/vendor]$ bzr ci -m 'first vendor version'
Committing to: /Users/nmb/tmp/site/vendor/
added 1
Committed revision 1.
nmb at guttle[~/tmp/site/vendor]$ bzr tag template-1
Created tag template-1.
nmb at guttle[~/tmp/site/vendor]$ cd ..
nmb at guttle[~/tmp/site]$ bzr branch vendor mysite
Branched 1 revision(s).
nmb at guttle[~/tmp/site]$ cd mysite
nmb at guttle[~/tmp/site/mysite]$ echo " and best" >> 1
nmb at guttle[~/tmp/site/mysite]$ bzr ci -m 'Im best'
Committing to: /Users/nmb/tmp/site/mysite/
modified 1
Committed revision 2.
nmb at guttle[~/tmp/site/mysite]$ cd ../vendor
#replace with unzipping
nmb at guttle[~/tmp/site/vendor]$ echo "added new file" > 2
nmb at guttle[~/tmp/site/vendor]$ bzr add
added 2
nmb at guttle[~/tmp/site/vendor]$ bzr ci -m 'new vendor work'
Committing to: /Users/nmb/tmp/site/vendor/
added 2
Committed revision 2.
nmb at guttle[~/tmp/site/vendor]$ bzr tag template-2
Created tag template-2.
nmb at guttle[~/tmp/site/vendor]$ cd ../mysite
nmb at guttle[~/tmp/site/mysite]$ bzr merge ../vendor
+N 2
All changes applied successfully.
# test things here
nmb at guttle[~/tmp/site/mysite]$ bzr st
added:
2
pending merges:
Neil Martinsen-Bu... 2008-04-03 new vendor work
nmb at guttle[~/tmp/site/mysite]$ bzr ci -m 'updated vendor changes'
Committing to: /Users/nmb/tmp/site/mysite/
added 2
Committed revision 3.
nmb at guttle[~/tmp/site/mysite]$ cd ../vendor
nmb at guttle[~/tmp/site/vendor]$ rm 2 # replace this with unzipping
nmb at guttle[~/tmp/site/vendor]$ bzr st
removed:
2
nmb at guttle[~/tmp/site/vendor]$ bzr ci -m 'that file is for suckers'
bCommitting to: /Users/nmb/tmp/site/vendor/
missing 2
deleted 2
zCommitted revision 3.
nmb at guttle[~/tmp/site/vendor]$ bzr tag template-3
Created tag template-3.
nmb at guttle[~/tmp/site/vendor]$ cd ../mysite
nmb at guttle[~/tmp/site/mysite]$ bzr merge ../vendor
-D 2
All changes applied successfully.
# test things here
nmb at guttle[~/tmp/site/mysite]$ bzr ci -m 'updated again'
Committing to: /Users/nmb/tmp/site/mysite/
deleted 2
Committed revision 4.
nmb at guttle[~/tmp/site/mysite]$
To do this with a centralized repository, you should be able to just create
site/vendor and site/mysite as (lightweight-) checkouts of some remote branch.
Then, each commit will propagate to the bound remote branch when it is locally
committed.
I think that using tags as implemented in bzr (as labels for a specific
revision) is a better way to do things than making many separate branches in a
tags subdirectory as one would in subversion. (A separate branch is required if
you want to make mixed-revision tags as is possible in Subversion.)
Real merging is exactly what bzr excels at, so I think that you should keep a
vendor branch as a single, real branch and your personal site as a separate
branch and merge between them at will.
-Neil
More information about the bazaar
mailing list