contrib/debugshell.py
author Patrick Mezard <patrick@mezard.eu>
Wed, 18 Apr 2012 14:04:58 +0200
branchstable
changeset 16466 c53a49c345e1
parent 11633 6b7b99867ada
child 19771 3bc675361206
permissions -rw-r--r--
convert/svn: do not try converting empty head revisions (issue3347) Subversion conversion works by picking trunk and branches heads, computing a revision graph from them and converting the selected commits. By design we fail to convert empty revisions so we have to be careful when discovering the revision graph. In this particular issue, the source svn repository was a partial mirror made by svnsync. The funny part is svnsync preserves all revisions including empty ones. Also, we trusted ra.stat(path, stop).created_rev to give us the latest revision with changes in path history up to stop. This assumption broke at least when path is '', that is the repository root, which always returned 'stop' revision despited being empty. The workaround is to first trust ra.stat() but if the returned revision appear empty, search the whole path history from stop to r1 until some changes are found.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
11633
6b7b99867ada contrib: add debugshell extension
Vishakh H <vsh426@gmail.com>
parents:
diff changeset
     1
# debugshell extension
6b7b99867ada contrib: add debugshell extension
Vishakh H <vsh426@gmail.com>
parents:
diff changeset
     2
"""a python shell with repo, changelog & manifest objects"""
6b7b99867ada contrib: add debugshell extension
Vishakh H <vsh426@gmail.com>
parents:
diff changeset
     3
6b7b99867ada contrib: add debugshell extension
Vishakh H <vsh426@gmail.com>
parents:
diff changeset
     4
import mercurial
6b7b99867ada contrib: add debugshell extension
Vishakh H <vsh426@gmail.com>
parents:
diff changeset
     5
import code
6b7b99867ada contrib: add debugshell extension
Vishakh H <vsh426@gmail.com>
parents:
diff changeset
     6
6b7b99867ada contrib: add debugshell extension
Vishakh H <vsh426@gmail.com>
parents:
diff changeset
     7
def debugshell(ui, repo, **opts):
6b7b99867ada contrib: add debugshell extension
Vishakh H <vsh426@gmail.com>
parents:
diff changeset
     8
    objects = {
6b7b99867ada contrib: add debugshell extension
Vishakh H <vsh426@gmail.com>
parents:
diff changeset
     9
        'mercurial': mercurial,
6b7b99867ada contrib: add debugshell extension
Vishakh H <vsh426@gmail.com>
parents:
diff changeset
    10
        'repo': repo,
6b7b99867ada contrib: add debugshell extension
Vishakh H <vsh426@gmail.com>
parents:
diff changeset
    11
        'cl': repo.changelog,
6b7b99867ada contrib: add debugshell extension
Vishakh H <vsh426@gmail.com>
parents:
diff changeset
    12
        'mf': repo.manifest,
6b7b99867ada contrib: add debugshell extension
Vishakh H <vsh426@gmail.com>
parents:
diff changeset
    13
    }
6b7b99867ada contrib: add debugshell extension
Vishakh H <vsh426@gmail.com>
parents:
diff changeset
    14
    bannermsg = "loaded repo : %s\n" \
6b7b99867ada contrib: add debugshell extension
Vishakh H <vsh426@gmail.com>
parents:
diff changeset
    15
                "using source: %s" % (repo.root,
6b7b99867ada contrib: add debugshell extension
Vishakh H <vsh426@gmail.com>
parents:
diff changeset
    16
                                      mercurial.__path__[0])
6b7b99867ada contrib: add debugshell extension
Vishakh H <vsh426@gmail.com>
parents:
diff changeset
    17
    code.interact(bannermsg, local=objects)
6b7b99867ada contrib: add debugshell extension
Vishakh H <vsh426@gmail.com>
parents:
diff changeset
    18
6b7b99867ada contrib: add debugshell extension
Vishakh H <vsh426@gmail.com>
parents:
diff changeset
    19
cmdtable = {
6b7b99867ada contrib: add debugshell extension
Vishakh H <vsh426@gmail.com>
parents:
diff changeset
    20
    "debugshell|dbsh": (debugshell, [])
6b7b99867ada contrib: add debugshell extension
Vishakh H <vsh426@gmail.com>
parents:
diff changeset
    21
}