Cheaper branching under consideration?
magnus at therning.org
Sat Aug 27 07:33:55 BST 2005
On Tue, Aug 23, 2005 at 09:31:00AM +0100, Magnus Therning wrote:
>On Tue, Aug 23, 2005 at 09:51:07AM +0200, Jan Hudec wrote:
>>On Mon, Aug 22, 2005 at 23:00:09 +0100, Magnus Therning wrote:
>>> This might very well have been discussed already. Just thought I'd ask
>>> Is cheaper branching, regarding space, being considered?
>>Did you notice te threads mentioning centralized storage (plans)? There have
>>been at least two in last two days. In short, it should be possible to have
>>one common storage for several branches, so it would store all common
>>revisions just once. Would that fullfil your needs?
>It sure sounds like it would. I'll have to read through the thread.
>Thanks for the pointer.
Yes it will fulfill my needs.
However, until it's implemented I've cooked together a small plugin that
does a "shallow branch", a branch with only the last revision. Bzr seems
to work just fine, even though the revno is decreased to 1.
My idea was to use it to make micro-branching cheaper. (Also I wanted to
play with bzr :-)
*** added file '.bzrignore'
@@ -0,0 +1,1 @@
*** added file '__init__.py'
@@ -0,0 +1,9 @@
+_commands = [shallow_branch.cmd_shallow_branch]
+if hasattr(bzrlib.commands, 'register_command'):
+ for cmd in _commands:
*** added file 'shallow_branch.py'
@@ -0,0 +1,47 @@
+from bzrlib.commands import Command
+ '''Make a shallow branch.
+ A shallow branch is a branch without any history.
+ If TO_LOCATION is omitted, the last component of FROM_LOCATION will be
+ used. In other words, "shallow-branch ../foo/bar" will attempt to create
+ To retrieve a shallow branch of a particular revision, supply the
+ --revision parameter, as in "shallow-branch foo/bar --revision 5".
+ takes_args = ['from_location', 'to_location?']
+ takes_options = ['revision']
+ def run(self, from_location, to_location=None, revision=[-1]):
+ import os
+ from bzrlib.branch import Branch
+ from bzrlib.merge import merge
+ if to_location == None:
+ to_location = os.path.basename(from_location.rstrip("/\\"))
+ except OSError, e:
+ if e.errno == errno.EEXIST:
+ raise BzrCommandError('Target directory "%s" already'
+ ' exists.' % to_location)
+ elif e.errno == errno.ENOENT:
+ raise BzrCommandError('Parent of "%s" does not exist.'
+ % to_location)
+ br_to = Branch(to_location, init=True)
+ br_from = Branch(from_location)
+ revno, rev_id = br_from.get_revision_info(revision)
+ br_to.install_revisions(br_from, [rev_id], None)
+ merge((to_location, -1), (to_location, None),
+ this_dir=to_location, check_clean=False)
Magnus Therning (OpenPGP: 0xAB4DFBA4)
magnus at therning.org
Software is not manufactured, it is something you write and publish.
Keep Europe free from software patents, we do not want censorship
by patent law on written works.
I should be able to whisper something in your ear, even if your ear is
1000 miles away, and the government disagrees with that. GQ [magazine
in England] quoted me on that -- they changed one letter. It said I
should be able to whisper something in your *car*, even though I am
1000 miles away. I wonder what the people in England think of me.
-- Philip Zimmermann
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20050827/2d120db0/attachment.pgp
More information about the bazaar