##// END OF EJS Templates
py3: add b'' prefixes in tests/test-rebuildstate.t...
Pulkit Goyal -
r38088:74c5ddd9 default
parent child Browse files
Show More
@@ -1,125 +1,125 b''
1
1
2 $ cat > adddrop.py <<EOF
2 $ cat > adddrop.py <<EOF
3 > from mercurial import registrar
3 > from mercurial import registrar
4 > cmdtable = {}
4 > cmdtable = {}
5 > command = registrar.command(cmdtable)
5 > command = registrar.command(cmdtable)
6 > @command(b'debugadddrop',
6 > @command(b'debugadddrop',
7 > [('', 'drop', False, 'drop file from dirstate', 'FILE'),
7 > [(b'', b'drop', False, b'drop file from dirstate', b'FILE'),
8 > ('', 'normal-lookup', False, 'add file to dirstate', 'FILE')],
8 > (b'', b'normal-lookup', False, b'add file to dirstate', b'FILE')],
9 > 'hg debugadddrop')
9 > b'hg debugadddrop')
10 > def debugadddrop(ui, repo, *pats, **opts):
10 > def debugadddrop(ui, repo, *pats, **opts):
11 > '''Add or drop unnamed arguments to or from the dirstate'''
11 > '''Add or drop unnamed arguments to or from the dirstate'''
12 > drop = opts.get('drop')
12 > drop = opts.get('drop')
13 > nl = opts.get('normal_lookup')
13 > nl = opts.get('normal_lookup')
14 > if nl and drop:
14 > if nl and drop:
15 > raise error.Abort('drop and normal-lookup are mutually exclusive')
15 > raise error.Abort('drop and normal-lookup are mutually exclusive')
16 > wlock = repo.wlock()
16 > wlock = repo.wlock()
17 > try:
17 > try:
18 > for file in pats:
18 > for file in pats:
19 > if opts.get('normal_lookup'):
19 > if opts.get('normal_lookup'):
20 > repo.dirstate.normallookup(file)
20 > repo.dirstate.normallookup(file)
21 > else:
21 > else:
22 > repo.dirstate.drop(file)
22 > repo.dirstate.drop(file)
23 >
23 >
24 > repo.dirstate.write(repo.currenttransaction())
24 > repo.dirstate.write(repo.currenttransaction())
25 > finally:
25 > finally:
26 > wlock.release()
26 > wlock.release()
27 > EOF
27 > EOF
28
28
29 $ echo "[extensions]" >> $HGRCPATH
29 $ echo "[extensions]" >> $HGRCPATH
30 $ echo "debugadddrop=`pwd`/adddrop.py" >> $HGRCPATH
30 $ echo "debugadddrop=`pwd`/adddrop.py" >> $HGRCPATH
31
31
32 basic test for hg debugrebuildstate
32 basic test for hg debugrebuildstate
33
33
34 $ hg init repo
34 $ hg init repo
35 $ cd repo
35 $ cd repo
36
36
37 $ touch foo bar
37 $ touch foo bar
38 $ hg ci -Am 'add foo bar'
38 $ hg ci -Am 'add foo bar'
39 adding bar
39 adding bar
40 adding foo
40 adding foo
41
41
42 $ touch baz
42 $ touch baz
43 $ hg add baz
43 $ hg add baz
44 $ hg rm bar
44 $ hg rm bar
45
45
46 $ hg debugrebuildstate
46 $ hg debugrebuildstate
47
47
48 state dump after
48 state dump after
49
49
50 $ hg debugstate --nodates | sort
50 $ hg debugstate --nodates | sort
51 n 0 -1 unset bar
51 n 0 -1 unset bar
52 n 0 -1 unset foo
52 n 0 -1 unset foo
53
53
54 $ hg debugadddrop --normal-lookup file1 file2
54 $ hg debugadddrop --normal-lookup file1 file2
55 $ hg debugadddrop --drop bar
55 $ hg debugadddrop --drop bar
56 $ hg debugadddrop --drop
56 $ hg debugadddrop --drop
57 $ hg debugstate --nodates
57 $ hg debugstate --nodates
58 n 0 -1 unset file1
58 n 0 -1 unset file1
59 n 0 -1 unset file2
59 n 0 -1 unset file2
60 n 0 -1 unset foo
60 n 0 -1 unset foo
61 $ hg debugrebuildstate
61 $ hg debugrebuildstate
62
62
63 status
63 status
64
64
65 $ hg st -A
65 $ hg st -A
66 ! bar
66 ! bar
67 ? baz
67 ? baz
68 C foo
68 C foo
69
69
70 Test debugdirstate --minimal where a file is not in parent manifest
70 Test debugdirstate --minimal where a file is not in parent manifest
71 but in the dirstate
71 but in the dirstate
72 $ touch foo bar qux
72 $ touch foo bar qux
73 $ hg add qux
73 $ hg add qux
74 $ hg remove bar
74 $ hg remove bar
75 $ hg status -A
75 $ hg status -A
76 A qux
76 A qux
77 R bar
77 R bar
78 ? baz
78 ? baz
79 C foo
79 C foo
80 $ hg debugadddrop --normal-lookup baz
80 $ hg debugadddrop --normal-lookup baz
81 $ hg debugdirstate --nodates
81 $ hg debugdirstate --nodates
82 r 0 0 * bar (glob)
82 r 0 0 * bar (glob)
83 n 0 -1 * baz (glob)
83 n 0 -1 * baz (glob)
84 n 644 0 * foo (glob)
84 n 644 0 * foo (glob)
85 a 0 -1 * qux (glob)
85 a 0 -1 * qux (glob)
86 $ hg debugrebuilddirstate --minimal
86 $ hg debugrebuilddirstate --minimal
87 $ hg debugdirstate --nodates
87 $ hg debugdirstate --nodates
88 r 0 0 * bar (glob)
88 r 0 0 * bar (glob)
89 n 644 0 * foo (glob)
89 n 644 0 * foo (glob)
90 a 0 -1 * qux (glob)
90 a 0 -1 * qux (glob)
91 $ hg status -A
91 $ hg status -A
92 A qux
92 A qux
93 R bar
93 R bar
94 ? baz
94 ? baz
95 C foo
95 C foo
96
96
97 Test debugdirstate --minimal where file is in the parent manifest but not the
97 Test debugdirstate --minimal where file is in the parent manifest but not the
98 dirstate
98 dirstate
99 $ hg manifest
99 $ hg manifest
100 bar
100 bar
101 foo
101 foo
102 $ hg status -A
102 $ hg status -A
103 A qux
103 A qux
104 R bar
104 R bar
105 ? baz
105 ? baz
106 C foo
106 C foo
107 $ hg debugdirstate --nodates
107 $ hg debugdirstate --nodates
108 r 0 0 * bar (glob)
108 r 0 0 * bar (glob)
109 n 644 0 * foo (glob)
109 n 644 0 * foo (glob)
110 a 0 -1 * qux (glob)
110 a 0 -1 * qux (glob)
111 $ hg debugadddrop --drop foo
111 $ hg debugadddrop --drop foo
112 $ hg debugdirstate --nodates
112 $ hg debugdirstate --nodates
113 r 0 0 * bar (glob)
113 r 0 0 * bar (glob)
114 a 0 -1 * qux (glob)
114 a 0 -1 * qux (glob)
115 $ hg debugrebuilddirstate --minimal
115 $ hg debugrebuilddirstate --minimal
116 $ hg debugdirstate --nodates
116 $ hg debugdirstate --nodates
117 r 0 0 * bar (glob)
117 r 0 0 * bar (glob)
118 n 0 -1 * foo (glob)
118 n 0 -1 * foo (glob)
119 a 0 -1 * qux (glob)
119 a 0 -1 * qux (glob)
120 $ hg status -A
120 $ hg status -A
121 A qux
121 A qux
122 R bar
122 R bar
123 ? baz
123 ? baz
124 C foo
124 C foo
125
125
General Comments 0
You need to be logged in to leave comments. Login now