##// END OF EJS Templates
debugdirstate: add command to rebuildstate test to modify dirstate...
Christian Delahousse -
r27174:9fbe3545 default
parent child Browse files
Show More
@@ -1,3 +1,34 b''
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 basic test for hg debugrebuildstate
32 basic test for hg debugrebuildstate
2
33
3 $ hg init repo
34 $ hg init repo
@@ -20,6 +51,15 b' state dump after'
20 n 644 -1 set bar
51 n 644 -1 set bar
21 n 644 -1 set foo
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 status
63 status
24
64
25 $ hg st -A
65 $ hg st -A
General Comments 0
You need to be logged in to leave comments. Login now