[PATCH 2 of 2] revset: make wdir() work with ancestorspec '~' operator
Pulkit Goyal
7895pulkit at gmail.com
Thu Feb 23 07:00:02 EST 2017
# HG changeset patch
# User Pulkit Goyal <7895pulkit at gmail.com>
# Date 1487801268 -19800
# Thu Feb 23 03:37:48 2017 +0530
# Node ID 88fc32b91722498f17e4d8a48449e76986a171d7
# Parent e86b701628b33640c537e7377bbee8b69f22e390
revset: make wdir() work with ancestorspec '~' operator
Before this patch, doing `hg log -r 'wdir()~n'` returns an error except for
n equals 0.
diff -r e86b701628b3 -r 88fc32b91722 mercurial/revset.py
--- a/mercurial/revset.py Thu Feb 23 03:46:36 2017 +0530
+++ b/mercurial/revset.py Thu Feb 23 03:37:48 2017 +0530
@@ -390,6 +390,9 @@
ps = set()
cl = repo.changelog
for r in getset(repo, fullreposet(repo), x):
+ if r == node.wdirrev and n > 0:
+ n = n-1
+ r = subset.last()
for i in range(n):
r = cl.parentrevs(r)[0]
ps.add(r)
diff -r e86b701628b3 -r 88fc32b91722 tests/test-revset.t
--- a/tests/test-revset.t Thu Feb 23 03:46:36 2017 +0530
+++ b/tests/test-revset.t Thu Feb 23 03:37:48 2017 +0530
@@ -1223,6 +1223,8 @@
2147483647
$ hg debugrevspec 'wdir()^'
9
+ $ hg debugrevspec 'wdir()~4'
+ 2
$ hg debugrevspec 'tip or wdir()'
9
2147483647
More information about the Mercurial-devel
mailing list