Mercurial > hg
view tests/test-rebase-mq-skip.t @ 26750:9f9ec4abe700
cmdutil: make in-memory changes visible to external editor (issue4378)
Before this patch, external editor process for the commit log can't
view some in-memory changes (especially, of dirstate), because they
aren't written out until the end of transaction (or wlock).
This causes unexpected output of Mercurial commands spawned from that
editor process.
To make in-memory changes visible to external editor process, this
patch does:
- write (or schedule to write) in-memory dirstate changes, and
- set HG_PENDING environment variable, if:
- a transaction is running, and
- there are in-memory changes to be visible
"hg diff" spawned from external editor process for "hg qrefresh"
shows:
- "changes newly imported into the topmost" before 49148d7868df(*)
- "all changes recorded in the topmost by refreshing" after this patch
(*) 49148d7868df changed steps invoking editor process
Even though backward compatibility may be broken, the latter behavior
looks reasonable, because "hg diff" spawned from the editor process
consistently shows "what changes new revision records" regardless of
invocation context.
In fact, issue4378 itself should be resolved by 800e090e9c64, which
made 'repo.transaction()' write in-memory dirstate changes out
explicitly before starting transaction. It also made "hg qrefresh"
imply 'dirstate.write()' before external editor invocation in call
chain below.
- mq.queue.refresh
- strip.strip
- repair.strip
- localrepository.transaction
- dirstate.write
- localrepository.commit
- invoke external editor
Though, this patch has '(issue4378)' in own summary line to indicate
that issues like issue4378 should be fixed by this.
BTW, this patch adds '-m' option to a 'hg ci --amend' execution in
'test-commit-amend.t', to avoid invoking external editor process.
In this case, "unsure" states may be changed to "clean" according to
timestamp or so on. These changes should be written into pending file,
if external editor invocation is required,
Then, writing dirstate changes out breaks stability of test, because
it shows "transaction abort!/rollback completed" occasionally.
Aborting after editor process invocation while commands below may
cause similar instability of tests, too (AFAIK, there is no more such
one, at this revision)
- commit --amend
- without --message/--logfile
- import
- without --message/--logfile,
- without --no-commit,
- without --bypass,
- one of below, and
- patch has no description text, or
- with --edit
- aborting at the 1st patch, which adds or removes file(s)
- if it only changes existing files, status is checked only for
changed files by 'scmutil.matchfiles()', and transition from
"unsure" to "normal" in dirstate doesn't occur (= dirstate
isn't changed, and written out)
- aborting at the 2nd or later patch implies other pending
changes (e.g. changelog), and always causes showing
"transaction abort!/rollback completed"
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Sat, 17 Oct 2015 01:15:34 +0900 |
parents | 143b52fce68e |
children | c7931d8ea29c |
line wrap: on
line source
This emulates the effects of an hg pull --rebase in which the remote repo already has one local mq patch $ cat >> $HGRCPATH <<EOF > [extensions] > rebase= > mq= > > [phases] > publish=False > > [alias] > tglog = log -G --template "{rev}: '{desc}' tags: {tags}\n" > EOF $ hg init a $ cd a $ hg qinit -c $ echo c1 > c1 $ hg add c1 $ hg ci -m C1 $ echo r1 > r1 $ hg add r1 $ hg ci -m R1 $ hg up -q 0 $ hg qnew p0.patch -d '1 0' $ echo p0 > p0 $ hg add p0 $ hg qref -m P0 $ hg qnew p1.patch -d '2 0' $ echo p1 > p1 $ hg add p1 $ hg qref -m P1 $ hg export qtip > p1.patch $ hg up -q -C 1 $ hg import p1.patch applying p1.patch $ rm p1.patch $ hg up -q -C qtip $ hg rebase -v rebasing 2:13a46ce44f60 "P0" (p0.patch qbase) resolving manifests removing p0 getting r1 resolving manifests getting p0 committing files: p0 committing manifest committing changelog rebasing 3:148775c71080 "P1" (p1.patch qtip) resolving manifests note: rebase of 3:148775c71080 created no changes to commit rebase merging completed updating mq patch p0.patch to 5:9ecc820b1737 $TESTTMP/a/.hg/patches/p0.patch (glob) 2 changesets found uncompressed size of bundle content: 344 (changelog) 284 (manifests) 109 p0 109 p1 saved backup bundle to $TESTTMP/a/.hg/strip-backup/13a46ce44f60-5da6ecfb-backup.hg (glob) 2 changesets found uncompressed size of bundle content: 399 (changelog) 284 (manifests) 109 p0 109 p1 adding branch adding changesets adding manifests adding file changes added 2 changesets with 2 changes to 2 files rebase completed 1 revisions have been skipped $ hg tglog @ 3: 'P0' tags: p0.patch qbase qtip tip | o 2: 'P1' tags: qparent | o 1: 'R1' tags: | o 0: 'C1' tags: $ cd .. $ hg init b $ cd b $ hg qinit -c $ for i in r0 r1 r2 r3 r4 r5 r6; > do > echo $i > $i > hg ci -Am $i > done adding r0 adding r1 adding r2 adding r3 adding r4 adding r5 adding r6 $ hg qimport -r 1:tip $ hg up -q 0 $ for i in r1 r3 r7 r8; > do > echo $i > $i > hg ci -Am branch2-$i > done adding r1 created new head adding r3 adding r7 adding r8 $ echo somethingelse > r4 $ hg ci -Am branch2-r4 adding r4 $ echo r6 > r6 $ hg ci -Am branch2-r6 adding r6 $ hg up -q qtip $ HGMERGE=internal:fail hg rebase rebasing 1:b4bffa6e4776 "r1" (qbase r1) note: rebase of 1:b4bffa6e4776 created no changes to commit rebasing 2:c0fd129beb01 "r2" (r2) rebasing 3:6ff5b8feed8e "r3" (r3) note: rebase of 3:6ff5b8feed8e created no changes to commit rebasing 4:094320fec554 "r4" (r4) unresolved conflicts (see hg resolve, then hg rebase --continue) [1] $ HGMERGE=internal:local hg resolve --all (no more unresolved files) $ hg rebase --continue already rebased 1:b4bffa6e4776 "r1" (qbase r1) as 057f55ff8f44 already rebased 2:c0fd129beb01 "r2" (r2) as 1660ab13ce9a already rebased 3:6ff5b8feed8e "r3" (r3) as 1660ab13ce9a rebasing 4:094320fec554 "r4" (r4) note: rebase of 4:094320fec554 created no changes to commit rebasing 5:681a378595ba "r5" (r5) rebasing 6:512a1f24768b "r6" (qtip r6) note: rebase of 6:512a1f24768b created no changes to commit saved backup bundle to $TESTTMP/b/.hg/strip-backup/b4bffa6e4776-b9bfb84d-backup.hg (glob) $ hg tglog @ 8: 'r5' tags: qtip r5 tip | o 7: 'r2' tags: qbase r2 | o 6: 'branch2-r6' tags: qparent | o 5: 'branch2-r4' tags: | o 4: 'branch2-r8' tags: | o 3: 'branch2-r7' tags: | o 2: 'branch2-r3' tags: | o 1: 'branch2-r1' tags: | o 0: 'r0' tags: $ cd ..