##// END OF EJS Templates
histedit: modify rollup to discard date from the rollup commit (issue4820)...
Ben Schmidt -
r31056:37ab9e20 default
parent child Browse files
Show More
@@ -36,7 +36,7 file open in your editor::
36 36 # p, pick = use commit
37 37 # e, edit = use commit, but stop for amending
38 38 # f, fold = use commit, but combine it with the one above
39 # r, roll = like fold, but discard this commit's description
39 # r, roll = like fold, but discard this commit's description and date
40 40 # d, drop = remove commit from history
41 41 # m, mess = edit commit message without changing commit content
42 42 #
@@ -58,7 +58,7 would reorganize the file to look like t
58 58 # p, pick = use commit
59 59 # e, edit = use commit, but stop for amending
60 60 # f, fold = use commit, but combine it with the one above
61 # r, roll = like fold, but discard this commit's description
61 # r, roll = like fold, but discard this commit's description and date
62 62 # d, drop = remove commit from history
63 63 # m, mess = edit commit message without changing commit content
64 64 #
@@ -725,6 +725,15 class fold(histeditaction):
725 725 """
726 726 return True
727 727
728 def firstdate(self):
729 """Returns true if the rule should preserve the date of the first
730 change.
731
732 This exists mainly so that 'rollup' rules can be a subclass of
733 'fold'.
734 """
735 return False
736
728 737 def finishfold(self, ui, repo, ctx, oldctx, newnode, internalchanges):
729 738 parent = ctx.parents()[0].node()
730 739 repo.ui.pushbuffer()
@@ -743,6 +752,9 class fold(histeditaction):
743 752 [oldctx.description()]) + '\n'
744 753 commitopts['message'] = newmessage
745 754 # date
755 if self.firstdate():
756 commitopts['date'] = ctx.date()
757 else:
746 758 commitopts['date'] = max(ctx.date(), oldctx.date())
747 759 extra = ctx.extra().copy()
748 760 # histedit_source
@@ -810,7 +822,7 class _multifold(fold):
810 822 return True
811 823
812 824 @action(["roll", "r"],
813 _("like fold, but discard this commit's description"))
825 _("like fold, but discard this commit's description and date"))
814 826 class rollup(fold):
815 827 def mergedescs(self):
816 828 return False
@@ -818,6 +830,9 class rollup(fold):
818 830 def skipprompt(self):
819 831 return True
820 832
833 def firstdate(self):
834 return True
835
821 836 @action(["drop", "d"],
822 837 _('remove commit from history'))
823 838 class drop(histeditaction):
@@ -887,7 +902,7 def histedit(ui, repo, *freeargs, **opts
887 902
888 903 - `fold` to combine it with the preceding changeset (using the later date)
889 904
890 - `roll` like fold, but discarding this commit's description
905 - `roll` like fold, but discarding this commit's description and date
891 906
892 907 - `edit` to edit this changeset (preserving date)
893 908
@@ -72,7 +72,7 Run a dummy edit to make sure we get tip
72 72 # p, pick = use commit
73 73 # d, drop = remove commit from history
74 74 # f, fold = use commit, but combine it with the one above
75 # r, roll = like fold, but discard this commit's description
75 # r, roll = like fold, but discard this commit's description and date
76 76 #
77 77
78 78 Run on a revision not ancestors of the current working directory.
@@ -308,7 +308,7 Test that trimming description using mul
308 308 # p, pick = use commit
309 309 # d, drop = remove commit from history
310 310 # f, fold = use commit, but combine it with the one above
311 # r, roll = like fold, but discard this commit's description
311 # r, roll = like fold, but discard this commit's description and date
312 312 #
313 313
314 314 Test --continue with --keep
@@ -544,7 +544,7 Check that 'roll' is selected by default
544 544 # p, pick = use commit
545 545 # d, drop = remove commit from history
546 546 # f, fold = use commit, but combine it with the one above
547 # r, roll = like fold, but discard this commit's description
547 # r, roll = like fold, but discard this commit's description and date
548 548 #
549 549
550 550 $ cd ..
@@ -78,7 +78,7
78 78 # p, pick = use commit
79 79 # d, drop = remove commit from history
80 80 # f, fold = use commit, but combine it with the one above
81 # r, roll = like fold, but discard this commit's description
81 # r, roll = like fold, but discard this commit's description and date
82 82 #
83 83 $ hg histedit 1 --commands - --verbose << EOF | grep histedit
84 84 > pick 177f92b77385 2 c
@@ -141,7 +141,7
141 141 # p, pick = use commit
142 142 # d, drop = remove commit from history
143 143 # f, fold = use commit, but combine it with the one above
144 # r, roll = like fold, but discard this commit's description
144 # r, roll = like fold, but discard this commit's description and date
145 145 #
146 146 $ hg histedit 1 --commands - --verbose << EOF | grep histedit
147 147 > pick b346ab9a313d 1 c
@@ -72,7 +72,7 show the edit commands offered
72 72 # p, pick = use commit
73 73 # d, drop = remove commit from history
74 74 # f, fold = use commit, but combine it with the one above
75 # r, roll = like fold, but discard this commit's description
75 # r, roll = like fold, but discard this commit's description and date
76 76 #
77 77
78 78 edit the history
@@ -350,7 +350,7 Verify that revsetalias entries work wit
350 350 # p, pick = use commit
351 351 # d, drop = remove commit from history
352 352 # f, fold = use commit, but combine it with the one above
353 # r, roll = like fold, but discard this commit's description
353 # r, roll = like fold, but discard this commit's description and date
354 354 #
355 355
356 356 should also work if a commit message is missing
@@ -478,5 +478,5 Attempting to fold a change into a publi
478 478 # p, fold = use commit
479 479 # d, drop = remove commit from history
480 480 # f, fold = use commit, but combine it with the one above
481 # r, roll = like fold, but discard this commit's description
481 # r, roll = like fold, but discard this commit's description and date
482 482 #
@@ -183,7 +183,7 manifest
183 183
184 184 $ cd ..
185 185
186 Repeat test using "roll", not "fold". "roll" folds in changes but drops message
186 Repeat test using "roll", not "fold". "roll" folds in changes but drops message and date
187 187
188 188 $ initrepo r2
189 189 $ cd r2
@@ -276,15 +276,15 just continue this time
276 276
277 277 log after edit
278 278 $ hg log --graph
279 @ changeset: 5:162978f027fb
279 @ changeset: 5:b538bcb461be
280 280 | tag: tip
281 281 | user: test
282 282 | date: Thu Jan 01 00:00:06 1970 +0000
283 283 | summary: f
284 284 |
285 o changeset: 4:74e5e6c6c32f
285 o changeset: 4:317e37cb6d66
286 286 | user: test
287 | date: Thu Jan 01 00:00:07 1970 +0000
287 | date: Thu Jan 01 00:00:04 1970 +0000
288 288 | summary: d
289 289 |
290 290 o changeset: 3:092e4ce14829
@@ -324,13 +324,13 manifest
324 324 description is taken from rollup target commit
325 325
326 326 $ hg log --debug --rev 4
327 changeset: 4:74e5e6c6c32fa39f0eeed43302fd48633ea5926f
327 changeset: 4:317e37cb6d66c1c84628c00e5bf4c8c292831951
328 328 phase: draft
329 329 parent: 3:092e4ce14829f4974399ce4316d59f64ef0b6725
330 330 parent: -1:0000000000000000000000000000000000000000
331 331 manifest: 4:b068a323d969f22af1296ec6a5ea9384cef437ac
332 332 user: test
333 date: Thu Jan 01 00:00:07 1970 +0000
333 date: Thu Jan 01 00:00:04 1970 +0000
334 334 files: d e
335 335 extra: branch=default
336 336 extra: histedit_source=ae78f4c9d74ffa4b6cb5045001c303fe9204e890,42abbb61bede6f4366fa1e74a664343e5d558a70
@@ -106,7 +106,7 check histedit_source, including that it
106 106
107 107
108 108
109 rollup will fold without preserving the folded commit's message
109 rollup will fold without preserving the folded commit's message or date
110 110
111 111 $ OLDHGEDITOR=$HGEDITOR
112 112 $ HGEDITOR=false
@@ -121,11 +121,11 rollup will fold without preserving the
121 121
122 122 log after edit
123 123 $ hg logt --graph
124 @ 3:fb13f1f49340 d
124 @ 3:bab801520cec d
125 125 |
126 o 2:6d4bc3727566 f
126 o 2:58c8f2bfc151 f
127 127 |
128 o 1:563995ddbe65 b
128 o 1:5d939c56c72e b
129 129 |
130 130 o 0:8580ff50825a a
131 131
@@ -133,13 +133,13 log after edit
133 133 description is taken from rollup target commit
134 134
135 135 $ hg log --debug --rev 1
136 changeset: 1:563995ddbe650c0e6b0e1c1d75f0a197b61cec50
136 changeset: 1:5d939c56c72e77e29f5167696218e2131a40f5cf
137 137 phase: draft
138 138 parent: 0:8580ff50825a50c8f716709acdf8de0deddcd6ab
139 139 parent: -1:0000000000000000000000000000000000000000
140 140 manifest: 1:b5e112a3a8354e269b1524729f0918662d847c38
141 141 user: test
142 date: Thu Jan 01 00:00:05 1970 +0000
142 date: Thu Jan 01 00:00:02 1970 +0000
143 143 files+: b e
144 144 extra: branch=default
145 145 extra: histedit_source=97d72e5f12c7e84f85064aa72e5a297142c36ed9,505a591af19eed18f560af827b9e03d2076773dc
@@ -171,13 +171,13 check saving last-message.txt
171 171 > EOF
172 172
173 173 $ rm -f .hg/last-message.txt
174 $ hg status --rev '6d4bc3727566^1::fb13f1f49340'
174 $ hg status --rev '58c8f2bfc151^1::bab801520cec'
175 175 A c
176 176 A d
177 177 A f
178 $ HGEDITOR="sh $TESTTMP/editor.sh" hg histedit 6d4bc3727566 --commands - 2>&1 <<EOF
179 > pick 6d4bc3727566 f
180 > fold fb13f1f49340 d
178 $ HGEDITOR="sh $TESTTMP/editor.sh" hg histedit 58c8f2bfc151 --commands - 2>&1 <<EOF
179 > pick 58c8f2bfc151 f
180 > fold bab801520cec d
181 181 > EOF
182 182 allow non-folding commit
183 183 ==== before editing
@@ -136,7 +136,7 Base setup for the rest of the testing
136 136 # p, pick = use commit
137 137 # d, drop = remove commit from history
138 138 # f, fold = use commit, but combine it with the one above
139 # r, roll = like fold, but discard this commit's description
139 # r, roll = like fold, but discard this commit's description and date
140 140 #
141 141 $ hg histedit 1 --commands - --verbose <<EOF | grep histedit
142 142 > pick 177f92b77385 2 c
@@ -54,7 +54,7 show the edit commands offered by outgoi
54 54 # p, pick = use commit
55 55 # d, drop = remove commit from history
56 56 # f, fold = use commit, but combine it with the one above
57 # r, roll = like fold, but discard this commit's description
57 # r, roll = like fold, but discard this commit's description and date
58 58 #
59 59 $ cd ..
60 60
@@ -88,7 +88,7 show the error from unrelated repos
88 88 # p, pick = use commit
89 89 # d, drop = remove commit from history
90 90 # f, fold = use commit, but combine it with the one above
91 # r, roll = like fold, but discard this commit's description
91 # r, roll = like fold, but discard this commit's description and date
92 92 #
93 93 $ cd ..
94 94
@@ -114,7 +114,7 test sensitivity to branch in URL:
114 114 # p, pick = use commit
115 115 # d, drop = remove commit from history
116 116 # f, fold = use commit, but combine it with the one above
117 # r, roll = like fold, but discard this commit's description
117 # r, roll = like fold, but discard this commit's description and date
118 118 #
119 119
120 120 test to check number of roots in outgoing revisions
General Comments 0
You need to be logged in to leave comments. Login now