[PATCH 1 of 2] revset: make wdir() work with parent '^' operator(issue4905)
Pulkit Goyal
7895pulkit at gmail.com
Thu Feb 23 12:00:01 UTC 2017
# HG changeset patch
# User Pulkit Goyal <7895pulkit at gmail.com>
# Date 1487801796 -19800
# Thu Feb 23 03:46:36 2017 +0530
# Node ID e86b701628b33640c537e7377bbee8b69f22e390
# Parent 4572027bbe6795e66758120375f647c1c1804195
revset: make wdir() work with parent '^' operator(issue4905)
Before this patch, running `hg log -r 'wdir()^'` returns error.
diff -r 4572027bbe67 -r e86b701628b3 mercurial/revset.py
--- a/mercurial/revset.py Wed Feb 22 18:33:00 2017 +0530
+++ b/mercurial/revset.py Thu Feb 23 03:46:36 2017 +0530
@@ -1399,7 +1399,10 @@
ps = set()
cl = repo.changelog
for r in getset(repo, fullreposet(repo), x):
- ps.add(cl.parentrevs(r)[0])
+ if r == node.wdirrev:
+ ps.add(subset.last())
+ else:
+ ps.add(cl.parentrevs(r)[0])
ps -= set([node.nullrev])
# XXX we should turn this into a baseset instead of a set, smartset may do
# some optimizations from the fact this is a baseset.
diff -r 4572027bbe67 -r e86b701628b3 tests/test-revset.t
--- a/tests/test-revset.t Wed Feb 22 18:33:00 2017 +0530
+++ b/tests/test-revset.t Thu Feb 23 03:46:36 2017 +0530
@@ -1221,6 +1221,8 @@
Test working-directory revision
$ hg debugrevspec 'wdir()'
2147483647
+ $ hg debugrevspec 'wdir()^'
+ 9
$ hg debugrevspec 'tip or wdir()'
9
2147483647
More information about the Mercurial-devel
mailing list