swhitaker created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Using wdir() in a dag range revset can crash Mercurial. For example:
  
    hg status --rev '.^::wdir()
  
  revlog.c reports an IndexError in this instance, but it isn't caught
  by the calling code. This change adds IndexError to the set of exception
  types the calling code catches. When an IndexError is caught, the code
  falls back to calling the pure Python implementation of reachableroots,
  which fails gracefully.

TEST PLAN
  $ hg status --rev '.::wdir()'
  abort: working directory revision cannot be specified

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/dagop.py

CHANGE DETAILS

diff --git a/mercurial/dagop.py b/mercurial/dagop.py
--- a/mercurial/dagop.py
+++ b/mercurial/dagop.py
@@ -230,7 +230,7 @@
     heads = list(heads)
     try:
         revs = repo.changelog.reachableroots(minroot, heads, roots, 
includepath)
-    except AttributeError:
+    except (AttributeError, IndexError):
         revs = _reachablerootspure(repo, minroot, roots, heads, includepath)
     revs = baseset(revs)
     revs.sort()



To: swhitaker, #hg-reviewers
Cc: mercurial-devel
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to