https://bz.mercurial-scm.org/show_bug.cgi?id=5368

            Bug ID: 5368
           Summary: hard to recover when hook interrupts strip
           Product: Mercurial
           Version: default branch
          Hardware: PC
                OS: Linux
            Status: UNCONFIRMED
          Severity: feature
          Priority: wish
         Component: strip
          Assignee: bugzi...@selenic.com
          Reporter: martinv...@google.com
                CC: mercurial-de...@selenic.com

The script below creates two sibling commits (1 and 2) both parented to another
commit (0). It then strips commit 1, which means that it will attempt to put 2
in a bundle, then strip 1, then unbundle 2. However, since the
pretxnchangegroup fails, that will not happen, and the repository is left with
only commit 0 and the dirstate parent still pointing to the bundled commit 2.
Output will be something like this:

saved backup bundle to $repo/.hg/strip-backup/5b7008f9d916-f6770a54-backup.hg
transaction abort!
rollback completed
strip failed, full bundle stored in
'$repo/.hg/strip-backup/5b7008f9d916-f6770a54-backup.hg'
abort: pretxnchangegroup.bad hook exited with status 1
warning: ignoring unknown working parent c8df5b14b02e!

It mentions the same bundle twice, but that's a backup of the stripped 1 that
the user did not want. That's fine to mention, but it's more important to
mention the bundled 2 that the user wanted to keep. Fortunately, that bundle
does exist, so as long as the user knows to look for it, there's nothing lost.

Here's the script:
hg init strip-bug
cd strip-bug
echo a > a
hg add a
hg ci -m a
echo b > b
hg add b
hg ci -m b
hg co .^
echo c > c
hg add c
hg ci -m c
hg log -G
hg strip 1 --config hooks.pretxnchangegroup.bad=false --debug
hg log -G

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to