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