Show More
@@ -1,3 +1,34 | |||
|
1 | ||
|
2 | $ cat > adddrop.py <<EOF | |
|
3 | > from mercurial import cmdutil | |
|
4 | > cmdtable = {} | |
|
5 | > command = cmdutil.command(cmdtable) | |
|
6 | > @command('debugadddrop', | |
|
7 | > [('', 'drop', False, 'drop file from dirstate', 'FILE'), | |
|
8 | > ('', 'normal-lookup', False, 'add file to dirstate', 'FILE')], | |
|
9 | > 'hg debugadddrop') | |
|
10 | > def debugadddrop(ui, repo, *pats, **opts): | |
|
11 | > '''Add or drop unnamed arguments to or from the dirstate''' | |
|
12 | > drop = opts.get('drop') | |
|
13 | > nl = opts.get('normal_lookup') | |
|
14 | > if nl and drop: | |
|
15 | > raise error.Abort('drop and normal-lookup are mutually exclusive') | |
|
16 | > wlock = repo.wlock() | |
|
17 | > try: | |
|
18 | > for file in pats: | |
|
19 | > if opts.get('normal_lookup'): | |
|
20 | > repo.dirstate.normallookup(file) | |
|
21 | > else: | |
|
22 | > repo.dirstate.drop(file) | |
|
23 | > | |
|
24 | > repo.dirstate.write(repo.currenttransaction()) | |
|
25 | > finally: | |
|
26 | > wlock.release() | |
|
27 | > EOF | |
|
28 | ||
|
29 | $ echo "[extensions]" >> $HGRCPATH | |
|
30 | $ echo "debugadddrop=`pwd`/adddrop.py" >> $HGRCPATH | |
|
31 | ||
|
1 | 32 | basic test for hg debugrebuildstate |
|
2 | 33 | |
|
3 | 34 | $ hg init repo |
@@ -20,6 +51,15 state dump after | |||
|
20 | 51 | n 644 -1 set bar |
|
21 | 52 | n 644 -1 set foo |
|
22 | 53 | |
|
54 | $ hg debugadddrop --normal-lookup file1 file2 | |
|
55 | $ hg debugadddrop --drop bar | |
|
56 | $ hg debugadddrop --drop | |
|
57 | $ hg debugstate --nodates | |
|
58 | n 0 -1 unset file1 | |
|
59 | n 0 -1 unset file2 | |
|
60 | n 644 -1 set foo | |
|
61 | $ hg debugrebuildstate | |
|
62 | ||
|
23 | 63 | status |
|
24 | 64 | |
|
25 | 65 | $ hg st -A |
General Comments 0
You need to be logged in to leave comments.
Login now