[PATCH] dispatch: fix so that if the -M flag does not change the order of records in hg log (issue4289)
Prabhu Gnana Sundar
pprabhugs at gmail.com
Tue Jul 8 19:13:56 UTC 2014
# HG changeset patch
# User Prabhu Gnana Sundar <pprabhugs at gmail.com>
# Date 1404846809 -19800
# Wed Jul 09 00:43:29 2014 +0530
# Node ID 9989ab0eaa2e43979a3b3bbeb0518fa0735d9d22
# Parent 212955411633acbe7ace88f22565ce17d85ec8c5
dispatch: fix so that if the -M flag does not change the order of records in hg log (issue4289)
>From hg 3.0.1, if the -M flag and an explicit revision range is given to hg log,
like "hg log -M -q -r 10:9", the revision order gets reversed, which is unexpected.
Example:
Observed:
$ hg log -M -q -r 10:9
9:087ee80fc7bd
10:ac2633661a37
Expected:
$ hg log -M -q -r 10:9
10:ac2633661a37
9:087ee80fc7bd
This patch fixes the above issue by just removing the merged rev while filetering
the revision range and not re-ordering the revisions.
Also, added a test case to test the same.
diff -r 212955411633 -r 9989ab0eaa2e mercurial/revset.py
--- a/mercurial/revset.py Fri Jun 27 15:20:50 2014 -0700
+++ b/mercurial/revset.py Wed Jul 09 00:43:29 2014 +0530
@@ -294,7 +294,9 @@
return xl + yl
def notset(repo, subset, x):
- return subset - getset(repo, subset, x)
+ merged_rev_set = set(getset(repo, subset, x))
+ subset_list = list(subset)
+ return filter(lambda x: x not in merged_rev_set, subset_list)
def listset(repo, subset, a, b):
raise error.ParseError(_("can't use a list in this context"))
diff -r 212955411633 -r 9989ab0eaa2e tests/test-log.t
--- a/tests/test-log.t Fri Jun 27 15:20:50 2014 -0700
+++ b/tests/test-log.t Wed Jul 09 00:43:29 2014 +0530
@@ -1375,3 +1375,43 @@
$ cd ..
+
+issue4289: if -M flag and an explicit revision range is given to hg log, the order
+should not be reversed.
+
+Create a new repo
+ $ hg init issue4289
+ $ cd issue4289
+Initial commit to the repo
+ $ echo "hello" > a.txt
+ $ hg add
+ adding a.txt
+ $ hg ci -m "initial commit"
+
+Make another commit to the repo
+ $ echo "world" >> a.txt
+ $ hg ci -m "Another commit"
+
+Create another head
+ $ hg up -r 0
+ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ $ echo "hello world" > b.txt
+ $ hg add
+ adding b.txt
+ $ hg ci -m "added a new file"
+ created new head
+
+Merge the two heads
+ $ hg merge
+ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ (branch merge, don't forget to commit)
+ $ hg ci -m "merged"
+
+Run log command
+ $ hg log -M -q -r 3:1
+ 2:b0b1beee06eb
+ 1:4e6686af661c
+
+ $ hg log -M -q -r 1:3
+ 1:4e6686af661c
+ 2:b0b1beee06eb
More information about the Mercurial-devel
mailing list