diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -3027,6 +3027,7 @@ else: return f not in ctx2.manifest() +# TODO: remove the commitfunc parameter because it is no longer used def amend(ui, repo, commitfunc, old, extra, pats, opts): # avoid cycle context -> subrepo -> cmdutil from . import context @@ -3040,42 +3041,25 @@ base = old.p1() with repo.wlock(), repo.lock(), repo.transaction('amend'): - # See if we got a message from -m or -l, if not, open the editor - # with the message of the changeset to amend - message = logmessage(ui, opts) - # ensure logfile does not conflict with later enforcement of the - # message. potential logfile content has been processed by - # `logmessage` anyway. - opts.pop('logfile') - # First, do a regular commit to record all changes in the working - # directory (if there are any) - ui.callhooks = False - activebookmark = repo._bookmarks.active - try: - repo._bookmarks.active = None - opts['message'] = 'temporary amend commit for %s' % old - node = commit(ui, repo, commitfunc, pats, opts) - finally: - repo._bookmarks.active = activebookmark - ui.callhooks = True - ctx = repo[node] - # Participating changesets: # - # node/ctx o - new (intermediate) commit that contains changes - # | from working dir to go into amending commit - # | (or a workingctx if there were no changes) + # wctx o - workingctx that contains changes from working copy + # | to go into amending commit # | # old o - changeset to amend # | # base o - first parent of the changeset to amend + wctx = repo[None] # Update extra dict from amended commit (e.g. to preserve graft # source) extra.update(old.extra()) - # Also update it from the intermediate commit or from the wctx - extra.update(ctx.extra()) + # Also update it from the from the wctx + extra.update(wctx.extra()) + + user = opts.get('user') or old.user() + date = opts.get('date') or old.date() if len(old.parents()) > 1: # ctx.files() isn't reliable for merges, so fall back to the @@ -3085,30 +3069,47 @@ else: files = set(old.files()) - # Second, we use either the commit we just did, or if there were no - # changes the parent of the working directory as the version of the - # files in the final amend commit - if node: - ui.note(_('copying changeset %s to %s\n') % (ctx, base)) - - user = ctx.user() - date = ctx.date() + # add/remove the files to the working copy if the "addremove" option + # was specified. + matcher = scmutil.match(wctx, pats, opts) + if (opts.get('addremove') + and scmutil.addremove(repo, matcher, "", opts)): + raise error.Abort( + _("failed to mark all new/missing files as added/removed")) + + filestoamend = set([f for f in wctx.files() if matcher(f)]) + + changes = (len(filestoamend) > 0) + if changes: # Recompute copies (avoid recording a -> b -> a) - copied = copies.pathcopies(base, ctx) + copied = copies.pathcopies(base, wctx, matcher) if old.p2: - copied.update(copies.pathcopies(old.p2(), ctx)) + copied.update(copies.pathcopies(old.p2(), wctx, matcher)) # Prune files which were reverted by the updates: if old - # introduced file X and our intermediate commit, node, - # renamed that file, then those two files are the same and + # introduced file X and the file was renamed in the working + # copy, then those two files are the same and # we can discard X from our list of files. Likewise if X # was deleted, it's no longer relevant - files.update(ctx.files()) - files = [f for f in files if not samefile(f, ctx, base)] + files.update(filestoamend) + files = [f for f in files if not samefile(f, wctx, base)] def filectxfn(repo, ctx_, path): try: - fctx = ctx[path] + # If the file being considered is not amongst the files + # to be amended, we should return the file context from the + # old changeset. This avoids issues when only some files in + # the working copy are being amended but there are also + # changes to other files from the old changeset. + if not path in filestoamend: + return old.filectx(path) + + fctx = wctx[path] + + # Return None for removed files. + if not fctx.exists(): + return None + flags = fctx.flags() mctx = context.memfilectx(repo, fctx.path(), fctx.data(), @@ -3128,11 +3129,14 @@ except KeyError: return None - user = opts.get('user') or old.user() - date = opts.get('date') or old.date() + # See if we got a message from -m or -l, if not, open the editor with + # the message of the changeset to amend. + message = logmessage(ui, opts) + editform = mergeeditform(old, 'commit.amend') editor = getcommiteditor(editform=editform, **pycompat.strkwargs(opts)) + if not message: editor = getcommiteditor(edit=True, editform=editform) message = old.description() @@ -3151,7 +3155,7 @@ editor=editor) newdesc = changelog.stripdesc(new.description()) - if ((not node) + if ((not changes) and newdesc == old.description() and user == old.user() and date == old.date() @@ -3177,10 +3181,28 @@ # Reroute the working copy parent to the new changeset repo.setparents(newid, nullid) mapping = {old.node(): (newid,)} - if node: - mapping[node] = () scmutil.cleanupnodes(repo, mapping, 'amend') + # Fixing the dirstate because localrepo.commitctx does not update + # it. This is rather convenient because we did not need to update + # the dirstate for all the files in the new commit which commitctx + # could have done if it updated the dirstate. Now, we can + # selectively update the dirstate only for the amended files. + dirstate = repo.dirstate + + # Update the state of the files which were added and + # and modified in the amend to "normal" in the dirstate. + normalfiles = set( + wctx.modified() + wctx.added()).intersection(filestoamend) + for f in normalfiles: + dirstate.normal(f) + + # Update the state of files which were removed in the amend + # to "removed" in the dirstate. + removedfiles = set(wctx.removed()).intersection(filestoamend) + for f in removedfiles: + dirstate.drop(f) + return newid def commiteditor(repo, ctx, subs, editform=''): diff --git a/tests/test-amend.t b/tests/test-amend.t --- a/tests/test-amend.t +++ b/tests/test-amend.t @@ -29,7 +29,7 @@ $ echo 2 >> B $ hg amend - saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/112478962961-af2c0941-amend.hg (glob) (obsstore-off !) + saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/112478962961-7e959a55-amend.hg (glob) (obsstore-off !) #if obsstore-off $ hg log -p -G --hidden -T '{rev} {node|short} {desc}\n' @ 1 be169c7e8dbe B @@ -51,7 +51,7 @@ #else $ hg log -p -G --hidden -T '{rev} {node|short} {desc}\n' - @ 3 be169c7e8dbe B + @ 2 be169c7e8dbe B | diff --git a/B b/B | new file mode 100644 | --- /dev/null @@ -59,15 +59,6 @@ | @@ -0,0 +1,1 @@ | +B2 | - | x 2 edf08988b141 temporary amend commit for 112478962961 - | | diff --git a/B b/B - | | --- a/B - | | +++ b/B - | | @@ -1,1 +1,1 @@ - | | -B - | | \ No newline at end of file - | | +B2 - | | | x 1 112478962961 B |/ diff --git a/B b/B | new file mode 100644 @@ -100,13 +91,13 @@ $ echo 4 > D $ hg add C D $ hg amend -m NEWMESSAGE -I C - saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/be169c7e8dbe-c24d73fe-amend.hg (glob) (obsstore-off !) + saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/be169c7e8dbe-7684ddc5-amend.hg (glob) (obsstore-off !) $ hg log -r . -T '{node|short} {desc} {files}\n' c7ba14d9075b NEWMESSAGE B C $ echo 5 > E $ rm C $ hg amend -d '2000 1000' -u 'Foo ' -A C D - saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/c7ba14d9075b-b26ed45c-amend.hg (glob) (obsstore-off !) + saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/c7ba14d9075b-b3e76daa-amend.hg (glob) (obsstore-off !) $ hg log -r . -T '{node|short} {desc} {files} {author} {date}\n' 14f6c4bcc865 NEWMESSAGE B D Foo 2000.01000 @@ -153,7 +144,7 @@ new file mode 100644 examine changes to 'G'? [Ynesfdaq?] n - saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/507be9bdac71-7ae43d04-amend.hg (glob) (obsstore-off !) + saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/507be9bdac71-c8077452-amend.hg (glob) (obsstore-off !) $ hg log -r . -T '{files}\n' B D F @@ -186,7 +177,7 @@ $ hg amend $ hg log -T '{rev} {node|short} {desc}\n' -G - @ 4 be169c7e8dbe B + @ 3 be169c7e8dbe B | | o 2 26805aba1e60 C | | diff --git a/tests/test-commit-amend.t b/tests/test-commit-amend.t --- a/tests/test-commit-amend.t +++ b/tests/test-commit-amend.t @@ -40,7 +40,7 @@ $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -m 'amend base1' pretxncommit 43f1ba15f28a50abf0aae529cf8a16bfced7b149 43f1ba15f28a tip - saved backup bundle to $TESTTMP/.hg/strip-backup/489edb5b847d-f1bf3ab8-amend.hg (glob) + saved backup bundle to $TESTTMP/.hg/strip-backup/489edb5b847d-5ab4f721-amend.hg (glob) $ echo 'pretxncommit.foo = ' >> $HGRCPATH $ hg diff -c . diff -r ad120869acf0 -r 43f1ba15f28a a @@ -69,31 +69,36 @@ > #!/bin/sh > echo "" > "$1" > __EOF__ + +Update the existing file to ensure that the dirstate is not in pending state +(where the status of some files in the working copy is not known yet). This in +turn ensures that when the transaction is aborted due to an empty message during +the amend, there should be no rollback. + $ echo a >> a + $ echo b > b $ hg add b $ hg summary parent: 1:43f1ba15f28a tip amend base1 branch: default - commit: 1 added, 1 unknown + commit: 1 modified, 1 added, 1 unknown update: (current) phases: 2 draft $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend - transaction abort! - rollback completed abort: empty commit message [255] $ hg summary parent: 1:43f1ba15f28a tip amend base1 branch: default - commit: 1 added, 1 unknown + commit: 1 modified, 1 added, 1 unknown update: (current) phases: 2 draft -Add new file: +Add new file along with modified existing file: $ hg ci --amend -m 'amend base1 new file' - saved backup bundle to $TESTTMP/.hg/strip-backup/43f1ba15f28a-7a3b3496-amend.hg (glob) + saved backup bundle to $TESTTMP/.hg/strip-backup/43f1ba15f28a-007467c2-amend.hg (glob) Remove file that was added in amended commit: (and test logfile option) @@ -102,17 +107,17 @@ $ hg rm b $ echo 'amend base1 remove new file' > ../logfile $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg ci --amend --logfile ../logfile - saved backup bundle to $TESTTMP/.hg/strip-backup/b8e3cb2b3882-0b55739a-amend.hg (glob) + saved backup bundle to $TESTTMP/.hg/strip-backup/c16295aaf401-1ada9901-amend.hg (glob) $ hg cat b - b: no such file in rev 74609c7f506e + b: no such file in rev 47343646fa3d [1] No changes, just a different message: $ hg ci -v --amend -m 'no changes, new message' - amending changeset 74609c7f506e - copying changeset 74609c7f506e to ad120869acf0 + amending changeset 47343646fa3d + copying changeset 47343646fa3d to ad120869acf0 committing files: a committing manifest @@ -121,29 +126,30 @@ uncompressed size of bundle content: 254 (changelog) 163 (manifests) - 129 a - saved backup bundle to $TESTTMP/.hg/strip-backup/74609c7f506e-1bfde511-amend.hg (glob) + 131 a + saved backup bundle to $TESTTMP/.hg/strip-backup/47343646fa3d-c2758885-amend.hg (glob) 1 changesets found uncompressed size of bundle content: 250 (changelog) 163 (manifests) - 129 a + 131 a adding branch adding changesets adding manifests adding file changes added 1 changesets with 1 changes to 1 files - committed changeset 1:1cd866679df8 + committed changeset 1:401431e913a1 $ hg diff -c . - diff -r ad120869acf0 -r 1cd866679df8 a + diff -r ad120869acf0 -r 401431e913a1 a --- a/a Thu Jan 01 00:00:00 1970 +0000 +++ b/a Thu Jan 01 00:00:00 1970 +0000 - @@ -1,1 +1,3 @@ + @@ -1,1 +1,4 @@ a +a +a + +a $ hg log - changeset: 1:1cd866679df8 + changeset: 1:401431e913a1 tag: tip user: test date: Thu Jan 01 00:00:00 1970 +0000 @@ -168,12 +174,12 @@ > EOF $ HGEDITOR="sh .hg/checkeditform.sh" hg ci --amend -u foo -d '1 0' HGEDITFORM=commit.amend.normal - saved backup bundle to $TESTTMP/.hg/strip-backup/1cd866679df8-5f5bcb85-amend.hg (glob) + saved backup bundle to $TESTTMP/.hg/strip-backup/401431e913a1-5e8e532c-amend.hg (glob) $ echo a >> a $ hg ci --amend -u foo -d '1 0' - saved backup bundle to $TESTTMP/.hg/strip-backup/780e6f23e03d-83b10a27-amend.hg (glob) + saved backup bundle to $TESTTMP/.hg/strip-backup/d96b1d28ae33-677e0afb-amend.hg (glob) $ hg log -r . - changeset: 1:5f357c7560ab + changeset: 1:a9a13940fc03 tag: tip user: foo date: Thu Jan 01 00:00:01 1970 +0000 @@ -197,8 +203,8 @@ $ rm -f .hg/last-message.txt $ hg commit --amend -v -m "message given from command line" - amending changeset 5f357c7560ab - copying changeset 5f357c7560ab to ad120869acf0 + amending changeset a9a13940fc03 + copying changeset a9a13940fc03 to ad120869acf0 committing files: a committing manifest @@ -213,8 +219,8 @@ $ rm -f .hg/last-message.txt $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v - amending changeset 5f357c7560ab - copying changeset 5f357c7560ab to ad120869acf0 + amending changeset a9a13940fc03 + copying changeset a9a13940fc03 to ad120869acf0 no changes, new message @@ -245,8 +251,8 @@ then, test editing custom commit message $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v - amending changeset 5f357c7560ab - copying changeset 5f357c7560ab to ad120869acf0 + amending changeset a9a13940fc03 + copying changeset a9a13940fc03 to ad120869acf0 no changes, new message @@ -264,30 +270,25 @@ uncompressed size of bundle content: 249 (changelog) 163 (manifests) - 131 a - saved backup bundle to $TESTTMP/.hg/strip-backup/5f357c7560ab-e7c84ade-amend.hg (glob) + 133 a + saved backup bundle to $TESTTMP/.hg/strip-backup/a9a13940fc03-7c2e8674-amend.hg (glob) 1 changesets found uncompressed size of bundle content: 257 (changelog) 163 (manifests) - 131 a + 133 a adding branch adding changesets adding manifests adding file changes added 1 changesets with 1 changes to 1 files - committed changeset 1:7ab3bf440b54 + committed changeset 1:64a124ba1b44 Same, but with changes in working dir (different code path): $ echo a >> a $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v - amending changeset 7ab3bf440b54 - committing files: - a - committing manifest - committing changelog - copying changeset a0ea9b1a4c8c to ad120869acf0 + amending changeset 64a124ba1b44 another precious commit message @@ -301,27 +302,27 @@ a committing manifest committing changelog - 2 changesets found - uncompressed size of bundle content: - 464 (changelog) - 322 (manifests) - 249 a - saved backup bundle to $TESTTMP/.hg/strip-backup/7ab3bf440b54-8e3b5088-amend.hg (glob) 1 changesets found uncompressed size of bundle content: 257 (changelog) 163 (manifests) 133 a + saved backup bundle to $TESTTMP/.hg/strip-backup/64a124ba1b44-10374b8f-amend.hg (glob) + 1 changesets found + uncompressed size of bundle content: + 257 (changelog) + 163 (manifests) + 135 a adding branch adding changesets adding manifests adding file changes added 1 changesets with 1 changes to 1 files - committed changeset 1:ea22a388757c + committed changeset 1:7892795b8e38 $ rm editor.sh $ hg log -r . - changeset: 1:ea22a388757c + changeset: 1:7892795b8e38 tag: tip user: foo date: Thu Jan 01 00:00:01 1970 +0000 @@ -333,16 +334,16 @@ $ hg book book1 $ hg book book2 $ hg ci --amend -m 'move bookmarks' - saved backup bundle to $TESTTMP/.hg/strip-backup/ea22a388757c-e51094db-amend.hg (glob) + saved backup bundle to $TESTTMP/.hg/strip-backup/7892795b8e38-3fb46217-amend.hg (glob) $ hg book - book1 1:6cec5aa930e2 - * book2 1:6cec5aa930e2 + book1 1:8311f17e2616 + * book2 1:8311f17e2616 $ echo a >> a $ hg ci --amend -m 'move bookmarks' - saved backup bundle to $TESTTMP/.hg/strip-backup/6cec5aa930e2-e9b06de4-amend.hg (glob) + saved backup bundle to $TESTTMP/.hg/strip-backup/8311f17e2616-f0504fe3-amend.hg (glob) $ hg book - book1 1:48bb6e53a15f - * book2 1:48bb6e53a15f + book1 1:a3b65065808c + * book2 1:a3b65065808c abort does not loose bookmarks @@ -352,13 +353,11 @@ > __EOF__ $ echo a >> a $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend - transaction abort! - rollback completed abort: empty commit message [255] $ hg book - book1 1:48bb6e53a15f - * book2 1:48bb6e53a15f + book1 1:a3b65065808c + * book2 1:a3b65065808c $ hg revert -Caq $ rm editor.sh @@ -375,9 +374,9 @@ $ hg branch default -f marked working directory as branch default $ hg ci --amend -m 'back to default' - saved backup bundle to $TESTTMP/.hg/strip-backup/8ac881fbf49d-fd962fef-amend.hg (glob) + saved backup bundle to $TESTTMP/.hg/strip-backup/f8339a38efe1-c18453c9-amend.hg (glob) $ hg branches - default 2:ce12b0b57d46 + default 2:9c07515f2650 Close branch: @@ -391,7 +390,7 @@ $ echo b >> b $ hg ci -mb $ hg ci --amend --close-branch -m 'closing branch foo' - saved backup bundle to $TESTTMP/.hg/strip-backup/c962248fa264-6701c392-amend.hg (glob) + saved backup bundle to $TESTTMP/.hg/strip-backup/c962248fa264-54245dc7-amend.hg (glob) Same thing, different code path: @@ -400,9 +399,9 @@ reopening closed branch head 4 $ echo b >> b $ hg ci --amend --close-branch - saved backup bundle to $TESTTMP/.hg/strip-backup/027371728205-49c0c55d-amend.hg (glob) + saved backup bundle to $TESTTMP/.hg/strip-backup/027371728205-b900d9fa-amend.hg (glob) $ hg branches - default 2:ce12b0b57d46 + default 2:9c07515f2650 Refuse to amend during a merge: @@ -421,7 +420,7 @@ $ hg ci -m 'b -> c' $ hg mv c d $ hg ci --amend -m 'b -> d' - saved backup bundle to $TESTTMP/.hg/strip-backup/b8c6eac7f12e-adaaa8b1-amend.hg (glob) + saved backup bundle to $TESTTMP/.hg/strip-backup/42f3f27a067d-f23cc9f7-amend.hg (glob) $ hg st --rev '.^' --copies d A d b @@ -429,7 +428,7 @@ $ hg ci -m 'e = d' $ hg cp e f $ hg ci --amend -m 'f = d' - saved backup bundle to $TESTTMP/.hg/strip-backup/7f9761d65613-d37aa788-amend.hg (glob) + saved backup bundle to $TESTTMP/.hg/strip-backup/9198f73182d5-251d584a-amend.hg (glob) $ hg st --rev '.^' --copies f A f d @@ -440,7 +439,7 @@ $ hg cp a f $ mv f.orig f $ hg ci --amend -m replacef - saved backup bundle to $TESTTMP/.hg/strip-backup/9e8c5f7e3d95-90259f67-amend.hg (glob) + saved backup bundle to $TESTTMP/.hg/strip-backup/f0993ab6b482-eda301bf-amend.hg (glob) $ hg st --change . --copies $ hg log -r . --template "{file_copies}\n" @@ -452,7 +451,7 @@ adding g $ hg mv g h $ hg ci --amend - saved backup bundle to $TESTTMP/.hg/strip-backup/24aa8eacce2b-7059e0f1-amend.hg (glob) + saved backup bundle to $TESTTMP/.hg/strip-backup/58585e3f095c-0f5ebcda-amend.hg (glob) $ hg st --change . --copies h A h $ hg log -r . --template "{file_copies}\n" @@ -472,11 +471,11 @@ $ echo a >> a $ hg ci -ma $ hg ci --amend -m "a'" - saved backup bundle to $TESTTMP/.hg/strip-backup/3837aa2a2fdb-2be01fd1-amend.hg (glob) + saved backup bundle to $TESTTMP/.hg/strip-backup/39a162f1d65e-9dfe13d8-amend.hg (glob) $ hg log -r . --template "{branch}\n" a $ hg ci --amend -m "a''" - saved backup bundle to $TESTTMP/.hg/strip-backup/c05c06be7514-ed28c4cd-amend.hg (glob) + saved backup bundle to $TESTTMP/.hg/strip-backup/d5ca7b1ac72b-0b4c1a34-amend.hg (glob) $ hg log -r . --template "{branch}\n" a @@ -493,9 +492,9 @@ $ hg graft 12 grafting 12:2647734878ef "fork" (tip) $ hg ci --amend -m 'graft amend' - saved backup bundle to $TESTTMP/.hg/strip-backup/bd010aea3f39-eedb103b-amend.hg (glob) + saved backup bundle to $TESTTMP/.hg/strip-backup/fe8c6f7957ca-25638666-amend.hg (glob) $ hg log -r . --debug | grep extra - extra: amend_source=bd010aea3f39f3fb2a2f884b9ccb0471cd77398e + extra: amend_source=fe8c6f7957ca1665ed77496ed7a07657d469ac60 extra: branch=a extra: source=2647734878ef0236dda712fae9c1651cf694ea8a @@ -531,26 +530,26 @@ $ hg id -n 14 $ hg log -Gl 3 --style=compact - @ 14[tip]:11 b650e6ee8614 1970-01-01 00:00 +0000 test + @ 14[tip]:11 682950e85999 1970-01-01 00:00 +0000 test | babar | | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test | | fork | ~ - o 11 3334b7925910 1970-01-01 00:00 +0000 test + o 11 0ddb275cfad1 1970-01-01 00:00 +0000 test | a'' ~ $ hg log -Gl 4 --hidden --style=compact - @ 14[tip]:11 b650e6ee8614 1970-01-01 00:00 +0000 test + @ 14[tip]:11 682950e85999 1970-01-01 00:00 +0000 test | babar | - | x 13:11 68ff8ff97044 1970-01-01 00:00 +0000 test + | x 13:11 5167600b0f7a 1970-01-01 00:00 +0000 test |/ amend for phase | | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test | | fork | ~ - o 11 3334b7925910 1970-01-01 00:00 +0000 test + o 11 0ddb275cfad1 1970-01-01 00:00 +0000 test | a'' ~ @@ -562,23 +561,23 @@ $ echo 'babar' >> a $ hg commit --amend $ hg log -Gl 6 --hidden --style=compact - @ 16[tip]:11 9f9e9bccf56c 1970-01-01 00:00 +0000 test + @ 15[tip]:11 a5b42b49b0d5 1970-01-01 00:00 +0000 test | babar | - | x 15 90fef497c56f 1970-01-01 00:00 +0000 test - | | temporary amend commit for b650e6ee8614 - | | - | x 14:11 b650e6ee8614 1970-01-01 00:00 +0000 test + | x 14:11 682950e85999 1970-01-01 00:00 +0000 test |/ babar | - | x 13:11 68ff8ff97044 1970-01-01 00:00 +0000 test + | x 13:11 5167600b0f7a 1970-01-01 00:00 +0000 test |/ amend for phase | | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test | | fork | ~ - o 11 3334b7925910 1970-01-01 00:00 +0000 test + o 11 0ddb275cfad1 1970-01-01 00:00 +0000 test | a'' + | + o 10 5fa75032e226 1970-01-01 00:00 +0000 test + | g ~ @@ -586,12 +585,12 @@ --------------------------------------------------------------------- $ hg id -r 14 --hidden - b650e6ee8614 (a) + 682950e85999 (a) $ hg revert -ar 14 --hidden reverting a $ hg commit --amend $ hg id - b99e5df575f7 (a) tip + 37973c7e0b61 (a) tip Test that rewriting leaving instability behind is allowed --------------------------------------------------------------------- @@ -600,14 +599,14 @@ 0 files updated, 0 files merged, 1 files removed, 0 files unresolved $ echo 'b' >> a $ hg log --style compact -r 'children(.)' - 18[tip]:11 b99e5df575f7 1970-01-01 00:00 +0000 test + 16[tip]:11 37973c7e0b61 1970-01-01 00:00 +0000 test babar $ hg commit --amend $ hg log -r 'orphan()' - changeset: 18:b99e5df575f7 + changeset: 16:37973c7e0b61 branch: a - parent: 11:3334b7925910 + parent: 11:0ddb275cfad1 user: test date: Thu Jan 01 00:00:00 1970 +0000 instability: orphan @@ -635,10 +634,10 @@ (no more unresolved files) $ hg ci -m 'merge bar' $ hg log --config diff.git=1 -pr . - changeset: 23:163cfd7219f7 + changeset: 20:163cfd7219f7 tag: tip - parent: 22:30d96aeaf27b - parent: 21:1aa437659d19 + parent: 19:30d96aeaf27b + parent: 18:1aa437659d19 user: test date: Thu Jan 01 00:00:00 1970 +0000 summary: merge bar @@ -668,10 +667,10 @@ $ HGEDITOR="sh .hg/checkeditform.sh" hg ci --amend -m 'merge bar (amend message)' --edit HGEDITFORM=commit.amend.merge $ hg log --config diff.git=1 -pr . - changeset: 24:bca52d4ed186 + changeset: 21:bca52d4ed186 tag: tip - parent: 22:30d96aeaf27b - parent: 21:1aa437659d19 + parent: 19:30d96aeaf27b + parent: 18:1aa437659d19 user: test date: Thu Jan 01 00:00:00 1970 +0000 summary: merge bar (amend message) @@ -701,10 +700,10 @@ $ hg mv zz z $ hg ci --amend -m 'merge bar (undo rename)' $ hg log --config diff.git=1 -pr . - changeset: 26:12594a98ca3f + changeset: 22:12594a98ca3f tag: tip - parent: 22:30d96aeaf27b - parent: 21:1aa437659d19 + parent: 19:30d96aeaf27b + parent: 18:1aa437659d19 user: test date: Thu Jan 01 00:00:00 1970 +0000 summary: merge bar (undo rename) @@ -737,10 +736,10 @@ $ echo aa >> aaa $ hg ci -m 'merge bar again' $ hg log --config diff.git=1 -pr . - changeset: 28:dffde028b388 + changeset: 24:dffde028b388 tag: tip - parent: 26:12594a98ca3f - parent: 27:4c94d5bc65f5 + parent: 22:12594a98ca3f + parent: 23:4c94d5bc65f5 user: test date: Thu Jan 01 00:00:00 1970 +0000 summary: merge bar again @@ -772,10 +771,10 @@ $ hg mv aaa aa $ hg ci --amend -m 'merge bar again (undo rename)' $ hg log --config diff.git=1 -pr . - changeset: 30:18e3ba160489 + changeset: 25:18e3ba160489 tag: tip - parent: 26:12594a98ca3f - parent: 27:4c94d5bc65f5 + parent: 22:12594a98ca3f + parent: 23:4c94d5bc65f5 user: test date: Thu Jan 01 00:00:00 1970 +0000 summary: merge bar again (undo rename) @@ -814,10 +813,10 @@ use (c)hanged version, (d)elete, or leave (u)nresolved? c $ hg ci -m 'merge bar (with conflicts)' $ hg log --config diff.git=1 -pr . - changeset: 33:b4c3035e2544 + changeset: 28:b4c3035e2544 tag: tip - parent: 32:4b216ca5ba97 - parent: 31:67db8847a540 + parent: 27:4b216ca5ba97 + parent: 26:67db8847a540 user: test date: Thu Jan 01 00:00:00 1970 +0000 summary: merge bar (with conflicts) @@ -826,10 +825,10 @@ $ hg rm aa $ hg ci --amend -m 'merge bar (with conflicts, amended)' $ hg log --config diff.git=1 -pr . - changeset: 35:1205ed810051 + changeset: 29:1205ed810051 tag: tip - parent: 32:4b216ca5ba97 - parent: 31:67db8847a540 + parent: 27:4b216ca5ba97 + parent: 26:67db8847a540 user: test date: Thu Jan 01 00:00:00 1970 +0000 summary: merge bar (with conflicts, amended) @@ -870,12 +869,12 @@ --------------------------------------------------------------------- $ hg phase '.^::.' - 35: draft - 36: draft + 29: draft + 30: draft $ hg commit --amend --secret -m 'amend as secret' -q $ hg phase '.^::.' - 35: draft - 38: secret + 29: draft + 31: secret Test that amend with --edit invokes editor forcibly --------------------------------------------------- @@ -1065,12 +1064,12 @@ o 0 a0 -The way mercurial does amends is to create a temporary commit (rev 3) and then -fold the new and old commits together into another commit (rev 4). During this -process, _findlimit is called to check how far back to look for the transitive -closure of file copy information, but due to the divergence of the filelog -and changelog graph topologies, before _findlimit was fixed, it returned a rev -which was not far enough back in this case. +The way mercurial does amends is by folding the working copy and old commit +together into another commit (rev 3). During this process, _findlimit is called +to check how far back to look for the transitive closure of file copy +information, but due to the divergence of the filelog and changelog graph +topologies, before _findlimit was fixed, it returned a rev which was not far +enough back in this case. $ hg mv a1 a2 $ hg status --copies --rev 0 A a2 @@ -1078,7 +1077,7 @@ R a0 $ hg ci --amend -q $ hg log -G --template '{rev} {desc}' - @ 4 a1-amend + @ 3 a1-amend | | o 1 a1 |/ @@ -1161,10 +1160,10 @@ $ hg ci --amend -m "chmod amended" $ hg ci --amend -m "chmod amended second time" $ hg log -p --git -r . - changeset: 8:b1326f52dddf + changeset: 7:b1326f52dddf branch: newdirname tag: tip - parent: 5:7fd235f7cb2f + parent: 4:7fd235f7cb2f user: test date: Thu Jan 01 00:00:00 1970 +0000 summary: chmod amended second time diff --git a/tests/test-commit-interactive-curses.t b/tests/test-commit-interactive-curses.t --- a/tests/test-commit-interactive-curses.t +++ b/tests/test-commit-interactive-curses.t @@ -206,7 +206,7 @@ > X > EOF $ hg commit -i -m "newly added file" -d "0 0" - saved backup bundle to $TESTTMP/a/.hg/strip-backup/2b0e9be4d336-28bbe4e2-amend.hg (glob) + saved backup bundle to $TESTTMP/a/.hg/strip-backup/2b0e9be4d336-3cf0bc8c-amend.hg (glob) $ hg diff -c . diff -r a6735021574d -r c1d239d165ae x --- /dev/null Thu Jan 01 00:00:00 1970 +0000 diff --git a/tests/test-histedit-obsolete.t b/tests/test-histedit-obsolete.t --- a/tests/test-histedit-obsolete.t +++ b/tests/test-histedit-obsolete.t @@ -43,23 +43,22 @@ $ hg commit --amend b $ hg histedit --continue $ hg log -G - @ 6:46abc7c4d873 b + @ 5:46abc7c4d873 b | - o 5:49d44ab2be1b c + o 4:49d44ab2be1b c | o 0:cb9a9f314b8b a $ hg debugobsolete e72d22b19f8ecf4150ab4f91d0973fd9955d3ddf 49d44ab2be1b67a79127568a67c9c99430633b48 0 (*) {'user': 'test'} (glob) - 3e30a45cf2f719e96ab3922dfe039cfd047956ce 0 {e72d22b19f8ecf4150ab4f91d0973fd9955d3ddf} (*) {'user': 'test'} (glob) 1b2d564fad96311b45362f17c2aa855150efb35f 46abc7c4d8738e8563e577f7889e1b6db3da4199 0 (*) {'user': 'test'} (glob) 114f4176969ef342759a8a57e6bccefc4234829b 49d44ab2be1b67a79127568a67c9c99430633b48 0 (*) {'user': 'test'} (glob) With some node gone missing during the edit. $ echo "pick `hg log -r 0 -T '{node|short}'`" > plan - $ echo "pick `hg log -r 6 -T '{node|short}'`" >> plan - $ echo "edit `hg log -r 5 -T '{node|short}'`" >> plan + $ echo "pick `hg log -r 5 -T '{node|short}'`" >> plan + $ echo "edit `hg log -r 4 -T '{node|short}'`" >> plan $ hg histedit -r 'all()' --commands plan Editing (49d44ab2be1b), you may commit or record as needed now. (hg histedit --continue to resume) @@ -73,15 +72,14 @@ $ hg --hidden --config extensions.strip= strip 'desc(XXXXXX)' --no-backup $ hg histedit --continue $ hg log -G - @ 9:273c1f3b8626 c + @ 8:273c1f3b8626 c | - o 8:aba7da937030 b2 + o 7:aba7da937030 b2 | o 0:cb9a9f314b8b a $ hg debugobsolete e72d22b19f8ecf4150ab4f91d0973fd9955d3ddf 49d44ab2be1b67a79127568a67c9c99430633b48 0 (*) {'user': 'test'} (glob) - 3e30a45cf2f719e96ab3922dfe039cfd047956ce 0 {e72d22b19f8ecf4150ab4f91d0973fd9955d3ddf} (*) {'user': 'test'} (glob) 1b2d564fad96311b45362f17c2aa855150efb35f 46abc7c4d8738e8563e577f7889e1b6db3da4199 0 (*) {'user': 'test'} (glob) 114f4176969ef342759a8a57e6bccefc4234829b 49d44ab2be1b67a79127568a67c9c99430633b48 0 (*) {'user': 'test'} (glob) 76f72745eac0643d16530e56e2f86e36e40631f1 2ca853e48edbd6453a0674dc0fe28a0974c51b9c 0 (*) {'user': 'test'} (glob) diff --git a/tests/test-log.t b/tests/test-log.t --- a/tests/test-log.t +++ b/tests/test-log.t @@ -2300,14 +2300,14 @@ $ hg up 'head() and not .' 1 files updated, 0 files merged, 1 files removed, 0 files unresolved $ hg log -G - o changeset: 4:db815d6d32e6 + o changeset: 3:db815d6d32e6 | tag: tip | parent: 0:f7b1eb17ad24 | user: test | date: Thu Jan 01 00:00:00 1970 +0000 | summary: 2 | - | @ changeset: 3:9bc8ce7f9356 + | @ changeset: 2:9bc8ce7f9356 |/ parent: 0:f7b1eb17ad24 | user: test | date: Thu Jan 01 00:00:00 1970 +0000 @@ -2319,14 +2319,14 @@ summary: 0 $ hg log -f -G b - @ changeset: 3:9bc8ce7f9356 + @ changeset: 2:9bc8ce7f9356 | parent: 0:f7b1eb17ad24 ~ user: test date: Thu Jan 01 00:00:00 1970 +0000 summary: 1 $ hg log -G b - @ changeset: 3:9bc8ce7f9356 + @ changeset: 2:9bc8ce7f9356 | parent: 0:f7b1eb17ad24 ~ user: test date: Thu Jan 01 00:00:00 1970 +0000 diff --git a/tests/test-obsmarker-template.t b/tests/test-obsmarker-template.t --- a/tests/test-obsmarker-template.t +++ b/tests/test-obsmarker-template.t @@ -45,24 +45,19 @@ $ HGUSER=test2 hg commit --amend -m "A2" --config devel.default-date="987654321 0" $ hg log --hidden -G - @ changeset: 4:d004c8f274b9 + @ changeset: 3:d004c8f274b9 | tag: tip | parent: 0:ea207398892e | user: test | date: Thu Jan 01 00:00:00 1970 +0000 | summary: A2 | - | x changeset: 3:a468dc9b3633 + | x changeset: 2:a468dc9b3633 |/ parent: 0:ea207398892e | user: test | date: Thu Jan 01 00:00:00 1970 +0000 | summary: A1 | - | x changeset: 2:f137d23bb3e1 - | | user: test - | | date: Thu Jan 01 00:00:00 1970 +0000 - | | summary: temporary amend commit for 471f378eab4c - | | | x changeset: 1:471f378eab4c |/ user: test | date: Thu Jan 01 00:00:00 1970 +0000 @@ -86,8 +81,8 @@ | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"] | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874 | @ 471f378eab4c - |/ Successors: 4:d004c8f274b9 - | multi-line: 4:d004c8f274b9 + |/ Successors: 3:d004c8f274b9 + | multi-line: 3:d004c8f274b9 | json: [["d004c8f274b9ec480a47a93c10dac5eee63adb78"]] o ea207398892e @@ -95,21 +90,21 @@ o d004c8f274b9 | | @ 471f378eab4c - |/ Obsfate: rewritten as 4:d004c8f274b9 by test1, test2 (between 2001-04-19 04:25 +0000 and 2009-02-13 23:31 +0000); + |/ Obsfate: rewritten as 3:d004c8f274b9 by test1, test2 (between 2001-04-19 04:25 +0000 and 2009-02-13 23:31 +0000); o ea207398892e $ hg fatelog o d004c8f274b9 | | @ 471f378eab4c - |/ Obsfate: rewritten as 4:d004c8f274b9 by test1, test2 (between 2001-04-19 04:25 +0000 and 2009-02-13 23:31 +0000); + |/ Obsfate: rewritten as 3:d004c8f274b9 by test1, test2 (between 2001-04-19 04:25 +0000 and 2009-02-13 23:31 +0000); o ea207398892e $ hg fatelog -v o d004c8f274b9 | | @ 471f378eab4c - |/ Obsfate: rewritten as 4:d004c8f274b9 by test1, test2 (between 2001-04-19 04:25 +0000 and 2009-02-13 23:31 +0000); + |/ Obsfate: rewritten as 3:d004c8f274b9 by test1, test2 (between 2001-04-19 04:25 +0000 and 2009-02-13 23:31 +0000); o ea207398892e $ hg up 'desc(A1)' --hidden @@ -118,13 +113,13 @@ Predecessors template should show current revision as it is the working copy $ hg tlog o d004c8f274b9 - | Predecessors: 3:a468dc9b3633 - | semi-colon: 3:a468dc9b3633 + | Predecessors: 2:a468dc9b3633 + | semi-colon: 2:a468dc9b3633 | json: ["a468dc9b36338b14fdb7825f55ce3df4e71517ad"] - | map: 3:a468dc9b36338b14fdb7825f55ce3df4e71517ad + | map: 2:a468dc9b36338b14fdb7825f55ce3df4e71517ad | @ a468dc9b3633 - |/ Successors: 4:d004c8f274b9 - | multi-line: 4:d004c8f274b9 + |/ Successors: 3:d004c8f274b9 + | multi-line: 3:d004c8f274b9 | json: [["d004c8f274b9ec480a47a93c10dac5eee63adb78"]] o ea207398892e @@ -132,30 +127,28 @@ o d004c8f274b9 | | @ a468dc9b3633 - |/ Obsfate: rewritten as 4:d004c8f274b9 by test2 (at 2001-04-19 04:25 +0000); + |/ Obsfate: rewritten as 3:d004c8f274b9 by test2 (at 2001-04-19 04:25 +0000); o ea207398892e Predecessors template should show all the predecessors as we force their display with --hidden $ hg tlog --hidden o d004c8f274b9 - | Predecessors: 3:a468dc9b3633 - | semi-colon: 3:a468dc9b3633 + | Predecessors: 2:a468dc9b3633 + | semi-colon: 2:a468dc9b3633 | json: ["a468dc9b36338b14fdb7825f55ce3df4e71517ad"] - | map: 3:a468dc9b36338b14fdb7825f55ce3df4e71517ad + | map: 2:a468dc9b36338b14fdb7825f55ce3df4e71517ad | @ a468dc9b3633 |/ Predecessors: 1:471f378eab4c | semi-colon: 1:471f378eab4c | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"] | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874 - | Successors: 4:d004c8f274b9 - | multi-line: 4:d004c8f274b9 + | Successors: 3:d004c8f274b9 + | multi-line: 3:d004c8f274b9 | json: [["d004c8f274b9ec480a47a93c10dac5eee63adb78"]] - | x f137d23bb3e1 - | | | x 471f378eab4c - |/ Successors: 3:a468dc9b3633 - | multi-line: 3:a468dc9b3633 + |/ Successors: 2:a468dc9b3633 + | multi-line: 2:a468dc9b3633 | json: [["a468dc9b36338b14fdb7825f55ce3df4e71517ad"]] o ea207398892e @@ -163,11 +156,9 @@ o d004c8f274b9 | | @ a468dc9b3633 - |/ Obsfate: rewritten as 4:d004c8f274b9 by test2 (at 2001-04-19 04:25 +0000); - | x f137d23bb3e1 - | | Obsfate: pruned by test1 (at 2009-02-13 23:31 +0000); + |/ Obsfate: rewritten as 3:d004c8f274b9 by test2 (at 2001-04-19 04:25 +0000); | x 471f378eab4c - |/ Obsfate: rewritten as 3:a468dc9b3633 by test1 (at 2009-02-13 23:31 +0000); + |/ Obsfate: rewritten as 2:a468dc9b3633 by test1 (at 2009-02-13 23:31 +0000); o ea207398892e @@ -182,23 +173,21 @@ $ hg tlog --hidden @ d004c8f274b9 - | Predecessors: 3:a468dc9b3633 - | semi-colon: 3:a468dc9b3633 + | Predecessors: 2:a468dc9b3633 + | semi-colon: 2:a468dc9b3633 | json: ["a468dc9b36338b14fdb7825f55ce3df4e71517ad"] - | map: 3:a468dc9b36338b14fdb7825f55ce3df4e71517ad + | map: 2:a468dc9b36338b14fdb7825f55ce3df4e71517ad | x a468dc9b3633 |/ Predecessors: 1:471f378eab4c | semi-colon: 1:471f378eab4c | json: ["471f378eab4c5e25f6c77f785b27c936efb22874"] | map: 1:471f378eab4c5e25f6c77f785b27c936efb22874 - | Successors: 4:d004c8f274b9 - | multi-line: 4:d004c8f274b9 + | Successors: 3:d004c8f274b9 + | multi-line: 3:d004c8f274b9 | json: [["d004c8f274b9ec480a47a93c10dac5eee63adb78"]] - | x f137d23bb3e1 - | | | x 471f378eab4c - |/ Successors: 3:a468dc9b3633 - | multi-line: 3:a468dc9b3633 + |/ Successors: 2:a468dc9b3633 + | multi-line: 2:a468dc9b3633 | json: [["a468dc9b36338b14fdb7825f55ce3df4e71517ad"]] o ea207398892e @@ -212,11 +201,9 @@ @ d004c8f274b9 | | x a468dc9b3633 - |/ Obsfate: rewritten as 4:d004c8f274b9 by test2 (at 2001-04-19 04:25 +0000); - | x f137d23bb3e1 - | | Obsfate: pruned by test1 (at 2009-02-13 23:31 +0000); + |/ Obsfate: rewritten as 3:d004c8f274b9 by test2 (at 2001-04-19 04:25 +0000); | x 471f378eab4c - |/ Obsfate: rewritten as 3:a468dc9b3633 by test1 (at 2009-02-13 23:31 +0000); + |/ Obsfate: rewritten as 2:a468dc9b3633 by test1 (at 2009-02-13 23:31 +0000); o ea207398892e $ hg fatelogjson --hidden @@ -224,8 +211,6 @@ | | x a468dc9b3633 |/ Obsfate: [{"markers": [["a468dc9b36338b14fdb7825f55ce3df4e71517ad", ["d004c8f274b9ec480a47a93c10dac5eee63adb78"], 0, [["user", "test2"]], [987654321.0, 0], null]], "successors": ["d004c8f274b9ec480a47a93c10dac5eee63adb78"]}] - | x f137d23bb3e1 - | | Obsfate: [{"markers": [["f137d23bb3e11dc1daeb6264fac9cb2433782e15", [], 0, [["user", "test1"]], [1234567890.0, 0], ["471f378eab4c5e25f6c77f785b27c936efb22874"]]], "successors": []}] | x 471f378eab4c |/ Obsfate: [{"markers": [["471f378eab4c5e25f6c77f785b27c936efb22874", ["a468dc9b36338b14fdb7825f55ce3df4e71517ad"], 0, [["user", "test1"]], [1234567890.0, 0], null]], "successors": ["a468dc9b36338b14fdb7825f55ce3df4e71517ad"]}] o ea207398892e diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t --- a/tests/test-obsolete.t +++ b/tests/test-obsolete.t @@ -1029,18 +1029,18 @@ o 0:d20a80d4def3 (draft) [ ] base $ hg log -G -R ../repo-issue3805 - @ 3:323a9c3ddd91 (draft) [tip ] A + @ 2:323a9c3ddd91 (draft) [tip ] A | o 0:d20a80d4def3 (draft) [ ] base $ hg incoming comparing with $TESTTMP/tmpe/repo-issue3805 (glob) searching for changes - 3:323a9c3ddd91 (draft) [tip ] A + 2:323a9c3ddd91 (draft) [tip ] A $ hg incoming --bundle ../issue3805.hg comparing with $TESTTMP/tmpe/repo-issue3805 (glob) searching for changes - 3:323a9c3ddd91 (draft) [tip ] A + 2:323a9c3ddd91 (draft) [tip ] A $ hg outgoing comparing with $TESTTMP/tmpe/repo-issue3805 (glob) searching for changes @@ -1078,7 +1078,7 @@ adding manifests adding file changes added 2 changesets with 2 changes to 2 files - 2 new obsolescence markers + 1 new obsolescence markers $ hg out ../repo-issue3814 comparing with ../repo-issue3814 searching for changes @@ -1089,7 +1089,7 @@ $ hg tag -l visible -r 1 --hidden $ hg log -G - @ 3:323a9c3ddd91 (draft) [tip ] A + @ 2:323a9c3ddd91 (draft) [tip ] A | | x 1:29f0c6921ddd (draft *obsolete*) [visible ] A |/ @@ -1099,8 +1099,8 @@ $ hg tag -l -r tip tiptag $ hg tags - tiptag 3:323a9c3ddd91 - tip 3:323a9c3ddd91 + tiptag 2:323a9c3ddd91 + tip 2:323a9c3ddd91 visible 1:29f0c6921ddd $ hg --config extensions.strip= strip -r tip --no-backup 0 files updated, 0 files merged, 1 files removed, 0 files unresolved @@ -1142,10 +1142,8 @@ $ echo "B+" >> foo $ hg ci --amend -m "B+" $ hg log -G --hidden - @ 3:b7d587542d40 (draft) [tip ] B+ + @ 2:b7d587542d40 (draft) [tip ] B+ | - | x 2:eb95e9297e18 (draft *obsolete*) [ ] temporary amend commit for 44526ebb0f98 - | | | x 1:44526ebb0f98 (draft *obsolete*) [ ] B |/ o 0:4b34ecfb0d56 (draft) [ ] A @@ -1157,9 +1155,9 @@ 1:44526ebb0f98 (draft) [ ] B 2:c186d7714947 (draft) [tip ] C $ hg log -G -R ../bundleoverlay.hg - o 4:c186d7714947 (draft) [tip ] C + o 3:c186d7714947 (draft) [tip ] C | - | @ 3:b7d587542d40 (draft) [ ] B+ + | @ 2:b7d587542d40 (draft) [ ] B+ |/ o 0:4b34ecfb0d56 (draft) [ ] A @@ -1234,7 +1232,7 @@ 0 files updated, 0 files merged, 1 files removed, 0 files unresolved $ echo aa > a $ hg amendtransient - [1, 3] + [1, 2] Test cache consistency for the visible filter 1) We want to make sure that the cached filtered revs are invalidated when @@ -1275,7 +1273,7 @@ $ hg commit --amend -m "message" $ hg book bookb -r 13bedc178fce --hidden $ hg log -r 13bedc178fce - 5:13bedc178fce (draft *obsolete*) [ bookb] add b + 4:13bedc178fce (draft *obsolete*) [ bookb] add b $ hg book -d bookb $ hg log -r 13bedc178fce abort: hidden revision '13bedc178fce'! @@ -1306,17 +1304,15 @@ $ echo bar > f2 $ hg commit --amend --config experimetnal.stabilization=createmarkers $ hg log -G - @ 4:b0551702f918 (draft) [tip ] 2 + @ 3:b0551702f918 (draft) [tip ] 2 | o 1:e016b03fd86f (draft) [ ] 1 | o 0:a78f55e5508c (draft) [ ] 0 $ hg log -G --hidden - @ 4:b0551702f918 (draft) [tip ] 2 + @ 3:b0551702f918 (draft) [tip ] 2 | - | x 3:f27abbcc1f77 (draft *obsolete*) [ ] temporary amend commit for e008cf283490 - | | | x 2:e008cf283490 (draft *obsolete*) [ ] 2 |/ o 1:e016b03fd86f (draft) [ ] 1 @@ -1325,10 +1321,9 @@ $ hg strip --hidden -r 2 --config extensions.strip= --config devel.strip-obsmarkers=no - saved backup bundle to $TESTTMP/tmpe/issue4845/.hg/strip-backup/e008cf283490-39c978dc-backup.hg (glob) + saved backup bundle to $TESTTMP/tmpe/issue4845/.hg/strip-backup/e008cf283490-ede36964-backup.hg (glob) $ hg debugobsolete e008cf2834908e5d6b0f792a9d4b0e2272260fb8 b0551702f918510f01ae838ab03a463054c67b46 0 (*) {'user': 'test'} (glob) - f27abbcc1f77fb409cf9160482fe619541e2d605 0 {e008cf2834908e5d6b0f792a9d4b0e2272260fb8} (*) {'user': 'test'} (glob) $ hg log -G @ 2:b0551702f918 (draft) [tip ] 2 | @@ -1345,22 +1340,17 @@ $ hg debugbundle .hg/strip-backup/e008cf283490-*-backup.hg Stream params: {Compression: BZ} - changegroup -- {nbchanges: 2, version: 02} + changegroup -- {nbchanges: 1, version: 02} e008cf2834908e5d6b0f792a9d4b0e2272260fb8 - f27abbcc1f77fb409cf9160482fe619541e2d605 - obsmarkers -- {} - version: 1 (70 bytes) - f27abbcc1f77fb409cf9160482fe619541e2d605 0 {e008cf2834908e5d6b0f792a9d4b0e2272260fb8} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} phase-heads -- {} - f27abbcc1f77fb409cf9160482fe619541e2d605 draft + e008cf2834908e5d6b0f792a9d4b0e2272260fb8 draft $ hg pull .hg/strip-backup/e008cf283490-*-backup.hg - pulling from .hg/strip-backup/e008cf283490-39c978dc-backup.hg + pulling from .hg/strip-backup/e008cf283490-ede36964-backup.hg searching for changes no changes found $ hg debugobsolete e008cf2834908e5d6b0f792a9d4b0e2272260fb8 b0551702f918510f01ae838ab03a463054c67b46 0 (*) {'user': 'test'} (glob) - f27abbcc1f77fb409cf9160482fe619541e2d605 0 {e008cf2834908e5d6b0f792a9d4b0e2272260fb8} (*) {'user': 'test'} (glob) $ hg log -G @ 2:b0551702f918 (draft) [tip ] 2 | @@ -1394,9 +1384,8 @@ e016b03fd86fcccc54817d120b90b751aaf367d6 b0551702f918510f01ae838ab03a463054c67b46 obsmarkers -- {} - version: 1 (139 bytes) + version: 1 (70 bytes) e008cf2834908e5d6b0f792a9d4b0e2272260fb8 b0551702f918510f01ae838ab03a463054c67b46 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} - f27abbcc1f77fb409cf9160482fe619541e2d605 0 {e008cf2834908e5d6b0f792a9d4b0e2272260fb8} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} phase-heads -- {} b0551702f918510f01ae838ab03a463054c67b46 draft @@ -1405,11 +1394,10 @@ adding manifests adding file changes added 2 changesets with 2 changes to 2 files - 2 new obsolescence markers + 1 new obsolescence markers (run 'hg update' to get a working copy) $ hg debugobsolete | sort e008cf2834908e5d6b0f792a9d4b0e2272260fb8 b0551702f918510f01ae838ab03a463054c67b46 0 (*) {'user': 'test'} (glob) - f27abbcc1f77fb409cf9160482fe619541e2d605 0 {e008cf2834908e5d6b0f792a9d4b0e2272260fb8} (*) {'user': 'test'} (glob) $ hg log -G o 2:b0551702f918 (draft) [tip ] 2 | diff --git a/tests/test-rebase-obsolete.t b/tests/test-rebase-obsolete.t --- a/tests/test-rebase-obsolete.t +++ b/tests/test-rebase-obsolete.t @@ -626,11 +626,11 @@ $ hg add M $ hg commit --amend -m "M" $ hg log -G - @ 20:bfaedf8eb73b M + @ 18:bfaedf8eb73b M | - | o 18:97219452e4bd L + | o 17:97219452e4bd L | | - | x 17:fc37a630c901 K + | x 16:fc37a630c901 K |/ | o 15:5ae8a643467b J | | @@ -660,8 +660,8 @@ |/ o 0:cd010b8cd998 A - $ hg rebase -s 14 -d 18 --config experimental.rebaseskipobsolete=True - note: not rebasing 14:9ad579b4a5de "I", already in destination as 17:fc37a630c901 "K" + $ hg rebase -s 14 -d 17 --config experimental.rebaseskipobsolete=True + note: not rebasing 14:9ad579b4a5de "I", already in destination as 16:fc37a630c901 "K" rebasing 15:5ae8a643467b "J" $ cd .. @@ -797,9 +797,9 @@ $ hg add foo $ hg commit -m "bar foo" $ hg log -G - @ 15:73568ab6879d bar foo + @ 14:73568ab6879d bar foo | - | o 14:77d874d096a2 10' + | o 13:77d874d096a2 10' | | | | o 12:3eb461388009 john doe | |/ @@ -814,7 +814,7 @@ o 0:4a2df7238c3b A $ hg summary - parent: 15:73568ab6879d tip (orphan) + parent: 14:73568ab6879d tip (orphan) bar foo branch: default commit: (clean) @@ -826,9 +826,9 @@ (to force the rebase please set experimental.allowdivergence=True) [255] $ hg log -G - @ 15:73568ab6879d bar foo + @ 14:73568ab6879d bar foo | - | o 14:77d874d096a2 10' + | o 13:77d874d096a2 10' | | | | o 12:3eb461388009 john doe | |/ @@ -846,9 +846,9 @@ $ hg rebase -s 10 -d 12 --config experimental.allowdivergence=True rebasing 10:121d9e3bc4c6 "P" - rebasing 15:73568ab6879d "bar foo" (tip) + rebasing 14:73568ab6879d "bar foo" (tip) $ hg summary - parent: 17:61bd55f69bc4 tip + parent: 16:61bd55f69bc4 tip bar foo branch: default commit: (clean) @@ -859,8 +859,8 @@ rebase --continue + skipped rev because their successors are in destination we make a change in trunk and work on conflicting changes to make rebase abort. - $ hg log -G -r 17:: - @ 17:61bd55f69bc4 bar foo + $ hg log -G -r 16:: + @ 16:61bd55f69bc4 bar foo | ~ @@ -873,7 +873,7 @@ $ hg commit -m "dummy change successor" Create the changes that we will rebase - $ hg update -C 17 -q + $ hg update -C 16 -q $ printf "b" > willconflict $ hg add willconflict $ hg commit -m "willconflict second version" @@ -884,25 +884,25 @@ $ printf "dummy" > L $ hg add L $ hg commit -m "dummy change" - $ hg debugobsolete `hg log -r ".^" -T '{node}'` `hg log -r 19 -T '{node}'` --config experimental.stabilization=all + $ hg debugobsolete `hg log -r ".^" -T '{node}'` `hg log -r 18 -T '{node}'` --config experimental.stabilization=all obsoleted 1 changesets - $ hg log -G -r 17:: - @ 22:7bdc8a87673d dummy change + $ hg log -G -r 16:: + @ 21:7bdc8a87673d dummy change | - x 21:8b31da3c4919 dummy change + x 20:8b31da3c4919 dummy change | - o 20:b82fb57ea638 willconflict second version + o 19:b82fb57ea638 willconflict second version | - | o 19:601db7a18f51 dummy change successor + | o 18:601db7a18f51 dummy change successor | | - | o 18:357ddf1602d5 willconflict first version + | o 17:357ddf1602d5 willconflict first version |/ - o 17:61bd55f69bc4 bar foo + o 16:61bd55f69bc4 bar foo | ~ - $ hg rebase -r ".^^ + .^ + ." -d 19 - rebasing 20:b82fb57ea638 "willconflict second version" + $ hg rebase -r ".^^ + .^ + ." -d 18 + rebasing 19:b82fb57ea638 "willconflict second version" merging willconflict warning: conflicts while merging willconflict! (edit, then use 'hg resolve --mark') unresolved conflicts (see hg resolve, then hg rebase --continue) @@ -912,9 +912,9 @@ (no more unresolved files) continue: hg rebase --continue $ hg rebase --continue - rebasing 20:b82fb57ea638 "willconflict second version" - note: not rebasing 21:8b31da3c4919 "dummy change", already in destination as 19:601db7a18f51 "dummy change successor" - rebasing 22:7bdc8a87673d "dummy change" (tip) + rebasing 19:b82fb57ea638 "willconflict second version" + note: not rebasing 20:8b31da3c4919 "dummy change", already in destination as 18:601db7a18f51 "dummy change successor" + rebasing 21:7bdc8a87673d "dummy change" (tip) $ cd .. Rebase merge where successor of one parent is equal to destination (issue5198) diff --git a/tests/test-treemanifest.t b/tests/test-treemanifest.t --- a/tests/test-treemanifest.t +++ b/tests/test-treemanifest.t @@ -862,7 +862,7 @@ $ hg commit -Aqm 'pre-empty commit' $ hg rm z $ hg commit --amend -m 'empty commit' - saved backup bundle to $TESTTMP/grafted-dir-repo-clone/.hg/strip-backup/cb99d5717cea-de37743b-amend.hg (glob) + saved backup bundle to $TESTTMP/grafted-dir-repo-clone/.hg/strip-backup/cb99d5717cea-9e3b6b02-amend.hg (glob) $ hg log -r 'tip + tip^' -T '{manifest}\n' 1:678d3574b88c 1:678d3574b88c