Help with my first extension

illusory illusory2 at yahoo.co.uk
Sun Sep 11 07:14:58 CDT 2011


> The problem is that the "repair.strip" line is causing my working directory to
> update to revision -1.  Here is the interaction with Mercurial:
> 
>     http://paste.pocoo.org/show/Ly90GIfMUvE5TEOVdR1G/
> 
> How do I stop this unknown-working-parent problem from happening?

Okay, I fixed this problem.  I had to call repo.dirstate.setparents:

    toprevision = repo.dirstate.p1()
    parent = repo[toprevision].parents()[0]
    repo.dirstate.setparents(parent.node())

The new problem is that, after stripping, the files aren't showing as modified:

    c:\hgtest>hg init

    c:\hgtest>echo foo>foo

    c:\hgtest>hg ci -Am foo
    adding foo

    c:\hgtest>echo bar>>foo

    c:\hgtest>hg ci -m bar

    c:\hgtest>hg su
    parent: 1:43c6dd3b0318 tip
     bar
    branch: default
    commit: (clean)
    update: (current)

    c:\hgtest>hg checkpoint --finish

    c:\hgtest>hg su
    parent: 0:cfa18f2e3921 tip
     foo
    branch: default
    commit: (clean)
    update: (current)

    c:\hgtest>hg d

    c:\hgtest>type foo
    foo
    bar

    c:\hgtest>hg log -p
    changeset:   0:cfa18f2e3921
    tag:         tip
    user:        Tom
    date:        Sun Sep 11 13:10:38 2011 +0100
    summary:     foo

    diff --git a/foo b/foo
    new file mode 100644
    --- /dev/null
    +++ b/foo
    @@ -0,0 +1,1 @@
    +foo

When I say 'hg d', 'foo' should be showing as having a new line: "bar".



More information about the Mercurial-devel mailing list