##// END OF EJS Templates
revert: properly revert to ancestor of p2 during merge (issue5052)...
Pierre-Yves David -
r28192:cb6a952e stable
parent child Browse files
Show More
@@ -2846,10 +2846,6 b' def revert(ui, repo, ctx, parents, *pats'
2846 mf = ctx.manifest()
2846 mf = ctx.manifest()
2847 if node == p2:
2847 if node == p2:
2848 parent = p2
2848 parent = p2
2849 if node == parent:
2850 pmf = mf
2851 else:
2852 pmf = None
2853
2849
2854 # need all matching names in dirstate and manifest of target rev,
2850 # need all matching names in dirstate and manifest of target rev,
2855 # so have to walk both. do not print errors if files exist in one
2851 # so have to walk both. do not print errors if files exist in one
@@ -2964,11 +2960,7 b' def revert(ui, repo, ctx, parents, *pats'
2964 # in case of merge, files that are actually added can be reported as
2960 # in case of merge, files that are actually added can be reported as
2965 # modified, we need to post process the result
2961 # modified, we need to post process the result
2966 if p2 != nullid:
2962 if p2 != nullid:
2967 if pmf is None:
2963 mergeadd = dsmodified - smf
2968 # only need parent manifest in the merge case,
2969 # so do not read by default
2970 pmf = repo[parent].manifest()
2971 mergeadd = dsmodified - set(pmf)
2972 dsadded |= mergeadd
2964 dsadded |= mergeadd
2973 dsmodified -= mergeadd
2965 dsmodified -= mergeadd
2974
2966
@@ -1076,3 +1076,72 b' check resulting directory against the --'
1076 $ cd ..
1076 $ cd ..
1077 $ diff -U 0 -- content-base-all.txt content-base-explicit.txt | grep _
1077 $ diff -U 0 -- content-base-all.txt content-base-explicit.txt | grep _
1078 [1]
1078 [1]
1079
1080 Revert to an ancestor of P2 during a merge (issue5052)
1081 -----------------------------------------------------
1082
1083 (prepare the repository)
1084
1085 $ hg init issue5052
1086 $ cd issue5052
1087 $ echo '.\.orig' > .hgignore
1088 $ echo 0 > root
1089 $ hg ci -qAm C0
1090 $ echo 0 > A
1091 $ hg ci -qAm C1
1092 $ echo 1 >> A
1093 $ hg ci -qm C2
1094 $ hg up -q 0
1095 $ echo 1 > B
1096 $ hg ci -qAm C3
1097 $ hg status --rev 'ancestor(.,2)' --rev 2
1098 A A
1099 $ hg log -G -T '{rev} ({files})\n'
1100 @ 3 (B)
1101 |
1102 | o 2 (A)
1103 | |
1104 | o 1 (A)
1105 |/
1106 o 0 (.hgignore root)
1107
1108
1109 actual tests: reverting to something else than a merge parent
1110
1111 $ hg merge
1112 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1113 (branch merge, don't forget to commit)
1114
1115 $ hg status --rev 'p1()'
1116 M A
1117 $ hg status --rev 'p2()'
1118 A B
1119 $ hg status --rev '1'
1120 M A
1121 A B
1122 $ hg revert --rev 1 --all
1123 reverting A
1124 removing B
1125 $ hg status --rev 1
1126
1127 From the other parents
1128
1129 $ hg up -C 'p2()'
1130 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1131 $ hg merge
1132 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1133 (branch merge, don't forget to commit)
1134
1135 $ hg status --rev 'p1()'
1136 M B
1137 $ hg status --rev 'p2()'
1138 A A
1139 $ hg status --rev '1'
1140 M A
1141 A B
1142 $ hg revert --rev 1 --all
1143 reverting A
1144 removing B
1145 $ hg status --rev 1
1146
1147 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now