Show More
@@ -1,132 +1,134 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 | > [(b'', b'drop', False, b'drop file from dirstate', b'FILE'), |
|
7 | > [(b'', b'drop', False, b'drop file from dirstate', b'FILE'), | |
8 | > (b'', b'normal-lookup', False, b'add file to dirstate', b'FILE')], |
|
8 | > (b'', b'normal-lookup', False, b'add file to dirstate', b'FILE')], | |
9 | > b'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 | > with repo.dirstate.parentchange(): |
|
20 | > with repo.dirstate.parentchange(): | |
21 | > repo.dirstate.update_file( |
|
21 | > repo.dirstate.update_file( | |
22 | > file, |
|
22 | > file, | |
23 | > p1_tracked=True, |
|
23 | > p1_tracked=True, | |
24 | > wc_tracked=True, |
|
24 | > wc_tracked=True, | |
25 | > possibly_dirty=True, |
|
25 | > possibly_dirty=True, | |
26 | > ) |
|
26 | > ) | |
27 | > else: |
|
27 | > else: | |
28 | > repo.dirstate._map.reset_state(file) |
|
28 | > repo.dirstate._map.reset_state(file) | |
29 | > repo.dirstate._dirty = True |
|
29 | > repo.dirstate._dirty = True | |
30 | > |
|
30 | > | |
31 | > repo.dirstate.write(repo.currenttransaction()) |
|
31 | > repo.dirstate.write(repo.currenttransaction()) | |
32 | > finally: |
|
32 | > finally: | |
33 | > wlock.release() |
|
33 | > wlock.release() | |
34 | > EOF |
|
34 | > EOF | |
35 |
|
35 | |||
36 | $ echo "[extensions]" >> $HGRCPATH |
|
36 | $ echo "[extensions]" >> $HGRCPATH | |
37 | $ echo "debugadddrop=`pwd`/adddrop.py" >> $HGRCPATH |
|
37 | $ echo "debugadddrop=`pwd`/adddrop.py" >> $HGRCPATH | |
38 |
|
38 | |||
39 | basic test for hg debugrebuildstate |
|
39 | basic test for hg debugrebuildstate | |
40 |
|
40 | |||
41 | $ hg init repo |
|
41 | $ hg init repo | |
42 | $ cd repo |
|
42 | $ cd repo | |
43 |
|
43 | |||
44 | $ touch foo bar |
|
44 | $ touch foo bar | |
45 | $ hg ci -Am 'add foo bar' |
|
45 | $ hg ci -Am 'add foo bar' | |
46 | adding bar |
|
46 | adding bar | |
47 | adding foo |
|
47 | adding foo | |
48 |
|
48 | |||
49 | $ touch baz |
|
49 | $ touch baz | |
50 | $ hg add baz |
|
50 | $ hg add baz | |
51 | $ hg rm bar |
|
51 | $ hg rm bar | |
52 |
|
52 | |||
53 | $ hg debugrebuildstate |
|
53 | $ hg debugrebuildstate | |
54 |
|
54 | |||
55 | state dump after |
|
55 | state dump after | |
56 |
|
56 | |||
57 | $ hg debugstate --no-dates | sort |
|
57 | $ hg debugstate --no-dates | sort | |
58 | n 0 -1 unset bar |
|
58 | n 0 -1 unset bar | |
59 | n 0 -1 unset foo |
|
59 | n 0 -1 unset foo | |
60 |
|
60 | |||
61 | $ hg debugadddrop --normal-lookup file1 file2 |
|
61 | $ hg debugadddrop --normal-lookup file1 file2 | |
62 | $ hg debugadddrop --drop bar |
|
62 | $ hg debugadddrop --drop bar | |
63 | $ hg debugadddrop --drop |
|
63 | $ hg debugadddrop --drop | |
64 | $ hg debugstate --no-dates |
|
64 | $ hg debugstate --no-dates | |
65 | n 0 -1 unset file1 |
|
65 | n 0 -1 unset file1 | |
66 | n 0 -1 unset file2 |
|
66 | n 0 -1 unset file2 | |
67 | n 0 -1 unset foo |
|
67 | n 0 -1 unset foo | |
68 | $ hg debugrebuildstate |
|
68 | $ hg debugrebuildstate | |
69 |
|
69 | |||
70 | status |
|
70 | status | |
71 |
|
71 | |||
72 | $ hg st -A |
|
72 | $ hg st -A | |
73 | ! bar |
|
73 | ! bar | |
74 | ? baz |
|
74 | ? baz | |
75 | C foo |
|
75 | C foo | |
76 |
|
76 | |||
77 | Test debugdirstate --minimal where a file is not in parent manifest |
|
77 | Test debugdirstate --minimal where a file is not in parent manifest | |
78 | but in the dirstate |
|
78 | but in the dirstate | |
79 | $ touch foo bar qux |
|
79 | $ touch foo bar qux | |
80 | $ hg add qux |
|
80 | $ hg add qux | |
81 | $ hg remove bar |
|
81 | $ hg remove bar | |
|
82 | $ sleep 1 # remove potential ambiguity in mtime | |||
82 | $ hg status -A |
|
83 | $ hg status -A | |
83 | A qux |
|
84 | A qux | |
84 | R bar |
|
85 | R bar | |
85 | ? baz |
|
86 | ? baz | |
86 | C foo |
|
87 | C foo | |
87 | $ hg debugadddrop --normal-lookup baz |
|
88 | $ hg debugadddrop --normal-lookup baz | |
88 | $ hg debugdirstate --no-dates |
|
89 | $ hg debugdirstate --no-dates | |
89 | r 0 0 * bar (glob) |
|
90 | r 0 0 * bar (glob) | |
90 | n 0 -1 * baz (glob) |
|
91 | n 0 -1 * baz (glob) | |
91 | n 644 0 * foo (glob) |
|
92 | n 644 0 * foo (glob) | |
92 | a 0 -1 * qux (glob) |
|
93 | a 0 -1 * qux (glob) | |
93 | $ hg debugrebuilddirstate --minimal |
|
94 | $ hg debugrebuilddirstate --minimal | |
94 | $ hg debugdirstate --no-dates |
|
95 | $ hg debugdirstate --no-dates | |
95 | r 0 0 * bar (glob) |
|
96 | r 0 0 * bar (glob) | |
96 | n 644 0 * foo (glob) |
|
97 | n 644 0 * foo (glob) | |
97 | a 0 -1 * qux (glob) |
|
98 | a 0 -1 * qux (glob) | |
98 | $ hg status -A |
|
99 | $ hg status -A | |
99 | A qux |
|
100 | A qux | |
100 | R bar |
|
101 | R bar | |
101 | ? baz |
|
102 | ? baz | |
102 | C foo |
|
103 | C foo | |
103 |
|
104 | |||
104 | Test debugdirstate --minimal where file is in the parent manifest but not the |
|
105 | Test debugdirstate --minimal where file is in the parent manifest but not the | |
105 | dirstate |
|
106 | dirstate | |
106 | $ hg manifest |
|
107 | $ hg manifest | |
107 | bar |
|
108 | bar | |
108 | foo |
|
109 | foo | |
|
110 | $ sleep 1 # remove potential ambiguity in mtime | |||
109 | $ hg status -A |
|
111 | $ hg status -A | |
110 | A qux |
|
112 | A qux | |
111 | R bar |
|
113 | R bar | |
112 | ? baz |
|
114 | ? baz | |
113 | C foo |
|
115 | C foo | |
114 | $ hg debugdirstate --no-dates |
|
116 | $ hg debugdirstate --no-dates | |
115 | r 0 0 * bar (glob) |
|
117 | r 0 0 * bar (glob) | |
116 | n 644 0 * foo (glob) |
|
118 | n 644 0 * foo (glob) | |
117 | a 0 -1 * qux (glob) |
|
119 | a 0 -1 * qux (glob) | |
118 | $ hg debugadddrop --drop foo |
|
120 | $ hg debugadddrop --drop foo | |
119 | $ hg debugdirstate --no-dates |
|
121 | $ hg debugdirstate --no-dates | |
120 | r 0 0 * bar (glob) |
|
122 | r 0 0 * bar (glob) | |
121 | a 0 -1 * qux (glob) |
|
123 | a 0 -1 * qux (glob) | |
122 | $ hg debugrebuilddirstate --minimal |
|
124 | $ hg debugrebuilddirstate --minimal | |
123 | $ hg debugdirstate --no-dates |
|
125 | $ hg debugdirstate --no-dates | |
124 | r 0 0 * bar (glob) |
|
126 | r 0 0 * bar (glob) | |
125 | n 0 -1 * foo (glob) |
|
127 | n 0 -1 * foo (glob) | |
126 | a 0 -1 * qux (glob) |
|
128 | a 0 -1 * qux (glob) | |
127 | $ hg status -A |
|
129 | $ hg status -A | |
128 | A qux |
|
130 | A qux | |
129 | R bar |
|
131 | R bar | |
130 | ? baz |
|
132 | ? baz | |
131 | C foo |
|
133 | C foo | |
132 |
|
134 |
General Comments 0
You need to be logged in to leave comments.
Login now