git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Fix branch ancestry calculation

From
Keith Packard <keithp@keithp.com>
Date
Mar 24, 2006, 16:38 UTC
Message-ID
<1143218338.6850.68.camel@neko.keithp.com>
In-Reply-To
<Pine.LNX.4.64.0603240739360.26286@g5.osdl.org>
On Fri, 2006-03-24 at 07:46 -0800, Linus Torvalds wrote:
Show 12 quoted lines
> 
> On Fri, 24 Mar 2006, David Mansfield wrote:
> > 
> > Anyway, I'd like to nail down some of the other nagging ancestry/branch point
> > problems if possible.
> 
> What I considered doing was to just ignore the branch ancestry that cvsps 
> gives us, and instead use whatever branch that is closest (ie generates 
> the minimal diff). That's really wrong too (the data just _has_ to be in 
> CVS somehow), but I just don't know how CVS handles branches, and it's how 
> we'd have to do merges if we were to ever support them (since afaik, the 
> merge-back information simply doesn't exists in CVS).

cvsps is more of a problem than cvs itself. Per-file branch information is readily available in the ,v files; each version has a list of branches from that version, and there are even tags marking the names of them. One issue that I've discovered is when files have differing branch structure in the same repository. That happens when a branch is created while files are checked out on different branches. I'm not quite sure what to do in this case; I've been trying several approaches and none seem optimal. One remaining plan is to just attach such branches by date, but that assumes that the first commit along a branch occurs shortly after the branch is created (which isn't required).

Of course, this branch information is only created when a change is made to the file along said branch, so most of the repository will lack precise branch information for each branch. When you create a child branch, the files with no commits in the parent branch will never get branch information, so the child branch will be numbered as if it were a branch off of the grandparent. Globally, it is possible to reconstruct the entire branch structure.

Show 5 quoted lines
> Suddenly it was a perfectly reasonable system: the fact that you can only 
> merge once (between working tree and repo) is perfectly reasonable when 
> there is only one branch and checking in requires you to have updated 
> first. All the things I really hated about CVS just go away if you don't 
> do any branches at all.

If you look at how deltas are stored in the file you get an even stronger argument -- CVS has always advertised that it stores deltas 'backwards' so that the current version is first in the file. That's true for the trunk, but for every other branch, you have to seek back from the tip of the trunk to the branch point and then walk forwards to the desired version along the branch.

-- 
keith.packard@intel.com
Previous: Linus TorvaldsNext: Chris Shoemaker
Message 9 of 11 in “Fix branch ancestry calculation”
  1. Linus TorvaldsMar 23, 2006
  2. [RFC] Make dot-counting ignore ".1" at the endLinus Torvalds, Mar 23, 2006
  3. Keith PackardMar 23, 2006
  4. Linus TorvaldsMar 23, 2006
  5. Keith PackardMar 23, 2006
  6. David MansfieldMar 24, 2006
  7. David MansfieldMar 24, 2006
  8. Linus TorvaldsMar 24, 2006
  9. Keith PackardMar 24, 2006
  10. Chris ShoemakerMar 25, 2006
  11. Keith PackardMar 25, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.