default nickname

David I. Lehn dlehn at vt.edu
Tue Dec 20 22:06:41 GMT 2005


* John Arbash Meinel <john at arbash-meinel.com> [2005-12-19T20:26:09-0500]:
> David I. Lehn wrote:
> > What are nicks for anyway?
> 
> They are a small way to get names back into branches. Without nicks, you
> have no branch naming committed as revision information. So if I do:
...
> At this point, you have a revision in bzr.dev (as a merge), but you
> don't know that it was actually created as part of 'feature-foo'. That
> is what nicks are for.
> 

Got it.  I figured as much.


> The reason we use directory names, is that if you couple email address
> and directory name, you are very close to having a unique identifier for
> the branch. So if you look at an annotation of a file, you can see that
> this line was added in the feature-foo branch, and this other one was in
> feature-baz. And these were in John Meinel's integration branch, and
> those were in Robert's integration branch.
> 
> I believe other scms (monotone) support explicitly naming the branch. We
> are just allowing an implicit name by using the current directory if no
> name has been set.
> 

./bzr log | grep "branch nick:" | sed -e 's/^ *//' | sort | uniq

"nickname" sounds like it is a shorthand convienience.  The nicknames
currently used are mostly nicknameish.  However, strings like "bzr.dev
(Main development branch)" seem more verbose.  Maybe it would be better
to just call this idea a branch "comment" and encourage short yet
descriptive contents.  It would make a nice parallel to revision
messages.


> Does "bzr nick ''" set an empty nickname?
>

Almost.  Actually it exposes a bug in the command parser:

bzr: ERROR: exceptions.IndexError: string index out of range
  at .../bzr.dev/bzrlib/commands.py line 312
  in parse_args

This should maybe be fixed by:
-        if a[0] == '-':
+        if len(a) > 0 and a[0] == '-':

But then the branch nick shows up as an empty line via "bzr nick", shows
up incorrectly as "None" in "bzr log", is a empty tag in the xml, and
commands like testament puke:

bzr: ERROR: exceptions.AttributeError: 'NoneType' object has no attribute 'splitlines'
  at .../bzr.dev/bzrlib/testament.py line 183
  in _revprops_to_lines

That's failing because the revprops.items() is returning a None value.
I'm not sure where it went from '' to None.  There should probably at
least be an "assert value is not None" in there.


> Well, we could certainly just have a way to set a default naming scheme.
> One of which could be None.
> 
> Whether this is settable by a configuration option, or a plugin, I don't
> really care, but I would like it to be configurable.
> 

This sounds like behavior that would work great if ther were user hooks.
Such as a branch post hook that would set the nick property based on the
current dir in whatever way you want.  That's of course a non trivial
addition.


> Does that help you understand? Do you completely disagree with the
> philosophy?
> 

Sure, names or comments for branches sound like a fine idea.  I'm just
not convinced of defaulting that property to the dir name.

A failure of the dir name default may be when tree configs and nested
trees are more common.  In that case you may have a number of top level
trees with nice dir names but the nested trees within will have names
forced on them, such as "common".  You'd have to remember to go in and
change those every time to something specific.  Or come up with some
crazy inherited name scheme.

In any case, I'm at least one datapoint that wants options for this.  ;)

-dave




More information about the bazaar mailing list