What is a branch?

Mark A. Flacy mflacy at verizon.net
Sat Feb 9 19:08:16 CST 2008


On 2008.02.09 04:33, Adrian Buehlmann wrote:
> On 09.02.2008 02:34, Stuart W. Marks wrote:
> >> BTW on the Branch wiki page, I didn't write that a clone is a  
> branch.
> >
> > Yes, I understand that. I was referring to other writings. For  
> example,
> > on the QuickStart page
> >
> > http://www.selenic.com/mercurial/wiki/index.cgi/QuickStart
> >
> > The "Branching and merging" example has the following line:
> >
> >     $ hg clone project project-work    # create a new branch
> >
> > This is clearly using the "clone is a branch" definition.
> 
> I agree that a repo clone is not a branch (looking at the state of the  
> repo
> clone directly after having cloned it). I may take a stab at tweaking  
> QuickStart
> after I hit the send button...
> 
> A clone is a potential branch.

*Any* repository is a potential branch of something unless nobody ever  
clones from it.

> If you just clone and repeatedly pull to update
> the "clone", it can remain a clone (a copy) for ever. Or a replica. Or  
> should we
> say a "repository clone" in that case?
> 
> A "repository clone" might not be the same as a repository that once  
> was cloned
> from another repo in the past. As such, the "cloned" repository looses  
> its
> status as a true clone as soon as you commit two *different*  
> changesets to each
> of them.

It's no long a "true clone" the instant one or the other repository has  
at least one changeset that isn't in the other.  It may be trivial to  
regain "true clone" status via a push or pull, but that does not appear  
to be relevant to me.

It appears to me that a "branch" is a named set of changesets.  That  
named set of changesets can exist in a special repository (where the  
repository is the name) or as a "named branch" in a repository that  
contains other "named branches".

The set of instructions required to work on the "set of changesets in a  
special repository" are different than the set of instructions required  
to work on a "set of changesets in a named branch in a repository  
containing other named branches".  I would submit that Mercurial  
currently makes it rather simple to work on a "set of changesets in a  
special repository" and much less simple to work with the "set of  
changesets in a named branch in a repository containing other named  
branches."

Perhaps it would be more useful to mention those cases where  
manipulating a "set of changesets in a named branch in a repository  
containing other named branches" is superior to manipulating a "set of  
changesets in a special repository."  I cannot think of any, but there  
are others in the list who should be able to do so.
-- 
Mark A. Flacy



More information about the Mercurial mailing list