Show More
@@ -2715,9 +2715,14 b' def commitforceeditor(repo, ctx, subs, f' | |||
|
2715 | 2715 | # run editor in the repository root |
|
2716 | 2716 | olddir = os.getcwd() |
|
2717 | 2717 | os.chdir(repo.root) |
|
2718 | ||
|
2719 | # make in-memory changes visible to external process | |
|
2720 | tr = repo.currenttransaction() | |
|
2721 | repo.dirstate.write(tr) | |
|
2722 | pending = tr and tr.writepending() and repo.root | |
|
2723 | ||
|
2718 | 2724 | editortext = repo.ui.edit(committext, ctx.user(), ctx.extra(), |
|
2719 |
|
|
|
2720 | ||
|
2725 | editform=editform, pending=pending) | |
|
2721 | 2726 | text = re.sub("(?m)^HG:.*(\n|$)", "", editortext) |
|
2722 | 2727 | os.chdir(olddir) |
|
2723 | 2728 |
@@ -835,7 +835,8 b' class ui(object):' | |||
|
835 | 835 | if self.debugflag: |
|
836 | 836 | opts['label'] = opts.get('label', '') + ' ui.debug' |
|
837 | 837 | self.write(*msg, **opts) |
|
838 | def edit(self, text, user, extra=None, editform=None): | |
|
838 | ||
|
839 | def edit(self, text, user, extra=None, editform=None, pending=None): | |
|
839 | 840 | if extra is None: |
|
840 | 841 | extra = {} |
|
841 | 842 | (fd, name) = tempfile.mkstemp(prefix="hg-editor-", suffix=".txt", |
@@ -854,6 +855,8 b' class ui(object):' | |||
|
854 | 855 | break |
|
855 | 856 | if editform: |
|
856 | 857 | environ.update({'HGEDITFORM': editform}) |
|
858 | if pending: | |
|
859 | environ.update({'HG_PENDING': pending}) | |
|
857 | 860 | |
|
858 | 861 | editor = self.geteditor() |
|
859 | 862 |
@@ -19,7 +19,7 b' Refuse to amend public csets:' | |||
|
19 | 19 | |
|
20 | 20 | Nothing to amend: |
|
21 | 21 | |
|
22 | $ hg ci --amend | |
|
22 | $ hg ci --amend -m 'base1' | |
|
23 | 23 | nothing changed |
|
24 | 24 | [1] |
|
25 | 25 |
@@ -447,6 +447,92 b' page for detail).' | |||
|
447 | 447 | $ hg --cwd b parents --template 'parent: {rev}\n' |
|
448 | 448 | parent: 1 |
|
449 | 449 | |
|
450 | $ hg --cwd b update -q -C 0 | |
|
451 | $ hg --cwd b --config extensions.strip= strip -q 1 | |
|
452 | ||
|
453 | Test visibility of in-memory distate changes inside transaction to | |
|
454 | external process | |
|
455 | ||
|
456 | $ echo foo > a/foo | |
|
457 | $ hg --cwd a commit -A -m 'adding foo' foo | |
|
458 | $ hg --cwd a export -o '../patch%R' 3 | |
|
459 | ||
|
460 | $ cat > $TESTTMP/checkvisibility.sh <<EOF | |
|
461 | > echo "====" | |
|
462 | > hg parents --template "VISIBLE {rev}:{node|short}\n" | |
|
463 | > hg status -amr | |
|
464 | > # test that pending changes are hidden | |
|
465 | > unset HG_PENDING | |
|
466 | > hg parents --template "ACTUAL {rev}:{node|short}\n" | |
|
467 | > hg status -amr | |
|
468 | > echo "====" | |
|
469 | > EOF | |
|
470 | ||
|
471 | == test visibility to external editor | |
|
472 | ||
|
473 | $ (cd b && sh "$TESTTMP/checkvisibility.sh") | |
|
474 | ==== | |
|
475 | VISIBLE 0:80971e65b431 | |
|
476 | ACTUAL 0:80971e65b431 | |
|
477 | ==== | |
|
478 | ||
|
479 | $ HGEDITOR="sh $TESTTMP/checkvisibility.sh" hg --cwd b import -v --edit ../patch1 ../patch2 ../patch3 | |
|
480 | applying ../patch1 | |
|
481 | patching file a | |
|
482 | ==== | |
|
483 | VISIBLE 0:80971e65b431 | |
|
484 | M a | |
|
485 | ACTUAL 0:80971e65b431 | |
|
486 | M a | |
|
487 | ==== | |
|
488 | committing files: | |
|
489 | a | |
|
490 | committing manifest | |
|
491 | committing changelog | |
|
492 | created 1d4bd90af0e4 | |
|
493 | applying ../patch2 | |
|
494 | patching file a | |
|
495 | ==== | |
|
496 | VISIBLE 1:1d4bd90af0e4 | |
|
497 | M a | |
|
498 | ACTUAL 0:80971e65b431 | |
|
499 | M a | |
|
500 | ==== | |
|
501 | committing files: | |
|
502 | a | |
|
503 | committing manifest | |
|
504 | committing changelog | |
|
505 | created 6d019af21222 | |
|
506 | applying ../patch3 | |
|
507 | patching file foo | |
|
508 | adding foo | |
|
509 | ==== | |
|
510 | VISIBLE 2:6d019af21222 | |
|
511 | A foo | |
|
512 | ACTUAL 0:80971e65b431 | |
|
513 | M a | |
|
514 | ==== | |
|
515 | committing files: | |
|
516 | foo | |
|
517 | committing manifest | |
|
518 | committing changelog | |
|
519 | created 55e3f75b2378 | |
|
520 | ||
|
521 | $ hg --cwd b rollback -q | |
|
522 | ||
|
523 | (content of file "a" is already changed and it should be recognized as | |
|
524 | "M", even though dirstate is restored to one before "hg import") | |
|
525 | ||
|
526 | $ (cd b && sh "$TESTTMP/checkvisibility.sh") | |
|
527 | ==== | |
|
528 | VISIBLE 0:80971e65b431 | |
|
529 | M a | |
|
530 | ACTUAL 0:80971e65b431 | |
|
531 | M a | |
|
532 | ==== | |
|
533 | $ hg --cwd b revert --no-backup a | |
|
534 | $ rm -f b/foo | |
|
535 | ||
|
450 | 536 | $ rm -r b |
|
451 | 537 | |
|
452 | 538 |
@@ -2,6 +2,13 b' Environment setup for MQ' | |||
|
2 | 2 | |
|
3 | 3 | $ echo "[extensions]" >> $HGRCPATH |
|
4 | 4 | $ echo "mq=" >> $HGRCPATH |
|
5 | $ cat >> $HGRCPATH <<EOF | |
|
6 | > [defaults] | |
|
7 | > # explicit date to commit with fixed hashid | |
|
8 | > qnew = -d "0 0" | |
|
9 | > qrefresh = -d "0 0" | |
|
10 | > qfold = -d "0 0" | |
|
11 | > EOF | |
|
5 | 12 | $ hg init |
|
6 | 13 | $ hg qinit |
|
7 | 14 | |
@@ -191,3 +198,47 b' Test saving last-message.txt:' | |||
|
191 | 198 | |
|
192 | 199 | |
|
193 | 200 | test saving last-message.txt |
|
201 | ||
|
202 | Test visibility of in-memory distate changes outside transaction to | |
|
203 | external process | |
|
204 | ||
|
205 | $ cat > $TESTTMP/checkvisibility.sh <<EOF | |
|
206 | > echo "====" | |
|
207 | > hg parents --template "{rev}:{node|short}\n" | |
|
208 | > hg status -arm | |
|
209 | > echo "====" | |
|
210 | > EOF | |
|
211 | ||
|
212 | == test visibility to external editor | |
|
213 | ||
|
214 | $ hg update -C -q first-patch | |
|
215 | $ rm -f file2 | |
|
216 | $ hg qpush -q second-patch --config hooks.pretxncommit.unexpectedabort= | |
|
217 | now at: second-patch | |
|
218 | $ echo bbbb >> file2 | |
|
219 | ||
|
220 | $ sh "$TESTTMP/checkvisibility.sh" | |
|
221 | ==== | |
|
222 | 1:e30108269082 | |
|
223 | M file2 | |
|
224 | ==== | |
|
225 | ||
|
226 | $ HGEDITOR='sh "$TESTTMP/checkvisibility.sh"' hg qrefresh -e | |
|
227 | ==== | |
|
228 | 0:25e397dabed2 | |
|
229 | A file2 | |
|
230 | ==== | |
|
231 | transaction abort! | |
|
232 | rollback completed | |
|
233 | note: commit message saved in .hg/last-message.txt | |
|
234 | refresh interrupted while patch was popped! (revert --all, qpush to recover) | |
|
235 | abort: pretxncommit.unexpectedabort hook exited with status 1 | |
|
236 | [255] | |
|
237 | ||
|
238 | (rebuilding at failure of qrefresh bases on rev #0, and it causes | |
|
239 | dropping status of "file2") | |
|
240 | ||
|
241 | $ sh "$TESTTMP/checkvisibility.sh" | |
|
242 | ==== | |
|
243 | 0:25e397dabed2 | |
|
244 | ==== |
General Comments 0
You need to be logged in to leave comments.
Login now