Odd edge case: recreating an obsolete changeset

Greg Ward greg at gerg.ca
Sat Apr 26 20:16:10 UTC 2014


While working on a test script for evolve, I discovered an interesting
edge case: if you commit a new changeset with the same changeset ID as
an obsolete changeset, weird stuff happens. Specifically, the commit
fails like this:

   $ hg commit -q -u user -d '1 0' -A -m modify
   abort: working directory has unknown parent '8021f364e2f7'!

but it appears to successfully re-create (and un-obsolete!) the
formerly obsolete changeset.

Here's a test script.

"""
create a new changeset with the same id as an obsolete one: uh-oh!
  $ cat >> $HGRCPATH <<EOF
  > [extensions]
  > rebase=
  > EOF
  $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext/evolve.py" >> $HGRCPATH
  $ hg init t
  $ cd t
  $ echo a > a
  $ hg commit -q -u user -d '0 0' -A -m init
  $ hg identify -in
  1c8870f327aa 0
  $ echo b > a
  $ hg commit -q -u user -d '1 0' -A -m modify
  $ hg identify -in
  8021f364e2f7 1
  $ hg prune -q 1
  $ hg log -q
  0:1c8870f327aa
  $ echo b > a
  $ hg commit -q -u user -d '1 0' -A -m modify
  $ hg identify -in
  8021f364e2f7 1
  $ hg log -q -G
  @  1:8021f364e2f7
  |
  o  0:1c8870f327aa
  
"""

It fails like this:

--- /home/greg/src/hg-evolve/tests/test-collision.t
+++ /home/greg/src/hg-evolve/tests/test-collision.t.err
@@ -19,6 +19,8 @@
   0:1c8870f327aa
   $ echo b > a
   $ hg commit -q -u user -d '1 0' -A -m modify
+  abort: working directory has unknown parent '8021f364e2f7'!
+  [255]
   $ hg identify -in
   8021f364e2f7 1
   $ hg log -q -G
!
Failed test-collision.t: output changed

       Greg
-- 
Greg Ward                            http://www.gerg.ca
<greg at gerg.ca>                       @gergdotca



More information about the Evolve-testers mailing list