contrib/debugshell.py
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
Tue, 01 Oct 2013 00:35:07 +0900
branchstable
changeset 19847 45c3086880c7
parent 11633 6b7b99867ada
child 19771 3bc675361206
permissions -rw-r--r--
histedit: suggest "histedit --abort" for inconsistent histedit state Mercurial earlier than 2.7 allows users to do anything other than starting new histedit, even though current histedit is not finished or aborted yet. So, unfinished (and maybe inconsistent now) histedit states may be left and forgotten in repositories. Before this patch, histedit extension shows the message below, when it detects such inconsistent state: abort: REV is not an ancestor of working directory (update to REV or descendant and run "hg histedit --continue" again) But this message is incorrect, unless old Mercurial is re-installed, because Mercurial 2.7 or later disallows users to update the working directory to another revision. This patch changes the hint message to suggest "hg histedit --abort".
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
}