D5594: copies: consider nullrev a common ancestor

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Thu Jan 24 18:56:49 EST 2019


martinvonz added a comment.


  In https://phab.mercurial-scm.org/D5594#83078, @yuja wrote:
  
  > >   I've seen many bugs in the git codebase that were caused by it not
  > >   having a null revision and being forced to treat root commits
  > >   differently. Mercurial has a null revision and I think it's generally
  > >   a bug to treat it differently from other commits in graph algorithms.
  >
  > I agree with that, but I don't think every non-merge revision (p2 = null)
  >  should be considered a direct child of null revision.
  >
  > > @@ -65,8 +63,6 @@
  > > 
  > >   else:
  > >       parents = cl.parentrevs(r)
  >
  > Here `parents[1]` may be `nullrev`. Is that expected?
  
  
  Oh, good catch! I'll fix that.
  
  It seems like a more natural API to have parents() methods return only valid parents, but I suppose that may just be too large a change to make.
  
  > 
  > 
  >>   for p in parents:
  >> 
  >> - if p < 0:
  >> - continue

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5594

To: martinvonz, #hg-reviewers
Cc: lothiraldan, yuja, mercurial-devel


More information about the Mercurial-devel mailing list