Show More
@@ -156,6 +156,15 b' configuration file::' | |||||
156 | [histedit] |
|
156 | [histedit] | |
157 | linelen = 120 # truncate rule lines at 120 characters |
|
157 | linelen = 120 # truncate rule lines at 120 characters | |
158 |
|
158 | |||
|
159 | The summary of a change can be customized as well:: | |||
|
160 | ||||
|
161 | [histedit] | |||
|
162 | summary-template = '{rev} {bookmarks} {desc|firstline}' | |||
|
163 | ||||
|
164 | The customized summary should be kept short enough that rule lines | |||
|
165 | will fit in the configured line length. See above if that requires | |||
|
166 | customization. | |||
|
167 | ||||
159 | ``hg histedit`` attempts to automatically choose an appropriate base |
|
168 | ``hg histedit`` attempts to automatically choose an appropriate base | |
160 | revision to use. To change which base revision is used, define a |
|
169 | revision to use. To change which base revision is used, define a | |
161 | revset in your configuration file:: |
|
170 | revset in your configuration file:: | |
@@ -248,6 +257,8 b" configitem('histedit', 'singletransactio" | |||||
248 | configitem('ui', 'interface.histedit', |
|
257 | configitem('ui', 'interface.histedit', | |
249 | default=None, |
|
258 | default=None, | |
250 | ) |
|
259 | ) | |
|
260 | configitem('histedit', 'summary-template', | |||
|
261 | default='{rev} {desc|firstline}') | |||
251 |
|
262 | |||
252 | # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for |
|
263 | # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for | |
253 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should |
|
264 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should | |
@@ -480,8 +491,11 b' class histeditaction(object):' | |||||
480 | <hash> <rev> <summary> |
|
491 | <hash> <rev> <summary> | |
481 | """ |
|
492 | """ | |
482 | ctx = self.repo[self.node] |
|
493 | ctx = self.repo[self.node] | |
483 | summary = _getsummary(ctx) |
|
494 | ui = self.repo.ui | |
484 | line = '%s %s %d %s' % (self.verb, ctx, ctx.rev(), summary) |
|
495 | summary = cmdutil.rendertemplate( | |
|
496 | ctx, ui.config('histedit', 'summary-template')) or '' | |||
|
497 | summary = summary.splitlines()[0] | |||
|
498 | line = '%s %s %s' % (self.verb, ctx, summary) | |||
485 | # trim to 75 columns by default so it's not stupidly wide in my editor |
|
499 | # trim to 75 columns by default so it's not stupidly wide in my editor | |
486 | # (the 5 more are left for verb) |
|
500 | # (the 5 more are left for verb) | |
487 | maxlen = self.repo.ui.configint('histedit', 'linelen') |
|
501 | maxlen = self.repo.ui.configint('histedit', 'linelen') |
@@ -52,6 +52,7 b' log before edit' | |||||
52 | summary: a |
|
52 | summary: a | |
53 |
|
53 | |||
54 |
|
54 | |||
|
55 | ||||
55 | show the edit commands offered |
|
56 | show the edit commands offered | |
56 | $ HGEDITOR=cat hg histedit 177f92b77385 |
|
57 | $ HGEDITOR=cat hg histedit 177f92b77385 | |
57 | pick 177f92b77385 2 c |
|
58 | pick 177f92b77385 2 c | |
@@ -76,6 +77,33 b' show the edit commands offered' | |||||
76 | # r, roll = like fold, but discard this commit's description and date |
|
77 | # r, roll = like fold, but discard this commit's description and date | |
77 | # |
|
78 | # | |
78 |
|
79 | |||
|
80 | ||||
|
81 | test customization of revision summary | |||
|
82 | $ HGEDITOR=cat hg histedit 177f92b77385 \ | |||
|
83 | > --config histedit.summary-template='I am rev {rev} desc {desc} tags {tags}' | |||
|
84 | pick 177f92b77385 I am rev 2 desc c tags | |||
|
85 | pick 055a42cdd887 I am rev 3 desc d tags | |||
|
86 | pick e860deea161a I am rev 4 desc e tags | |||
|
87 | pick 652413bf663e I am rev 5 desc f tags tip | |||
|
88 | ||||
|
89 | # Edit history between 177f92b77385 and 652413bf663e | |||
|
90 | # | |||
|
91 | # Commits are listed from least to most recent | |||
|
92 | # | |||
|
93 | # You can reorder changesets by reordering the lines | |||
|
94 | # | |||
|
95 | # Commands: | |||
|
96 | # | |||
|
97 | # e, edit = use commit, but stop for amending | |||
|
98 | # m, mess = edit commit message without changing commit content | |||
|
99 | # p, pick = use commit | |||
|
100 | # b, base = checkout changeset and apply further changesets from there | |||
|
101 | # d, drop = remove commit from history | |||
|
102 | # f, fold = use commit, but combine it with the one above | |||
|
103 | # r, roll = like fold, but discard this commit's description and date | |||
|
104 | # | |||
|
105 | ||||
|
106 | ||||
79 | edit the history |
|
107 | edit the history | |
80 | (use a hacky editor to check histedit-last-edit.txt backup) |
|
108 | (use a hacky editor to check histedit-last-edit.txt backup) | |
81 |
|
109 | |||
@@ -142,6 +170,7 b' log after edit' | |||||
142 | summary: a |
|
170 | summary: a | |
143 |
|
171 | |||
144 |
|
172 | |||
|
173 | ||||
145 | put things back |
|
174 | put things back | |
146 |
|
175 | |||
147 | $ hg histedit 177f92b77385 --commands - 2>&1 << EOF | fixbundle |
|
176 | $ hg histedit 177f92b77385 --commands - 2>&1 << EOF | fixbundle | |
@@ -184,6 +213,7 b' put things back' | |||||
184 | summary: a |
|
213 | summary: a | |
185 |
|
214 | |||
186 |
|
215 | |||
|
216 | ||||
187 | slightly different this time |
|
217 | slightly different this time | |
188 |
|
218 | |||
189 | $ hg histedit 177f92b77385 --commands - << EOF 2>&1 | fixbundle |
|
219 | $ hg histedit 177f92b77385 --commands - << EOF 2>&1 | fixbundle | |
@@ -225,6 +255,7 b' slightly different this time' | |||||
225 | summary: a |
|
255 | summary: a | |
226 |
|
256 | |||
227 |
|
257 | |||
|
258 | ||||
228 | keep prevents stripping dead revs |
|
259 | keep prevents stripping dead revs | |
229 | $ hg histedit 799205341b6b --keep --commands - 2>&1 << EOF | fixbundle |
|
260 | $ hg histedit 799205341b6b --keep --commands - 2>&1 << EOF | fixbundle | |
230 | > pick 799205341b6b d |
|
261 | > pick 799205341b6b d | |
@@ -276,6 +307,7 b' keep prevents stripping dead revs' | |||||
276 | summary: a |
|
307 | summary: a | |
277 |
|
308 | |||
278 |
|
309 | |||
|
310 | ||||
279 | try with --rev |
|
311 | try with --rev | |
280 | $ hg histedit --commands - --rev -2 2>&1 <<EOF | fixbundle |
|
312 | $ hg histedit --commands - --rev -2 2>&1 <<EOF | fixbundle | |
281 | > pick de71b079d9ce e |
|
313 | > pick de71b079d9ce e | |
@@ -326,6 +358,7 b' try with --rev' | |||||
326 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
358 | date: Thu Jan 01 00:00:00 1970 +0000 | |
327 | summary: a |
|
359 | summary: a | |
328 |
|
360 | |||
|
361 | ||||
329 | Verify that revsetalias entries work with histedit: |
|
362 | Verify that revsetalias entries work with histedit: | |
330 |
$ |
|
363 | $ cat >> $HGRCPATH <<EOF | |
331 | > [revsetalias] |
|
364 | > [revsetalias] | |
@@ -355,6 +388,7 b' Verify that revsetalias entries work wit' | |||||
355 | # r, roll = like fold, but discard this commit's description and date |
|
388 | # r, roll = like fold, but discard this commit's description and date | |
356 | # |
|
389 | # | |
357 |
|
390 | |||
|
391 | ||||
358 | should also work if a commit message is missing |
|
392 | should also work if a commit message is missing | |
359 | $ BUNDLE="$TESTDIR/missing-comment.hg" |
|
393 | $ BUNDLE="$TESTDIR/missing-comment.hg" | |
360 | $ hg init missing |
|
394 | $ hg init missing | |
@@ -384,6 +418,7 b' should also work if a commit message is ' | |||||
384 | date: Mon Nov 28 16:35:28 2011 +0000 |
|
418 | date: Mon Nov 28 16:35:28 2011 +0000 | |
385 | summary: Checked in text file |
|
419 | summary: Checked in text file | |
386 |
|
420 | |||
|
421 | ||||
387 | $ hg histedit 0 |
|
422 | $ hg histedit 0 | |
388 |
$ |
|
423 | $ cd .. | |
389 |
|
424 | |||
@@ -440,6 +475,7 b" Now, let's try to fold the second commit" | |||||
440 | @@ -0,0 +1,1 @@ |
|
475 | @@ -0,0 +1,1 @@ | |
441 | +changed |
|
476 | +changed | |
442 |
|
477 | |||
|
478 | ||||
443 | $ hg --config diff.git=yes export 1 |
|
479 | $ hg --config diff.git=yes export 1 | |
444 | # HG changeset patch |
|
480 | # HG changeset patch | |
445 | # User test |
|
481 | # User test | |
@@ -453,6 +489,7 b" Now, let's try to fold the second commit" | |||||
453 | rename from another-dir/initial-file |
|
489 | rename from another-dir/initial-file | |
454 | rename to another-dir/renamed-file |
|
490 | rename to another-dir/renamed-file | |
455 |
|
491 | |||
|
492 | ||||
456 | $ cd .. |
|
493 | $ cd .. | |
457 |
|
494 | |||
458 | Test that branches are preserved and stays active |
|
495 | Test that branches are preserved and stays active |
General Comments 0
You need to be logged in to leave comments.
Login now