##// END OF EJS Templates
log: fix order of revisions filtered by multiple OR options (issue5100)...
Yuya Nishihara -
r28253:c407583c stable
parent child Browse files
Show More
@@ -2139,9 +2139,15 b' def getlogrevs(repo, pats, opts):'
2139 # Revset matches can reorder revisions. "A or B" typically returns
2139 # Revset matches can reorder revisions. "A or B" typically returns
2140 # returns the revision matching A then the revision matching B. Sort
2140 # returns the revision matching A then the revision matching B. Sort
2141 # again to fix that.
2141 # again to fix that.
2142 fixopts = ['branch', 'only_branch', 'keyword', 'user']
2143 oldrevs = revs
2142 revs = matcher(repo, revs)
2144 revs = matcher(repo, revs)
2143 if not opts.get('rev'):
2145 if not opts.get('rev'):
2144 revs.sort(reverse=True)
2146 revs.sort(reverse=True)
2147 elif len(pats) > 1 or any(len(opts.get(op, [])) > 1 for op in fixopts):
2148 # XXX "A or B" is known to change the order; fix it by filtering
2149 # matched set again (issue5100)
2150 revs = oldrevs & revs
2145 if limit is not None:
2151 if limit is not None:
2146 limitedrevs = []
2152 limitedrevs = []
2147 for idx, r in enumerate(revs):
2153 for idx, r in enumerate(revs):
@@ -920,6 +920,116 b' log -r tip --stat'
920
920
921 $ cd ..
921 $ cd ..
922
922
923 Test that log should respect the order of -rREV even if multiple OR conditions
924 are specified (issue5100):
925
926 $ hg init revorder
927 $ cd revorder
928
929 $ hg branch -q b0
930 $ echo 0 >> f0
931 $ hg ci -qAm k0 -u u0
932 $ hg branch -q b1
933 $ echo 1 >> f1
934 $ hg ci -qAm k1 -u u1
935 $ hg branch -q b2
936 $ echo 2 >> f2
937 $ hg ci -qAm k2 -u u2
938
939 $ hg update -q b2
940 $ echo 3 >> f2
941 $ hg ci -qAm k2 -u u2
942 $ hg update -q b1
943 $ echo 4 >> f1
944 $ hg ci -qAm k1 -u u1
945 $ hg update -q b0
946 $ echo 5 >> f0
947 $ hg ci -qAm k0 -u u0
948
949 summary of revisions:
950
951 $ hg log -G -T '{rev} {branch} {author} {desc} {files}\n'
952 @ 5 b0 u0 k0 f0
953 |
954 | o 4 b1 u1 k1 f1
955 | |
956 | | o 3 b2 u2 k2 f2
957 | | |
958 | | o 2 b2 u2 k2 f2
959 | |/
960 | o 1 b1 u1 k1 f1
961 |/
962 o 0 b0 u0 k0 f0
963
964
965 log -b BRANCH in ascending order:
966
967 $ hg log -r0:tip -T '{rev} {branch}\n' -b b0 -b b1
968 0 b0
969 1 b1
970 4 b1
971 5 b0
972 $ hg log -r0:tip -T '{rev} {branch}\n' -b b1 -b b0
973 0 b0
974 1 b1
975 4 b1
976 5 b0
977
978 log --only-branch BRANCH in descending order:
979
980 $ hg log -rtip:0 -T '{rev} {branch}\n' --only-branch b1 --only-branch b2
981 4 b1
982 3 b2
983 2 b2
984 1 b1
985 $ hg log -rtip:0 -T '{rev} {branch}\n' --only-branch b2 --only-branch b1
986 4 b1
987 3 b2
988 2 b2
989 1 b1
990
991 log -u USER in ascending order, against compound set:
992
993 $ hg log -r'::head()' -T '{rev} {author}\n' -u u0 -u u2
994 0 u0
995 2 u2
996 3 u2
997 5 u0
998 $ hg log -r'::head()' -T '{rev} {author}\n' -u u2 -u u0
999 0 u0
1000 2 u2
1001 3 u2
1002 5 u0
1003
1004 log -k TEXT in descending order, against compound set:
1005
1006 $ hg log -r'5 + reverse(::3)' -T '{rev} {desc}\n' -k k0 -k k1 -k k2
1007 5 k0
1008 3 k2
1009 2 k2
1010 1 k1
1011 0 k0
1012 $ hg log -r'5 + reverse(::3)' -T '{rev} {desc}\n' -k k2 -k k1 -k k0
1013 5 k0
1014 3 k2
1015 2 k2
1016 1 k1
1017 0 k0
1018
1019 log FILE in ascending order, against dagrange:
1020
1021 $ hg log -r1:: -T '{rev} {files}\n' f1 f2
1022 1 f1
1023 2 f2
1024 3 f2
1025 4 f1
1026 $ hg log -r1:: -T '{rev} {files}\n' f2 f1
1027 1 f1
1028 2 f2
1029 3 f2
1030 4 f1
1031
1032 $ cd ..
923
1033
924 User
1034 User
925
1035
General Comments 0
You need to be logged in to leave comments. Login now