Show More
@@ -156,6 +156,15 b' configuration file::' | |||
|
156 | 156 | [histedit] |
|
157 | 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 | 168 | ``hg histedit`` attempts to automatically choose an appropriate base |
|
160 | 169 | revision to use. To change which base revision is used, define a |
|
161 | 170 | revset in your configuration file:: |
@@ -248,6 +257,8 b" configitem('histedit', 'singletransactio" | |||
|
248 | 257 | configitem('ui', 'interface.histedit', |
|
249 | 258 | default=None, |
|
250 | 259 | ) |
|
260 | configitem('histedit', 'summary-template', | |
|
261 | default='{rev} {desc|firstline}') | |
|
251 | 262 | |
|
252 | 263 | # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for |
|
253 | 264 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should |
@@ -480,8 +491,11 b' class histeditaction(object):' | |||
|
480 | 491 | <hash> <rev> <summary> |
|
481 | 492 | """ |
|
482 | 493 | ctx = self.repo[self.node] |
|
483 | summary = _getsummary(ctx) | |
|
484 | line = '%s %s %d %s' % (self.verb, ctx, ctx.rev(), summary) | |
|
494 | ui = self.repo.ui | |
|
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 | 499 | # trim to 75 columns by default so it's not stupidly wide in my editor |
|
486 | 500 | # (the 5 more are left for verb) |
|
487 | 501 | maxlen = self.repo.ui.configint('histedit', 'linelen') |
@@ -52,6 +52,7 b' log before edit' | |||
|
52 | 52 | summary: a |
|
53 | 53 | |
|
54 | 54 | |
|
55 | ||
|
55 | 56 | show the edit commands offered |
|
56 | 57 | $ HGEDITOR=cat hg histedit 177f92b77385 |
|
57 | 58 | pick 177f92b77385 2 c |
@@ -76,6 +77,33 b' show the edit commands offered' | |||
|
76 | 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 | 107 | edit the history |
|
80 | 108 | (use a hacky editor to check histedit-last-edit.txt backup) |
|
81 | 109 | |
@@ -142,6 +170,7 b' log after edit' | |||
|
142 | 170 | summary: a |
|
143 | 171 | |
|
144 | 172 | |
|
173 | ||
|
145 | 174 | put things back |
|
146 | 175 | |
|
147 | 176 | $ hg histedit 177f92b77385 --commands - 2>&1 << EOF | fixbundle |
@@ -184,6 +213,7 b' put things back' | |||
|
184 | 213 | summary: a |
|
185 | 214 | |
|
186 | 215 | |
|
216 | ||
|
187 | 217 | slightly different this time |
|
188 | 218 | |
|
189 | 219 | $ hg histedit 177f92b77385 --commands - << EOF 2>&1 | fixbundle |
@@ -225,6 +255,7 b' slightly different this time' | |||
|
225 | 255 | summary: a |
|
226 | 256 | |
|
227 | 257 | |
|
258 | ||
|
228 | 259 | keep prevents stripping dead revs |
|
229 | 260 | $ hg histedit 799205341b6b --keep --commands - 2>&1 << EOF | fixbundle |
|
230 | 261 | > pick 799205341b6b d |
@@ -276,6 +307,7 b' keep prevents stripping dead revs' | |||
|
276 | 307 | summary: a |
|
277 | 308 | |
|
278 | 309 | |
|
310 | ||
|
279 | 311 | try with --rev |
|
280 | 312 | $ hg histedit --commands - --rev -2 2>&1 <<EOF | fixbundle |
|
281 | 313 | > pick de71b079d9ce e |
@@ -326,6 +358,7 b' try with --rev' | |||
|
326 | 358 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
327 | 359 | summary: a |
|
328 | 360 | |
|
361 | ||
|
329 | 362 | Verify that revsetalias entries work with histedit: |
|
330 | 363 |
$ |
|
331 | 364 | > [revsetalias] |
@@ -355,6 +388,7 b' Verify that revsetalias entries work wit' | |||
|
355 | 388 | # r, roll = like fold, but discard this commit's description and date |
|
356 | 389 | # |
|
357 | 390 | |
|
391 | ||
|
358 | 392 | should also work if a commit message is missing |
|
359 | 393 | $ BUNDLE="$TESTDIR/missing-comment.hg" |
|
360 | 394 | $ hg init missing |
@@ -384,6 +418,7 b' should also work if a commit message is ' | |||
|
384 | 418 | date: Mon Nov 28 16:35:28 2011 +0000 |
|
385 | 419 | summary: Checked in text file |
|
386 | 420 | |
|
421 | ||
|
387 | 422 | $ hg histedit 0 |
|
388 | 423 |
$ |
|
389 | 424 | |
@@ -440,6 +475,7 b" Now, let's try to fold the second commit" | |||
|
440 | 475 | @@ -0,0 +1,1 @@ |
|
441 | 476 | +changed |
|
442 | 477 | |
|
478 | ||
|
443 | 479 | $ hg --config diff.git=yes export 1 |
|
444 | 480 | # HG changeset patch |
|
445 | 481 | # User test |
@@ -453,6 +489,7 b" Now, let's try to fold the second commit" | |||
|
453 | 489 | rename from another-dir/initial-file |
|
454 | 490 | rename to another-dir/renamed-file |
|
455 | 491 | |
|
492 | ||
|
456 | 493 | $ cd .. |
|
457 | 494 | |
|
458 | 495 | Test that branches are preserved and stays active |
General Comments 0
You need to be logged in to leave comments.
Login now