Show More
@@ -0,0 +1,190 b'' | |||||
|
1 | ===================================================================== | |||
|
2 | Check potential race conditions between a status and other operations | |||
|
3 | ===================================================================== | |||
|
4 | ||||
|
5 | The `hg status` command can run without the wlock, however it might end up | |||
|
6 | having to update the on-disk dirstate files, for example to mark ambiguous | |||
|
7 | files as clean, or to update directory caches information with dirstate-v2. | |||
|
8 | ||||
|
9 | ||||
|
10 | If another process updates the dirstate in the meantime we might run into | |||
|
11 | trouble. Especially, commands doing semantic changes like `hg add` or | |||
|
12 | `hg commit` should not see their update erased by a concurrent status. | |||
|
13 | ||||
|
14 | Unlike commands like `add` or `commit`, `status` only writes the dirstate | |||
|
15 | to update caches, no actual information is lost if we fail to write to disk. | |||
|
16 | ||||
|
17 | ||||
|
18 | This test file is meant to test various cases where such parallel operations | |||
|
19 | between a status with reasons to update the dirstate and another semantic | |||
|
20 | changes happen. | |||
|
21 | ||||
|
22 | ||||
|
23 | Setup | |||
|
24 | ===== | |||
|
25 | ||||
|
26 | $ directories="dir dir/nested dir2" | |||
|
27 | $ first_files="dir/nested/a dir/b dir/c dir/d dir2/e f" | |||
|
28 | $ second_files="g dir/nested/h dir/i dir/j dir2/k dir2/l dir/nested/m" | |||
|
29 | $ extra_files="dir/n dir/o p q" | |||
|
30 | ||||
|
31 | $ hg init reference-repo | |||
|
32 | $ cd reference-repo | |||
|
33 | $ mkdir -p dir/nested dir2 | |||
|
34 | $ touch -t 200001010000 $first_files $directories | |||
|
35 | $ hg commit -Aqm "recreate a bunch of files to facilitate dirstate-v2 append" | |||
|
36 | $ touch -t 200001010010 $second_files $directories | |||
|
37 | $ hg commit -Aqm "more files to have two commits" | |||
|
38 | $ hg log -G -v | |||
|
39 | @ changeset: 1:c349430a1631 | |||
|
40 | | tag: tip | |||
|
41 | | user: test | |||
|
42 | | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
43 | | files: dir/i dir/j dir/nested/h dir/nested/m dir2/k dir2/l g | |||
|
44 | | description: | |||
|
45 | | more files to have two commits | |||
|
46 | | | |||
|
47 | | | |||
|
48 | o changeset: 0:4f23db756b09 | |||
|
49 | user: test | |||
|
50 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
51 | files: dir/b dir/c dir/d dir/nested/a dir2/e f | |||
|
52 | description: | |||
|
53 | recreate a bunch of files to facilitate dirstate-v2 append | |||
|
54 | ||||
|
55 | ||||
|
56 | $ hg manifest | |||
|
57 | dir/b | |||
|
58 | dir/c | |||
|
59 | dir/d | |||
|
60 | dir/i | |||
|
61 | dir/j | |||
|
62 | dir/nested/a | |||
|
63 | dir/nested/h | |||
|
64 | dir/nested/m | |||
|
65 | dir2/e | |||
|
66 | dir2/k | |||
|
67 | dir2/l | |||
|
68 | f | |||
|
69 | g | |||
|
70 | ||||
|
71 | Add some unknown files and refresh the dirstate | |||
|
72 | ||||
|
73 | $ touch -t 200001010020 $extra_files | |||
|
74 | $ hg add dir/o | |||
|
75 | $ hg remove dir/nested/m | |||
|
76 | ||||
|
77 | $ hg st | |||
|
78 | A dir/o | |||
|
79 | R dir/nested/m | |||
|
80 | ? dir/n | |||
|
81 | ? p | |||
|
82 | ? q | |||
|
83 | $ hg debugstate | |||
|
84 | n 644 0 2000-01-01 00:00:00 dir/b | |||
|
85 | n 644 0 2000-01-01 00:00:00 dir/c | |||
|
86 | n 644 0 2000-01-01 00:00:00 dir/d | |||
|
87 | n 644 0 2000-01-01 00:10:00 dir/i | |||
|
88 | n 644 0 2000-01-01 00:10:00 dir/j | |||
|
89 | n 644 0 2000-01-01 00:00:00 dir/nested/a | |||
|
90 | n 644 0 2000-01-01 00:10:00 dir/nested/h | |||
|
91 | r ?????????????????????????????????? dir/nested/m (glob) | |||
|
92 | a ?????????????????????????????????? dir/o (glob) | |||
|
93 | n 644 0 2000-01-01 00:00:00 dir2/e | |||
|
94 | n 644 0 2000-01-01 00:10:00 dir2/k | |||
|
95 | n 644 0 2000-01-01 00:10:00 dir2/l | |||
|
96 | n 644 0 2000-01-01 00:00:00 f | |||
|
97 | n 644 0 2000-01-01 00:10:00 g | |||
|
98 | $ hg debugstate > ../reference | |||
|
99 | $ cd .. | |||
|
100 | ||||
|
101 | Explain / verify the test principles | |||
|
102 | ------------------------------------ | |||
|
103 | ||||
|
104 | First, we can properly copy the reference | |||
|
105 | ||||
|
106 | $ cp -a reference-repo sanity-check | |||
|
107 | $ cd sanity-check | |||
|
108 | $ hg debugstate | |||
|
109 | n 644 0 2000-01-01 00:00:00 dir/b | |||
|
110 | n 644 0 2000-01-01 00:00:00 dir/c | |||
|
111 | n 644 0 2000-01-01 00:00:00 dir/d | |||
|
112 | n 644 0 2000-01-01 00:10:00 dir/i | |||
|
113 | n 644 0 2000-01-01 00:10:00 dir/j | |||
|
114 | n 644 0 2000-01-01 00:00:00 dir/nested/a | |||
|
115 | n 644 0 2000-01-01 00:10:00 dir/nested/h | |||
|
116 | r ?????????????????????????????????? dir/nested/m (glob) | |||
|
117 | a ?????????????????????????????????? dir/o (glob) | |||
|
118 | n 644 0 2000-01-01 00:00:00 dir2/e | |||
|
119 | n 644 0 2000-01-01 00:10:00 dir2/k | |||
|
120 | n 644 0 2000-01-01 00:10:00 dir2/l | |||
|
121 | n 644 0 2000-01-01 00:00:00 f | |||
|
122 | n 644 0 2000-01-01 00:10:00 g | |||
|
123 | $ hg debugstate > ../post-copy | |||
|
124 | $ diff ../reference ../post-copy | |||
|
125 | ||||
|
126 | And status thinks the cache is in a proper state | |||
|
127 | ||||
|
128 | $ hg st | |||
|
129 | A dir/o | |||
|
130 | R dir/nested/m | |||
|
131 | ? dir/n | |||
|
132 | ? p | |||
|
133 | ? q | |||
|
134 | $ hg debugstate | |||
|
135 | n 644 0 2000-01-01 00:00:00 dir/b | |||
|
136 | n 644 0 2000-01-01 00:00:00 dir/c | |||
|
137 | n 644 0 2000-01-01 00:00:00 dir/d | |||
|
138 | n 644 0 2000-01-01 00:10:00 dir/i | |||
|
139 | n 644 0 2000-01-01 00:10:00 dir/j | |||
|
140 | n 644 0 2000-01-01 00:00:00 dir/nested/a | |||
|
141 | n 644 0 2000-01-01 00:10:00 dir/nested/h | |||
|
142 | r ?????????????????????????????????? dir/nested/m (glob) | |||
|
143 | a ?????????????????????????????????? dir/o (glob) | |||
|
144 | n 644 0 2000-01-01 00:00:00 dir2/e | |||
|
145 | n 644 0 2000-01-01 00:10:00 dir2/k | |||
|
146 | n 644 0 2000-01-01 00:10:00 dir2/l | |||
|
147 | n 644 0 2000-01-01 00:00:00 f | |||
|
148 | n 644 0 2000-01-01 00:10:00 g | |||
|
149 | $ hg debugstate > ../post-status | |||
|
150 | $ diff ../reference ../post-status | |||
|
151 | ||||
|
152 | Then we can start a status that: | |||
|
153 | - has some update to do (the touch call) | |||
|
154 | - will wait AFTER running status, but before updating the cache on disk | |||
|
155 | ||||
|
156 | $ touch -t 200001010001 dir/c | |||
|
157 | $ hg st >$TESTTMP/status-race-lock.out 2>$TESTTMP/status-race-lock.log \ | |||
|
158 | > --config rhg.on-unsupported=abort \ | |||
|
159 | > --config devel.sync.status.pre-dirstate-write-file=$TESTTMP/status-race-lock \ | |||
|
160 | > & | |||
|
161 | $ $RUNTESTDIR/testlib/wait-on-file 5 $TESTTMP/status-race-lock.waiting | |||
|
162 | ||||
|
163 | We check it runs the status first by modifying a file and updating another timestamp | |||
|
164 | ||||
|
165 | $ touch -t 200001010003 dir/i | |||
|
166 | $ echo babar > dir/j | |||
|
167 | $ touch $TESTTMP/status-race-lock | |||
|
168 | $ wait | |||
|
169 | ||||
|
170 | The test process should have reported a status before the change we made, | |||
|
171 | and should have missed the timestamp update | |||
|
172 | ||||
|
173 | $ cat $TESTTMP/status-race-lock.out | |||
|
174 | A dir/o | |||
|
175 | R dir/nested/m | |||
|
176 | ? dir/n | |||
|
177 | ? p | |||
|
178 | ? q | |||
|
179 | $ cat $TESTTMP/status-race-lock.log | |||
|
180 | $ hg debugstate | grep dir/c | |||
|
181 | n 644 0 2000-01-01 00:01:00 dir/c | |||
|
182 | $ hg debugstate | grep dir/i | |||
|
183 | n 644 0 2000-01-01 00:10:00 dir/i | |||
|
184 | $ hg debugstate | grep dir/j | |||
|
185 | n 644 0 2000-01-01 00:10:00 dir/j | |||
|
186 | ||||
|
187 | final cleanup | |||
|
188 | ||||
|
189 | $ rm $TESTTMP/status-race-lock $TESTTMP/status-race-lock.waiting | |||
|
190 | $ cd .. |
@@ -1,2877 +1,2893 b'' | |||||
1 | # configitems.py - centralized declaration of configuration option |
|
1 | # configitems.py - centralized declaration of configuration option | |
2 | # |
|
2 | # | |
3 | # Copyright 2017 Pierre-Yves David <pierre-yves.david@octobus.net> |
|
3 | # Copyright 2017 Pierre-Yves David <pierre-yves.david@octobus.net> | |
4 | # |
|
4 | # | |
5 | # This software may be used and distributed according to the terms of the |
|
5 | # This software may be used and distributed according to the terms of the | |
6 | # GNU General Public License version 2 or any later version. |
|
6 | # GNU General Public License version 2 or any later version. | |
7 |
|
7 | |||
8 |
|
8 | |||
9 | import functools |
|
9 | import functools | |
10 | import re |
|
10 | import re | |
11 |
|
11 | |||
12 | from . import ( |
|
12 | from . import ( | |
13 | encoding, |
|
13 | encoding, | |
14 | error, |
|
14 | error, | |
15 | ) |
|
15 | ) | |
16 |
|
16 | |||
17 |
|
17 | |||
18 | def loadconfigtable(ui, extname, configtable): |
|
18 | def loadconfigtable(ui, extname, configtable): | |
19 | """update config item known to the ui with the extension ones""" |
|
19 | """update config item known to the ui with the extension ones""" | |
20 | for section, items in sorted(configtable.items()): |
|
20 | for section, items in sorted(configtable.items()): | |
21 | knownitems = ui._knownconfig.setdefault(section, itemregister()) |
|
21 | knownitems = ui._knownconfig.setdefault(section, itemregister()) | |
22 | knownkeys = set(knownitems) |
|
22 | knownkeys = set(knownitems) | |
23 | newkeys = set(items) |
|
23 | newkeys = set(items) | |
24 | for key in sorted(knownkeys & newkeys): |
|
24 | for key in sorted(knownkeys & newkeys): | |
25 | msg = b"extension '%s' overwrite config item '%s.%s'" |
|
25 | msg = b"extension '%s' overwrite config item '%s.%s'" | |
26 | msg %= (extname, section, key) |
|
26 | msg %= (extname, section, key) | |
27 | ui.develwarn(msg, config=b'warn-config') |
|
27 | ui.develwarn(msg, config=b'warn-config') | |
28 |
|
28 | |||
29 | knownitems.update(items) |
|
29 | knownitems.update(items) | |
30 |
|
30 | |||
31 |
|
31 | |||
32 | class configitem: |
|
32 | class configitem: | |
33 | """represent a known config item |
|
33 | """represent a known config item | |
34 |
|
34 | |||
35 | :section: the official config section where to find this item, |
|
35 | :section: the official config section where to find this item, | |
36 | :name: the official name within the section, |
|
36 | :name: the official name within the section, | |
37 | :default: default value for this item, |
|
37 | :default: default value for this item, | |
38 | :alias: optional list of tuples as alternatives, |
|
38 | :alias: optional list of tuples as alternatives, | |
39 | :generic: this is a generic definition, match name using regular expression. |
|
39 | :generic: this is a generic definition, match name using regular expression. | |
40 | """ |
|
40 | """ | |
41 |
|
41 | |||
42 | def __init__( |
|
42 | def __init__( | |
43 | self, |
|
43 | self, | |
44 | section, |
|
44 | section, | |
45 | name, |
|
45 | name, | |
46 | default=None, |
|
46 | default=None, | |
47 | alias=(), |
|
47 | alias=(), | |
48 | generic=False, |
|
48 | generic=False, | |
49 | priority=0, |
|
49 | priority=0, | |
50 | experimental=False, |
|
50 | experimental=False, | |
51 | ): |
|
51 | ): | |
52 | self.section = section |
|
52 | self.section = section | |
53 | self.name = name |
|
53 | self.name = name | |
54 | self.default = default |
|
54 | self.default = default | |
55 | self.alias = list(alias) |
|
55 | self.alias = list(alias) | |
56 | self.generic = generic |
|
56 | self.generic = generic | |
57 | self.priority = priority |
|
57 | self.priority = priority | |
58 | self.experimental = experimental |
|
58 | self.experimental = experimental | |
59 | self._re = None |
|
59 | self._re = None | |
60 | if generic: |
|
60 | if generic: | |
61 | self._re = re.compile(self.name) |
|
61 | self._re = re.compile(self.name) | |
62 |
|
62 | |||
63 |
|
63 | |||
64 | class itemregister(dict): |
|
64 | class itemregister(dict): | |
65 | """A specialized dictionary that can handle wild-card selection""" |
|
65 | """A specialized dictionary that can handle wild-card selection""" | |
66 |
|
66 | |||
67 | def __init__(self): |
|
67 | def __init__(self): | |
68 | super(itemregister, self).__init__() |
|
68 | super(itemregister, self).__init__() | |
69 | self._generics = set() |
|
69 | self._generics = set() | |
70 |
|
70 | |||
71 | def update(self, other): |
|
71 | def update(self, other): | |
72 | super(itemregister, self).update(other) |
|
72 | super(itemregister, self).update(other) | |
73 | self._generics.update(other._generics) |
|
73 | self._generics.update(other._generics) | |
74 |
|
74 | |||
75 | def __setitem__(self, key, item): |
|
75 | def __setitem__(self, key, item): | |
76 | super(itemregister, self).__setitem__(key, item) |
|
76 | super(itemregister, self).__setitem__(key, item) | |
77 | if item.generic: |
|
77 | if item.generic: | |
78 | self._generics.add(item) |
|
78 | self._generics.add(item) | |
79 |
|
79 | |||
80 | def get(self, key): |
|
80 | def get(self, key): | |
81 | baseitem = super(itemregister, self).get(key) |
|
81 | baseitem = super(itemregister, self).get(key) | |
82 | if baseitem is not None and not baseitem.generic: |
|
82 | if baseitem is not None and not baseitem.generic: | |
83 | return baseitem |
|
83 | return baseitem | |
84 |
|
84 | |||
85 | # search for a matching generic item |
|
85 | # search for a matching generic item | |
86 | generics = sorted(self._generics, key=(lambda x: (x.priority, x.name))) |
|
86 | generics = sorted(self._generics, key=(lambda x: (x.priority, x.name))) | |
87 | for item in generics: |
|
87 | for item in generics: | |
88 | # we use 'match' instead of 'search' to make the matching simpler |
|
88 | # we use 'match' instead of 'search' to make the matching simpler | |
89 | # for people unfamiliar with regular expression. Having the match |
|
89 | # for people unfamiliar with regular expression. Having the match | |
90 | # rooted to the start of the string will produce less surprising |
|
90 | # rooted to the start of the string will produce less surprising | |
91 | # result for user writing simple regex for sub-attribute. |
|
91 | # result for user writing simple regex for sub-attribute. | |
92 | # |
|
92 | # | |
93 | # For example using "color\..*" match produces an unsurprising |
|
93 | # For example using "color\..*" match produces an unsurprising | |
94 | # result, while using search could suddenly match apparently |
|
94 | # result, while using search could suddenly match apparently | |
95 | # unrelated configuration that happens to contains "color." |
|
95 | # unrelated configuration that happens to contains "color." | |
96 | # anywhere. This is a tradeoff where we favor requiring ".*" on |
|
96 | # anywhere. This is a tradeoff where we favor requiring ".*" on | |
97 | # some match to avoid the need to prefix most pattern with "^". |
|
97 | # some match to avoid the need to prefix most pattern with "^". | |
98 | # The "^" seems more error prone. |
|
98 | # The "^" seems more error prone. | |
99 | if item._re.match(key): |
|
99 | if item._re.match(key): | |
100 | return item |
|
100 | return item | |
101 |
|
101 | |||
102 | return None |
|
102 | return None | |
103 |
|
103 | |||
104 |
|
104 | |||
105 | coreitems = {} |
|
105 | coreitems = {} | |
106 |
|
106 | |||
107 |
|
107 | |||
108 | def _register(configtable, *args, **kwargs): |
|
108 | def _register(configtable, *args, **kwargs): | |
109 | item = configitem(*args, **kwargs) |
|
109 | item = configitem(*args, **kwargs) | |
110 | section = configtable.setdefault(item.section, itemregister()) |
|
110 | section = configtable.setdefault(item.section, itemregister()) | |
111 | if item.name in section: |
|
111 | if item.name in section: | |
112 | msg = b"duplicated config item registration for '%s.%s'" |
|
112 | msg = b"duplicated config item registration for '%s.%s'" | |
113 | raise error.ProgrammingError(msg % (item.section, item.name)) |
|
113 | raise error.ProgrammingError(msg % (item.section, item.name)) | |
114 | section[item.name] = item |
|
114 | section[item.name] = item | |
115 |
|
115 | |||
116 |
|
116 | |||
117 | # special value for case where the default is derived from other values |
|
117 | # special value for case where the default is derived from other values | |
118 | dynamicdefault = object() |
|
118 | dynamicdefault = object() | |
119 |
|
119 | |||
120 | # Registering actual config items |
|
120 | # Registering actual config items | |
121 |
|
121 | |||
122 |
|
122 | |||
123 | def getitemregister(configtable): |
|
123 | def getitemregister(configtable): | |
124 | f = functools.partial(_register, configtable) |
|
124 | f = functools.partial(_register, configtable) | |
125 | # export pseudo enum as configitem.* |
|
125 | # export pseudo enum as configitem.* | |
126 | f.dynamicdefault = dynamicdefault |
|
126 | f.dynamicdefault = dynamicdefault | |
127 | return f |
|
127 | return f | |
128 |
|
128 | |||
129 |
|
129 | |||
130 | coreconfigitem = getitemregister(coreitems) |
|
130 | coreconfigitem = getitemregister(coreitems) | |
131 |
|
131 | |||
132 |
|
132 | |||
133 | def _registerdiffopts(section, configprefix=b''): |
|
133 | def _registerdiffopts(section, configprefix=b''): | |
134 | coreconfigitem( |
|
134 | coreconfigitem( | |
135 | section, |
|
135 | section, | |
136 | configprefix + b'nodates', |
|
136 | configprefix + b'nodates', | |
137 | default=False, |
|
137 | default=False, | |
138 | ) |
|
138 | ) | |
139 | coreconfigitem( |
|
139 | coreconfigitem( | |
140 | section, |
|
140 | section, | |
141 | configprefix + b'showfunc', |
|
141 | configprefix + b'showfunc', | |
142 | default=False, |
|
142 | default=False, | |
143 | ) |
|
143 | ) | |
144 | coreconfigitem( |
|
144 | coreconfigitem( | |
145 | section, |
|
145 | section, | |
146 | configprefix + b'unified', |
|
146 | configprefix + b'unified', | |
147 | default=None, |
|
147 | default=None, | |
148 | ) |
|
148 | ) | |
149 | coreconfigitem( |
|
149 | coreconfigitem( | |
150 | section, |
|
150 | section, | |
151 | configprefix + b'git', |
|
151 | configprefix + b'git', | |
152 | default=False, |
|
152 | default=False, | |
153 | ) |
|
153 | ) | |
154 | coreconfigitem( |
|
154 | coreconfigitem( | |
155 | section, |
|
155 | section, | |
156 | configprefix + b'ignorews', |
|
156 | configprefix + b'ignorews', | |
157 | default=False, |
|
157 | default=False, | |
158 | ) |
|
158 | ) | |
159 | coreconfigitem( |
|
159 | coreconfigitem( | |
160 | section, |
|
160 | section, | |
161 | configprefix + b'ignorewsamount', |
|
161 | configprefix + b'ignorewsamount', | |
162 | default=False, |
|
162 | default=False, | |
163 | ) |
|
163 | ) | |
164 | coreconfigitem( |
|
164 | coreconfigitem( | |
165 | section, |
|
165 | section, | |
166 | configprefix + b'ignoreblanklines', |
|
166 | configprefix + b'ignoreblanklines', | |
167 | default=False, |
|
167 | default=False, | |
168 | ) |
|
168 | ) | |
169 | coreconfigitem( |
|
169 | coreconfigitem( | |
170 | section, |
|
170 | section, | |
171 | configprefix + b'ignorewseol', |
|
171 | configprefix + b'ignorewseol', | |
172 | default=False, |
|
172 | default=False, | |
173 | ) |
|
173 | ) | |
174 | coreconfigitem( |
|
174 | coreconfigitem( | |
175 | section, |
|
175 | section, | |
176 | configprefix + b'nobinary', |
|
176 | configprefix + b'nobinary', | |
177 | default=False, |
|
177 | default=False, | |
178 | ) |
|
178 | ) | |
179 | coreconfigitem( |
|
179 | coreconfigitem( | |
180 | section, |
|
180 | section, | |
181 | configprefix + b'noprefix', |
|
181 | configprefix + b'noprefix', | |
182 | default=False, |
|
182 | default=False, | |
183 | ) |
|
183 | ) | |
184 | coreconfigitem( |
|
184 | coreconfigitem( | |
185 | section, |
|
185 | section, | |
186 | configprefix + b'word-diff', |
|
186 | configprefix + b'word-diff', | |
187 | default=False, |
|
187 | default=False, | |
188 | ) |
|
188 | ) | |
189 |
|
189 | |||
190 |
|
190 | |||
191 | coreconfigitem( |
|
191 | coreconfigitem( | |
192 | b'alias', |
|
192 | b'alias', | |
193 | b'.*', |
|
193 | b'.*', | |
194 | default=dynamicdefault, |
|
194 | default=dynamicdefault, | |
195 | generic=True, |
|
195 | generic=True, | |
196 | ) |
|
196 | ) | |
197 | coreconfigitem( |
|
197 | coreconfigitem( | |
198 | b'auth', |
|
198 | b'auth', | |
199 | b'cookiefile', |
|
199 | b'cookiefile', | |
200 | default=None, |
|
200 | default=None, | |
201 | ) |
|
201 | ) | |
202 | _registerdiffopts(section=b'annotate') |
|
202 | _registerdiffopts(section=b'annotate') | |
203 | # bookmarks.pushing: internal hack for discovery |
|
203 | # bookmarks.pushing: internal hack for discovery | |
204 | coreconfigitem( |
|
204 | coreconfigitem( | |
205 | b'bookmarks', |
|
205 | b'bookmarks', | |
206 | b'pushing', |
|
206 | b'pushing', | |
207 | default=list, |
|
207 | default=list, | |
208 | ) |
|
208 | ) | |
209 | # bundle.mainreporoot: internal hack for bundlerepo |
|
209 | # bundle.mainreporoot: internal hack for bundlerepo | |
210 | coreconfigitem( |
|
210 | coreconfigitem( | |
211 | b'bundle', |
|
211 | b'bundle', | |
212 | b'mainreporoot', |
|
212 | b'mainreporoot', | |
213 | default=b'', |
|
213 | default=b'', | |
214 | ) |
|
214 | ) | |
215 | coreconfigitem( |
|
215 | coreconfigitem( | |
216 | b'censor', |
|
216 | b'censor', | |
217 | b'policy', |
|
217 | b'policy', | |
218 | default=b'abort', |
|
218 | default=b'abort', | |
219 | experimental=True, |
|
219 | experimental=True, | |
220 | ) |
|
220 | ) | |
221 | coreconfigitem( |
|
221 | coreconfigitem( | |
222 | b'chgserver', |
|
222 | b'chgserver', | |
223 | b'idletimeout', |
|
223 | b'idletimeout', | |
224 | default=3600, |
|
224 | default=3600, | |
225 | ) |
|
225 | ) | |
226 | coreconfigitem( |
|
226 | coreconfigitem( | |
227 | b'chgserver', |
|
227 | b'chgserver', | |
228 | b'skiphash', |
|
228 | b'skiphash', | |
229 | default=False, |
|
229 | default=False, | |
230 | ) |
|
230 | ) | |
231 | coreconfigitem( |
|
231 | coreconfigitem( | |
232 | b'cmdserver', |
|
232 | b'cmdserver', | |
233 | b'log', |
|
233 | b'log', | |
234 | default=None, |
|
234 | default=None, | |
235 | ) |
|
235 | ) | |
236 | coreconfigitem( |
|
236 | coreconfigitem( | |
237 | b'cmdserver', |
|
237 | b'cmdserver', | |
238 | b'max-log-files', |
|
238 | b'max-log-files', | |
239 | default=7, |
|
239 | default=7, | |
240 | ) |
|
240 | ) | |
241 | coreconfigitem( |
|
241 | coreconfigitem( | |
242 | b'cmdserver', |
|
242 | b'cmdserver', | |
243 | b'max-log-size', |
|
243 | b'max-log-size', | |
244 | default=b'1 MB', |
|
244 | default=b'1 MB', | |
245 | ) |
|
245 | ) | |
246 | coreconfigitem( |
|
246 | coreconfigitem( | |
247 | b'cmdserver', |
|
247 | b'cmdserver', | |
248 | b'max-repo-cache', |
|
248 | b'max-repo-cache', | |
249 | default=0, |
|
249 | default=0, | |
250 | experimental=True, |
|
250 | experimental=True, | |
251 | ) |
|
251 | ) | |
252 | coreconfigitem( |
|
252 | coreconfigitem( | |
253 | b'cmdserver', |
|
253 | b'cmdserver', | |
254 | b'message-encodings', |
|
254 | b'message-encodings', | |
255 | default=list, |
|
255 | default=list, | |
256 | ) |
|
256 | ) | |
257 | coreconfigitem( |
|
257 | coreconfigitem( | |
258 | b'cmdserver', |
|
258 | b'cmdserver', | |
259 | b'track-log', |
|
259 | b'track-log', | |
260 | default=lambda: [b'chgserver', b'cmdserver', b'repocache'], |
|
260 | default=lambda: [b'chgserver', b'cmdserver', b'repocache'], | |
261 | ) |
|
261 | ) | |
262 | coreconfigitem( |
|
262 | coreconfigitem( | |
263 | b'cmdserver', |
|
263 | b'cmdserver', | |
264 | b'shutdown-on-interrupt', |
|
264 | b'shutdown-on-interrupt', | |
265 | default=True, |
|
265 | default=True, | |
266 | ) |
|
266 | ) | |
267 | coreconfigitem( |
|
267 | coreconfigitem( | |
268 | b'color', |
|
268 | b'color', | |
269 | b'.*', |
|
269 | b'.*', | |
270 | default=None, |
|
270 | default=None, | |
271 | generic=True, |
|
271 | generic=True, | |
272 | ) |
|
272 | ) | |
273 | coreconfigitem( |
|
273 | coreconfigitem( | |
274 | b'color', |
|
274 | b'color', | |
275 | b'mode', |
|
275 | b'mode', | |
276 | default=b'auto', |
|
276 | default=b'auto', | |
277 | ) |
|
277 | ) | |
278 | coreconfigitem( |
|
278 | coreconfigitem( | |
279 | b'color', |
|
279 | b'color', | |
280 | b'pagermode', |
|
280 | b'pagermode', | |
281 | default=dynamicdefault, |
|
281 | default=dynamicdefault, | |
282 | ) |
|
282 | ) | |
283 | coreconfigitem( |
|
283 | coreconfigitem( | |
284 | b'command-templates', |
|
284 | b'command-templates', | |
285 | b'graphnode', |
|
285 | b'graphnode', | |
286 | default=None, |
|
286 | default=None, | |
287 | alias=[(b'ui', b'graphnodetemplate')], |
|
287 | alias=[(b'ui', b'graphnodetemplate')], | |
288 | ) |
|
288 | ) | |
289 | coreconfigitem( |
|
289 | coreconfigitem( | |
290 | b'command-templates', |
|
290 | b'command-templates', | |
291 | b'log', |
|
291 | b'log', | |
292 | default=None, |
|
292 | default=None, | |
293 | alias=[(b'ui', b'logtemplate')], |
|
293 | alias=[(b'ui', b'logtemplate')], | |
294 | ) |
|
294 | ) | |
295 | coreconfigitem( |
|
295 | coreconfigitem( | |
296 | b'command-templates', |
|
296 | b'command-templates', | |
297 | b'mergemarker', |
|
297 | b'mergemarker', | |
298 | default=( |
|
298 | default=( | |
299 | b'{node|short} ' |
|
299 | b'{node|short} ' | |
300 | b'{ifeq(tags, "tip", "", ' |
|
300 | b'{ifeq(tags, "tip", "", ' | |
301 | b'ifeq(tags, "", "", "{tags} "))}' |
|
301 | b'ifeq(tags, "", "", "{tags} "))}' | |
302 | b'{if(bookmarks, "{bookmarks} ")}' |
|
302 | b'{if(bookmarks, "{bookmarks} ")}' | |
303 | b'{ifeq(branch, "default", "", "{branch} ")}' |
|
303 | b'{ifeq(branch, "default", "", "{branch} ")}' | |
304 | b'- {author|user}: {desc|firstline}' |
|
304 | b'- {author|user}: {desc|firstline}' | |
305 | ), |
|
305 | ), | |
306 | alias=[(b'ui', b'mergemarkertemplate')], |
|
306 | alias=[(b'ui', b'mergemarkertemplate')], | |
307 | ) |
|
307 | ) | |
308 | coreconfigitem( |
|
308 | coreconfigitem( | |
309 | b'command-templates', |
|
309 | b'command-templates', | |
310 | b'pre-merge-tool-output', |
|
310 | b'pre-merge-tool-output', | |
311 | default=None, |
|
311 | default=None, | |
312 | alias=[(b'ui', b'pre-merge-tool-output-template')], |
|
312 | alias=[(b'ui', b'pre-merge-tool-output-template')], | |
313 | ) |
|
313 | ) | |
314 | coreconfigitem( |
|
314 | coreconfigitem( | |
315 | b'command-templates', |
|
315 | b'command-templates', | |
316 | b'oneline-summary', |
|
316 | b'oneline-summary', | |
317 | default=None, |
|
317 | default=None, | |
318 | ) |
|
318 | ) | |
319 | coreconfigitem( |
|
319 | coreconfigitem( | |
320 | b'command-templates', |
|
320 | b'command-templates', | |
321 | b'oneline-summary.*', |
|
321 | b'oneline-summary.*', | |
322 | default=dynamicdefault, |
|
322 | default=dynamicdefault, | |
323 | generic=True, |
|
323 | generic=True, | |
324 | ) |
|
324 | ) | |
325 | _registerdiffopts(section=b'commands', configprefix=b'commit.interactive.') |
|
325 | _registerdiffopts(section=b'commands', configprefix=b'commit.interactive.') | |
326 | coreconfigitem( |
|
326 | coreconfigitem( | |
327 | b'commands', |
|
327 | b'commands', | |
328 | b'commit.post-status', |
|
328 | b'commit.post-status', | |
329 | default=False, |
|
329 | default=False, | |
330 | ) |
|
330 | ) | |
331 | coreconfigitem( |
|
331 | coreconfigitem( | |
332 | b'commands', |
|
332 | b'commands', | |
333 | b'grep.all-files', |
|
333 | b'grep.all-files', | |
334 | default=False, |
|
334 | default=False, | |
335 | experimental=True, |
|
335 | experimental=True, | |
336 | ) |
|
336 | ) | |
337 | coreconfigitem( |
|
337 | coreconfigitem( | |
338 | b'commands', |
|
338 | b'commands', | |
339 | b'merge.require-rev', |
|
339 | b'merge.require-rev', | |
340 | default=False, |
|
340 | default=False, | |
341 | ) |
|
341 | ) | |
342 | coreconfigitem( |
|
342 | coreconfigitem( | |
343 | b'commands', |
|
343 | b'commands', | |
344 | b'push.require-revs', |
|
344 | b'push.require-revs', | |
345 | default=False, |
|
345 | default=False, | |
346 | ) |
|
346 | ) | |
347 | coreconfigitem( |
|
347 | coreconfigitem( | |
348 | b'commands', |
|
348 | b'commands', | |
349 | b'resolve.confirm', |
|
349 | b'resolve.confirm', | |
350 | default=False, |
|
350 | default=False, | |
351 | ) |
|
351 | ) | |
352 | coreconfigitem( |
|
352 | coreconfigitem( | |
353 | b'commands', |
|
353 | b'commands', | |
354 | b'resolve.explicit-re-merge', |
|
354 | b'resolve.explicit-re-merge', | |
355 | default=False, |
|
355 | default=False, | |
356 | ) |
|
356 | ) | |
357 | coreconfigitem( |
|
357 | coreconfigitem( | |
358 | b'commands', |
|
358 | b'commands', | |
359 | b'resolve.mark-check', |
|
359 | b'resolve.mark-check', | |
360 | default=b'none', |
|
360 | default=b'none', | |
361 | ) |
|
361 | ) | |
362 | _registerdiffopts(section=b'commands', configprefix=b'revert.interactive.') |
|
362 | _registerdiffopts(section=b'commands', configprefix=b'revert.interactive.') | |
363 | coreconfigitem( |
|
363 | coreconfigitem( | |
364 | b'commands', |
|
364 | b'commands', | |
365 | b'show.aliasprefix', |
|
365 | b'show.aliasprefix', | |
366 | default=list, |
|
366 | default=list, | |
367 | ) |
|
367 | ) | |
368 | coreconfigitem( |
|
368 | coreconfigitem( | |
369 | b'commands', |
|
369 | b'commands', | |
370 | b'status.relative', |
|
370 | b'status.relative', | |
371 | default=False, |
|
371 | default=False, | |
372 | ) |
|
372 | ) | |
373 | coreconfigitem( |
|
373 | coreconfigitem( | |
374 | b'commands', |
|
374 | b'commands', | |
375 | b'status.skipstates', |
|
375 | b'status.skipstates', | |
376 | default=[], |
|
376 | default=[], | |
377 | experimental=True, |
|
377 | experimental=True, | |
378 | ) |
|
378 | ) | |
379 | coreconfigitem( |
|
379 | coreconfigitem( | |
380 | b'commands', |
|
380 | b'commands', | |
381 | b'status.terse', |
|
381 | b'status.terse', | |
382 | default=b'', |
|
382 | default=b'', | |
383 | ) |
|
383 | ) | |
384 | coreconfigitem( |
|
384 | coreconfigitem( | |
385 | b'commands', |
|
385 | b'commands', | |
386 | b'status.verbose', |
|
386 | b'status.verbose', | |
387 | default=False, |
|
387 | default=False, | |
388 | ) |
|
388 | ) | |
389 | coreconfigitem( |
|
389 | coreconfigitem( | |
390 | b'commands', |
|
390 | b'commands', | |
391 | b'update.check', |
|
391 | b'update.check', | |
392 | default=None, |
|
392 | default=None, | |
393 | ) |
|
393 | ) | |
394 | coreconfigitem( |
|
394 | coreconfigitem( | |
395 | b'commands', |
|
395 | b'commands', | |
396 | b'update.requiredest', |
|
396 | b'update.requiredest', | |
397 | default=False, |
|
397 | default=False, | |
398 | ) |
|
398 | ) | |
399 | coreconfigitem( |
|
399 | coreconfigitem( | |
400 | b'committemplate', |
|
400 | b'committemplate', | |
401 | b'.*', |
|
401 | b'.*', | |
402 | default=None, |
|
402 | default=None, | |
403 | generic=True, |
|
403 | generic=True, | |
404 | ) |
|
404 | ) | |
405 | coreconfigitem( |
|
405 | coreconfigitem( | |
406 | b'convert', |
|
406 | b'convert', | |
407 | b'bzr.saverev', |
|
407 | b'bzr.saverev', | |
408 | default=True, |
|
408 | default=True, | |
409 | ) |
|
409 | ) | |
410 | coreconfigitem( |
|
410 | coreconfigitem( | |
411 | b'convert', |
|
411 | b'convert', | |
412 | b'cvsps.cache', |
|
412 | b'cvsps.cache', | |
413 | default=True, |
|
413 | default=True, | |
414 | ) |
|
414 | ) | |
415 | coreconfigitem( |
|
415 | coreconfigitem( | |
416 | b'convert', |
|
416 | b'convert', | |
417 | b'cvsps.fuzz', |
|
417 | b'cvsps.fuzz', | |
418 | default=60, |
|
418 | default=60, | |
419 | ) |
|
419 | ) | |
420 | coreconfigitem( |
|
420 | coreconfigitem( | |
421 | b'convert', |
|
421 | b'convert', | |
422 | b'cvsps.logencoding', |
|
422 | b'cvsps.logencoding', | |
423 | default=None, |
|
423 | default=None, | |
424 | ) |
|
424 | ) | |
425 | coreconfigitem( |
|
425 | coreconfigitem( | |
426 | b'convert', |
|
426 | b'convert', | |
427 | b'cvsps.mergefrom', |
|
427 | b'cvsps.mergefrom', | |
428 | default=None, |
|
428 | default=None, | |
429 | ) |
|
429 | ) | |
430 | coreconfigitem( |
|
430 | coreconfigitem( | |
431 | b'convert', |
|
431 | b'convert', | |
432 | b'cvsps.mergeto', |
|
432 | b'cvsps.mergeto', | |
433 | default=None, |
|
433 | default=None, | |
434 | ) |
|
434 | ) | |
435 | coreconfigitem( |
|
435 | coreconfigitem( | |
436 | b'convert', |
|
436 | b'convert', | |
437 | b'git.committeractions', |
|
437 | b'git.committeractions', | |
438 | default=lambda: [b'messagedifferent'], |
|
438 | default=lambda: [b'messagedifferent'], | |
439 | ) |
|
439 | ) | |
440 | coreconfigitem( |
|
440 | coreconfigitem( | |
441 | b'convert', |
|
441 | b'convert', | |
442 | b'git.extrakeys', |
|
442 | b'git.extrakeys', | |
443 | default=list, |
|
443 | default=list, | |
444 | ) |
|
444 | ) | |
445 | coreconfigitem( |
|
445 | coreconfigitem( | |
446 | b'convert', |
|
446 | b'convert', | |
447 | b'git.findcopiesharder', |
|
447 | b'git.findcopiesharder', | |
448 | default=False, |
|
448 | default=False, | |
449 | ) |
|
449 | ) | |
450 | coreconfigitem( |
|
450 | coreconfigitem( | |
451 | b'convert', |
|
451 | b'convert', | |
452 | b'git.remoteprefix', |
|
452 | b'git.remoteprefix', | |
453 | default=b'remote', |
|
453 | default=b'remote', | |
454 | ) |
|
454 | ) | |
455 | coreconfigitem( |
|
455 | coreconfigitem( | |
456 | b'convert', |
|
456 | b'convert', | |
457 | b'git.renamelimit', |
|
457 | b'git.renamelimit', | |
458 | default=400, |
|
458 | default=400, | |
459 | ) |
|
459 | ) | |
460 | coreconfigitem( |
|
460 | coreconfigitem( | |
461 | b'convert', |
|
461 | b'convert', | |
462 | b'git.saverev', |
|
462 | b'git.saverev', | |
463 | default=True, |
|
463 | default=True, | |
464 | ) |
|
464 | ) | |
465 | coreconfigitem( |
|
465 | coreconfigitem( | |
466 | b'convert', |
|
466 | b'convert', | |
467 | b'git.similarity', |
|
467 | b'git.similarity', | |
468 | default=50, |
|
468 | default=50, | |
469 | ) |
|
469 | ) | |
470 | coreconfigitem( |
|
470 | coreconfigitem( | |
471 | b'convert', |
|
471 | b'convert', | |
472 | b'git.skipsubmodules', |
|
472 | b'git.skipsubmodules', | |
473 | default=False, |
|
473 | default=False, | |
474 | ) |
|
474 | ) | |
475 | coreconfigitem( |
|
475 | coreconfigitem( | |
476 | b'convert', |
|
476 | b'convert', | |
477 | b'hg.clonebranches', |
|
477 | b'hg.clonebranches', | |
478 | default=False, |
|
478 | default=False, | |
479 | ) |
|
479 | ) | |
480 | coreconfigitem( |
|
480 | coreconfigitem( | |
481 | b'convert', |
|
481 | b'convert', | |
482 | b'hg.ignoreerrors', |
|
482 | b'hg.ignoreerrors', | |
483 | default=False, |
|
483 | default=False, | |
484 | ) |
|
484 | ) | |
485 | coreconfigitem( |
|
485 | coreconfigitem( | |
486 | b'convert', |
|
486 | b'convert', | |
487 | b'hg.preserve-hash', |
|
487 | b'hg.preserve-hash', | |
488 | default=False, |
|
488 | default=False, | |
489 | ) |
|
489 | ) | |
490 | coreconfigitem( |
|
490 | coreconfigitem( | |
491 | b'convert', |
|
491 | b'convert', | |
492 | b'hg.revs', |
|
492 | b'hg.revs', | |
493 | default=None, |
|
493 | default=None, | |
494 | ) |
|
494 | ) | |
495 | coreconfigitem( |
|
495 | coreconfigitem( | |
496 | b'convert', |
|
496 | b'convert', | |
497 | b'hg.saverev', |
|
497 | b'hg.saverev', | |
498 | default=False, |
|
498 | default=False, | |
499 | ) |
|
499 | ) | |
500 | coreconfigitem( |
|
500 | coreconfigitem( | |
501 | b'convert', |
|
501 | b'convert', | |
502 | b'hg.sourcename', |
|
502 | b'hg.sourcename', | |
503 | default=None, |
|
503 | default=None, | |
504 | ) |
|
504 | ) | |
505 | coreconfigitem( |
|
505 | coreconfigitem( | |
506 | b'convert', |
|
506 | b'convert', | |
507 | b'hg.startrev', |
|
507 | b'hg.startrev', | |
508 | default=None, |
|
508 | default=None, | |
509 | ) |
|
509 | ) | |
510 | coreconfigitem( |
|
510 | coreconfigitem( | |
511 | b'convert', |
|
511 | b'convert', | |
512 | b'hg.tagsbranch', |
|
512 | b'hg.tagsbranch', | |
513 | default=b'default', |
|
513 | default=b'default', | |
514 | ) |
|
514 | ) | |
515 | coreconfigitem( |
|
515 | coreconfigitem( | |
516 | b'convert', |
|
516 | b'convert', | |
517 | b'hg.usebranchnames', |
|
517 | b'hg.usebranchnames', | |
518 | default=True, |
|
518 | default=True, | |
519 | ) |
|
519 | ) | |
520 | coreconfigitem( |
|
520 | coreconfigitem( | |
521 | b'convert', |
|
521 | b'convert', | |
522 | b'ignoreancestorcheck', |
|
522 | b'ignoreancestorcheck', | |
523 | default=False, |
|
523 | default=False, | |
524 | experimental=True, |
|
524 | experimental=True, | |
525 | ) |
|
525 | ) | |
526 | coreconfigitem( |
|
526 | coreconfigitem( | |
527 | b'convert', |
|
527 | b'convert', | |
528 | b'localtimezone', |
|
528 | b'localtimezone', | |
529 | default=False, |
|
529 | default=False, | |
530 | ) |
|
530 | ) | |
531 | coreconfigitem( |
|
531 | coreconfigitem( | |
532 | b'convert', |
|
532 | b'convert', | |
533 | b'p4.encoding', |
|
533 | b'p4.encoding', | |
534 | default=dynamicdefault, |
|
534 | default=dynamicdefault, | |
535 | ) |
|
535 | ) | |
536 | coreconfigitem( |
|
536 | coreconfigitem( | |
537 | b'convert', |
|
537 | b'convert', | |
538 | b'p4.startrev', |
|
538 | b'p4.startrev', | |
539 | default=0, |
|
539 | default=0, | |
540 | ) |
|
540 | ) | |
541 | coreconfigitem( |
|
541 | coreconfigitem( | |
542 | b'convert', |
|
542 | b'convert', | |
543 | b'skiptags', |
|
543 | b'skiptags', | |
544 | default=False, |
|
544 | default=False, | |
545 | ) |
|
545 | ) | |
546 | coreconfigitem( |
|
546 | coreconfigitem( | |
547 | b'convert', |
|
547 | b'convert', | |
548 | b'svn.debugsvnlog', |
|
548 | b'svn.debugsvnlog', | |
549 | default=True, |
|
549 | default=True, | |
550 | ) |
|
550 | ) | |
551 | coreconfigitem( |
|
551 | coreconfigitem( | |
552 | b'convert', |
|
552 | b'convert', | |
553 | b'svn.trunk', |
|
553 | b'svn.trunk', | |
554 | default=None, |
|
554 | default=None, | |
555 | ) |
|
555 | ) | |
556 | coreconfigitem( |
|
556 | coreconfigitem( | |
557 | b'convert', |
|
557 | b'convert', | |
558 | b'svn.tags', |
|
558 | b'svn.tags', | |
559 | default=None, |
|
559 | default=None, | |
560 | ) |
|
560 | ) | |
561 | coreconfigitem( |
|
561 | coreconfigitem( | |
562 | b'convert', |
|
562 | b'convert', | |
563 | b'svn.branches', |
|
563 | b'svn.branches', | |
564 | default=None, |
|
564 | default=None, | |
565 | ) |
|
565 | ) | |
566 | coreconfigitem( |
|
566 | coreconfigitem( | |
567 | b'convert', |
|
567 | b'convert', | |
568 | b'svn.startrev', |
|
568 | b'svn.startrev', | |
569 | default=0, |
|
569 | default=0, | |
570 | ) |
|
570 | ) | |
571 | coreconfigitem( |
|
571 | coreconfigitem( | |
572 | b'convert', |
|
572 | b'convert', | |
573 | b'svn.dangerous-set-commit-dates', |
|
573 | b'svn.dangerous-set-commit-dates', | |
574 | default=False, |
|
574 | default=False, | |
575 | ) |
|
575 | ) | |
576 | coreconfigitem( |
|
576 | coreconfigitem( | |
577 | b'debug', |
|
577 | b'debug', | |
578 | b'dirstate.delaywrite', |
|
578 | b'dirstate.delaywrite', | |
579 | default=0, |
|
579 | default=0, | |
580 | ) |
|
580 | ) | |
581 | coreconfigitem( |
|
581 | coreconfigitem( | |
582 | b'debug', |
|
582 | b'debug', | |
583 | b'revlog.verifyposition.changelog', |
|
583 | b'revlog.verifyposition.changelog', | |
584 | default=b'', |
|
584 | default=b'', | |
585 | ) |
|
585 | ) | |
586 | coreconfigitem( |
|
586 | coreconfigitem( | |
587 | b'debug', |
|
587 | b'debug', | |
588 | b'revlog.debug-delta', |
|
588 | b'revlog.debug-delta', | |
589 | default=False, |
|
589 | default=False, | |
590 | ) |
|
590 | ) | |
591 | coreconfigitem( |
|
591 | coreconfigitem( | |
592 | b'defaults', |
|
592 | b'defaults', | |
593 | b'.*', |
|
593 | b'.*', | |
594 | default=None, |
|
594 | default=None, | |
595 | generic=True, |
|
595 | generic=True, | |
596 | ) |
|
596 | ) | |
597 | coreconfigitem( |
|
597 | coreconfigitem( | |
598 | b'devel', |
|
598 | b'devel', | |
599 | b'all-warnings', |
|
599 | b'all-warnings', | |
600 | default=False, |
|
600 | default=False, | |
601 | ) |
|
601 | ) | |
602 | coreconfigitem( |
|
602 | coreconfigitem( | |
603 | b'devel', |
|
603 | b'devel', | |
604 | b'bundle2.debug', |
|
604 | b'bundle2.debug', | |
605 | default=False, |
|
605 | default=False, | |
606 | ) |
|
606 | ) | |
607 | coreconfigitem( |
|
607 | coreconfigitem( | |
608 | b'devel', |
|
608 | b'devel', | |
609 | b'bundle.delta', |
|
609 | b'bundle.delta', | |
610 | default=b'', |
|
610 | default=b'', | |
611 | ) |
|
611 | ) | |
612 | coreconfigitem( |
|
612 | coreconfigitem( | |
613 | b'devel', |
|
613 | b'devel', | |
614 | b'cache-vfs', |
|
614 | b'cache-vfs', | |
615 | default=None, |
|
615 | default=None, | |
616 | ) |
|
616 | ) | |
617 | coreconfigitem( |
|
617 | coreconfigitem( | |
618 | b'devel', |
|
618 | b'devel', | |
619 | b'check-locks', |
|
619 | b'check-locks', | |
620 | default=False, |
|
620 | default=False, | |
621 | ) |
|
621 | ) | |
622 | coreconfigitem( |
|
622 | coreconfigitem( | |
623 | b'devel', |
|
623 | b'devel', | |
624 | b'check-relroot', |
|
624 | b'check-relroot', | |
625 | default=False, |
|
625 | default=False, | |
626 | ) |
|
626 | ) | |
627 | # Track copy information for all file, not just "added" one (very slow) |
|
627 | # Track copy information for all file, not just "added" one (very slow) | |
628 | coreconfigitem( |
|
628 | coreconfigitem( | |
629 | b'devel', |
|
629 | b'devel', | |
630 | b'copy-tracing.trace-all-files', |
|
630 | b'copy-tracing.trace-all-files', | |
631 | default=False, |
|
631 | default=False, | |
632 | ) |
|
632 | ) | |
633 | coreconfigitem( |
|
633 | coreconfigitem( | |
634 | b'devel', |
|
634 | b'devel', | |
635 | b'default-date', |
|
635 | b'default-date', | |
636 | default=None, |
|
636 | default=None, | |
637 | ) |
|
637 | ) | |
638 | coreconfigitem( |
|
638 | coreconfigitem( | |
639 | b'devel', |
|
639 | b'devel', | |
640 | b'deprec-warn', |
|
640 | b'deprec-warn', | |
641 | default=False, |
|
641 | default=False, | |
642 | ) |
|
642 | ) | |
643 | coreconfigitem( |
|
643 | coreconfigitem( | |
644 | b'devel', |
|
644 | b'devel', | |
645 | b'disableloaddefaultcerts', |
|
645 | b'disableloaddefaultcerts', | |
646 | default=False, |
|
646 | default=False, | |
647 | ) |
|
647 | ) | |
648 | coreconfigitem( |
|
648 | coreconfigitem( | |
649 | b'devel', |
|
649 | b'devel', | |
650 | b'warn-empty-changegroup', |
|
650 | b'warn-empty-changegroup', | |
651 | default=False, |
|
651 | default=False, | |
652 | ) |
|
652 | ) | |
653 | coreconfigitem( |
|
653 | coreconfigitem( | |
654 | b'devel', |
|
654 | b'devel', | |
655 | b'legacy.exchange', |
|
655 | b'legacy.exchange', | |
656 | default=list, |
|
656 | default=list, | |
657 | ) |
|
657 | ) | |
658 | # When True, revlogs use a special reference version of the nodemap, that is not |
|
658 | # When True, revlogs use a special reference version of the nodemap, that is not | |
659 | # performant but is "known" to behave properly. |
|
659 | # performant but is "known" to behave properly. | |
660 | coreconfigitem( |
|
660 | coreconfigitem( | |
661 | b'devel', |
|
661 | b'devel', | |
662 | b'persistent-nodemap', |
|
662 | b'persistent-nodemap', | |
663 | default=False, |
|
663 | default=False, | |
664 | ) |
|
664 | ) | |
665 | coreconfigitem( |
|
665 | coreconfigitem( | |
666 | b'devel', |
|
666 | b'devel', | |
667 | b'servercafile', |
|
667 | b'servercafile', | |
668 | default=b'', |
|
668 | default=b'', | |
669 | ) |
|
669 | ) | |
670 | coreconfigitem( |
|
670 | coreconfigitem( | |
671 | b'devel', |
|
671 | b'devel', | |
672 | b'serverexactprotocol', |
|
672 | b'serverexactprotocol', | |
673 | default=b'', |
|
673 | default=b'', | |
674 | ) |
|
674 | ) | |
675 | coreconfigitem( |
|
675 | coreconfigitem( | |
676 | b'devel', |
|
676 | b'devel', | |
677 | b'serverrequirecert', |
|
677 | b'serverrequirecert', | |
678 | default=False, |
|
678 | default=False, | |
679 | ) |
|
679 | ) | |
|
680 | # Makes the status algorithm wait for the existence of this file | |||
|
681 | # (or until a timeout of `devel.sync.status.pre-dirstate-write-file-timeout` | |||
|
682 | # seconds) before taking the lock and writing the dirstate. | |||
|
683 | # Status signals that it's ready to wait by creating a file | |||
|
684 | # with the same name + `.waiting`. | |||
|
685 | # Useful when testing race conditions. | |||
|
686 | coreconfigitem( | |||
|
687 | b'devel', | |||
|
688 | b'sync.status.pre-dirstate-write-file', | |||
|
689 | default=None, | |||
|
690 | ) | |||
|
691 | coreconfigitem( | |||
|
692 | b'devel', | |||
|
693 | b'sync.status.pre-dirstate-write-file-timeout', | |||
|
694 | default=2, | |||
|
695 | ) | |||
680 | coreconfigitem( |
|
696 | coreconfigitem( | |
681 | b'devel', |
|
697 | b'devel', | |
682 | b'strip-obsmarkers', |
|
698 | b'strip-obsmarkers', | |
683 | default=True, |
|
699 | default=True, | |
684 | ) |
|
700 | ) | |
685 | coreconfigitem( |
|
701 | coreconfigitem( | |
686 | b'devel', |
|
702 | b'devel', | |
687 | b'warn-config', |
|
703 | b'warn-config', | |
688 | default=None, |
|
704 | default=None, | |
689 | ) |
|
705 | ) | |
690 | coreconfigitem( |
|
706 | coreconfigitem( | |
691 | b'devel', |
|
707 | b'devel', | |
692 | b'warn-config-default', |
|
708 | b'warn-config-default', | |
693 | default=None, |
|
709 | default=None, | |
694 | ) |
|
710 | ) | |
695 | coreconfigitem( |
|
711 | coreconfigitem( | |
696 | b'devel', |
|
712 | b'devel', | |
697 | b'user.obsmarker', |
|
713 | b'user.obsmarker', | |
698 | default=None, |
|
714 | default=None, | |
699 | ) |
|
715 | ) | |
700 | coreconfigitem( |
|
716 | coreconfigitem( | |
701 | b'devel', |
|
717 | b'devel', | |
702 | b'warn-config-unknown', |
|
718 | b'warn-config-unknown', | |
703 | default=None, |
|
719 | default=None, | |
704 | ) |
|
720 | ) | |
705 | coreconfigitem( |
|
721 | coreconfigitem( | |
706 | b'devel', |
|
722 | b'devel', | |
707 | b'debug.copies', |
|
723 | b'debug.copies', | |
708 | default=False, |
|
724 | default=False, | |
709 | ) |
|
725 | ) | |
710 | coreconfigitem( |
|
726 | coreconfigitem( | |
711 | b'devel', |
|
727 | b'devel', | |
712 | b'copy-tracing.multi-thread', |
|
728 | b'copy-tracing.multi-thread', | |
713 | default=True, |
|
729 | default=True, | |
714 | ) |
|
730 | ) | |
715 | coreconfigitem( |
|
731 | coreconfigitem( | |
716 | b'devel', |
|
732 | b'devel', | |
717 | b'debug.extensions', |
|
733 | b'debug.extensions', | |
718 | default=False, |
|
734 | default=False, | |
719 | ) |
|
735 | ) | |
720 | coreconfigitem( |
|
736 | coreconfigitem( | |
721 | b'devel', |
|
737 | b'devel', | |
722 | b'debug.repo-filters', |
|
738 | b'debug.repo-filters', | |
723 | default=False, |
|
739 | default=False, | |
724 | ) |
|
740 | ) | |
725 | coreconfigitem( |
|
741 | coreconfigitem( | |
726 | b'devel', |
|
742 | b'devel', | |
727 | b'debug.peer-request', |
|
743 | b'debug.peer-request', | |
728 | default=False, |
|
744 | default=False, | |
729 | ) |
|
745 | ) | |
730 | # If discovery.exchange-heads is False, the discovery will not start with |
|
746 | # If discovery.exchange-heads is False, the discovery will not start with | |
731 | # remote head fetching and local head querying. |
|
747 | # remote head fetching and local head querying. | |
732 | coreconfigitem( |
|
748 | coreconfigitem( | |
733 | b'devel', |
|
749 | b'devel', | |
734 | b'discovery.exchange-heads', |
|
750 | b'discovery.exchange-heads', | |
735 | default=True, |
|
751 | default=True, | |
736 | ) |
|
752 | ) | |
737 | # If discovery.grow-sample is False, the sample size used in set discovery will |
|
753 | # If discovery.grow-sample is False, the sample size used in set discovery will | |
738 | # not be increased through the process |
|
754 | # not be increased through the process | |
739 | coreconfigitem( |
|
755 | coreconfigitem( | |
740 | b'devel', |
|
756 | b'devel', | |
741 | b'discovery.grow-sample', |
|
757 | b'discovery.grow-sample', | |
742 | default=True, |
|
758 | default=True, | |
743 | ) |
|
759 | ) | |
744 | # When discovery.grow-sample.dynamic is True, the default, the sample size is |
|
760 | # When discovery.grow-sample.dynamic is True, the default, the sample size is | |
745 | # adapted to the shape of the undecided set (it is set to the max of: |
|
761 | # adapted to the shape of the undecided set (it is set to the max of: | |
746 | # <target-size>, len(roots(undecided)), len(heads(undecided) |
|
762 | # <target-size>, len(roots(undecided)), len(heads(undecided) | |
747 | coreconfigitem( |
|
763 | coreconfigitem( | |
748 | b'devel', |
|
764 | b'devel', | |
749 | b'discovery.grow-sample.dynamic', |
|
765 | b'discovery.grow-sample.dynamic', | |
750 | default=True, |
|
766 | default=True, | |
751 | ) |
|
767 | ) | |
752 | # discovery.grow-sample.rate control the rate at which the sample grow |
|
768 | # discovery.grow-sample.rate control the rate at which the sample grow | |
753 | coreconfigitem( |
|
769 | coreconfigitem( | |
754 | b'devel', |
|
770 | b'devel', | |
755 | b'discovery.grow-sample.rate', |
|
771 | b'discovery.grow-sample.rate', | |
756 | default=1.05, |
|
772 | default=1.05, | |
757 | ) |
|
773 | ) | |
758 | # If discovery.randomize is False, random sampling during discovery are |
|
774 | # If discovery.randomize is False, random sampling during discovery are | |
759 | # deterministic. It is meant for integration tests. |
|
775 | # deterministic. It is meant for integration tests. | |
760 | coreconfigitem( |
|
776 | coreconfigitem( | |
761 | b'devel', |
|
777 | b'devel', | |
762 | b'discovery.randomize', |
|
778 | b'discovery.randomize', | |
763 | default=True, |
|
779 | default=True, | |
764 | ) |
|
780 | ) | |
765 | # Control the initial size of the discovery sample |
|
781 | # Control the initial size of the discovery sample | |
766 | coreconfigitem( |
|
782 | coreconfigitem( | |
767 | b'devel', |
|
783 | b'devel', | |
768 | b'discovery.sample-size', |
|
784 | b'discovery.sample-size', | |
769 | default=200, |
|
785 | default=200, | |
770 | ) |
|
786 | ) | |
771 | # Control the initial size of the discovery for initial change |
|
787 | # Control the initial size of the discovery for initial change | |
772 | coreconfigitem( |
|
788 | coreconfigitem( | |
773 | b'devel', |
|
789 | b'devel', | |
774 | b'discovery.sample-size.initial', |
|
790 | b'discovery.sample-size.initial', | |
775 | default=100, |
|
791 | default=100, | |
776 | ) |
|
792 | ) | |
777 | _registerdiffopts(section=b'diff') |
|
793 | _registerdiffopts(section=b'diff') | |
778 | coreconfigitem( |
|
794 | coreconfigitem( | |
779 | b'diff', |
|
795 | b'diff', | |
780 | b'merge', |
|
796 | b'merge', | |
781 | default=False, |
|
797 | default=False, | |
782 | experimental=True, |
|
798 | experimental=True, | |
783 | ) |
|
799 | ) | |
784 | coreconfigitem( |
|
800 | coreconfigitem( | |
785 | b'email', |
|
801 | b'email', | |
786 | b'bcc', |
|
802 | b'bcc', | |
787 | default=None, |
|
803 | default=None, | |
788 | ) |
|
804 | ) | |
789 | coreconfigitem( |
|
805 | coreconfigitem( | |
790 | b'email', |
|
806 | b'email', | |
791 | b'cc', |
|
807 | b'cc', | |
792 | default=None, |
|
808 | default=None, | |
793 | ) |
|
809 | ) | |
794 | coreconfigitem( |
|
810 | coreconfigitem( | |
795 | b'email', |
|
811 | b'email', | |
796 | b'charsets', |
|
812 | b'charsets', | |
797 | default=list, |
|
813 | default=list, | |
798 | ) |
|
814 | ) | |
799 | coreconfigitem( |
|
815 | coreconfigitem( | |
800 | b'email', |
|
816 | b'email', | |
801 | b'from', |
|
817 | b'from', | |
802 | default=None, |
|
818 | default=None, | |
803 | ) |
|
819 | ) | |
804 | coreconfigitem( |
|
820 | coreconfigitem( | |
805 | b'email', |
|
821 | b'email', | |
806 | b'method', |
|
822 | b'method', | |
807 | default=b'smtp', |
|
823 | default=b'smtp', | |
808 | ) |
|
824 | ) | |
809 | coreconfigitem( |
|
825 | coreconfigitem( | |
810 | b'email', |
|
826 | b'email', | |
811 | b'reply-to', |
|
827 | b'reply-to', | |
812 | default=None, |
|
828 | default=None, | |
813 | ) |
|
829 | ) | |
814 | coreconfigitem( |
|
830 | coreconfigitem( | |
815 | b'email', |
|
831 | b'email', | |
816 | b'to', |
|
832 | b'to', | |
817 | default=None, |
|
833 | default=None, | |
818 | ) |
|
834 | ) | |
819 | coreconfigitem( |
|
835 | coreconfigitem( | |
820 | b'experimental', |
|
836 | b'experimental', | |
821 | b'archivemetatemplate', |
|
837 | b'archivemetatemplate', | |
822 | default=dynamicdefault, |
|
838 | default=dynamicdefault, | |
823 | ) |
|
839 | ) | |
824 | coreconfigitem( |
|
840 | coreconfigitem( | |
825 | b'experimental', |
|
841 | b'experimental', | |
826 | b'auto-publish', |
|
842 | b'auto-publish', | |
827 | default=b'publish', |
|
843 | default=b'publish', | |
828 | ) |
|
844 | ) | |
829 | coreconfigitem( |
|
845 | coreconfigitem( | |
830 | b'experimental', |
|
846 | b'experimental', | |
831 | b'bundle-phases', |
|
847 | b'bundle-phases', | |
832 | default=False, |
|
848 | default=False, | |
833 | ) |
|
849 | ) | |
834 | coreconfigitem( |
|
850 | coreconfigitem( | |
835 | b'experimental', |
|
851 | b'experimental', | |
836 | b'bundle2-advertise', |
|
852 | b'bundle2-advertise', | |
837 | default=True, |
|
853 | default=True, | |
838 | ) |
|
854 | ) | |
839 | coreconfigitem( |
|
855 | coreconfigitem( | |
840 | b'experimental', |
|
856 | b'experimental', | |
841 | b'bundle2-output-capture', |
|
857 | b'bundle2-output-capture', | |
842 | default=False, |
|
858 | default=False, | |
843 | ) |
|
859 | ) | |
844 | coreconfigitem( |
|
860 | coreconfigitem( | |
845 | b'experimental', |
|
861 | b'experimental', | |
846 | b'bundle2.pushback', |
|
862 | b'bundle2.pushback', | |
847 | default=False, |
|
863 | default=False, | |
848 | ) |
|
864 | ) | |
849 | coreconfigitem( |
|
865 | coreconfigitem( | |
850 | b'experimental', |
|
866 | b'experimental', | |
851 | b'bundle2lazylocking', |
|
867 | b'bundle2lazylocking', | |
852 | default=False, |
|
868 | default=False, | |
853 | ) |
|
869 | ) | |
854 | coreconfigitem( |
|
870 | coreconfigitem( | |
855 | b'experimental', |
|
871 | b'experimental', | |
856 | b'bundlecomplevel', |
|
872 | b'bundlecomplevel', | |
857 | default=None, |
|
873 | default=None, | |
858 | ) |
|
874 | ) | |
859 | coreconfigitem( |
|
875 | coreconfigitem( | |
860 | b'experimental', |
|
876 | b'experimental', | |
861 | b'bundlecomplevel.bzip2', |
|
877 | b'bundlecomplevel.bzip2', | |
862 | default=None, |
|
878 | default=None, | |
863 | ) |
|
879 | ) | |
864 | coreconfigitem( |
|
880 | coreconfigitem( | |
865 | b'experimental', |
|
881 | b'experimental', | |
866 | b'bundlecomplevel.gzip', |
|
882 | b'bundlecomplevel.gzip', | |
867 | default=None, |
|
883 | default=None, | |
868 | ) |
|
884 | ) | |
869 | coreconfigitem( |
|
885 | coreconfigitem( | |
870 | b'experimental', |
|
886 | b'experimental', | |
871 | b'bundlecomplevel.none', |
|
887 | b'bundlecomplevel.none', | |
872 | default=None, |
|
888 | default=None, | |
873 | ) |
|
889 | ) | |
874 | coreconfigitem( |
|
890 | coreconfigitem( | |
875 | b'experimental', |
|
891 | b'experimental', | |
876 | b'bundlecomplevel.zstd', |
|
892 | b'bundlecomplevel.zstd', | |
877 | default=None, |
|
893 | default=None, | |
878 | ) |
|
894 | ) | |
879 | coreconfigitem( |
|
895 | coreconfigitem( | |
880 | b'experimental', |
|
896 | b'experimental', | |
881 | b'bundlecompthreads', |
|
897 | b'bundlecompthreads', | |
882 | default=None, |
|
898 | default=None, | |
883 | ) |
|
899 | ) | |
884 | coreconfigitem( |
|
900 | coreconfigitem( | |
885 | b'experimental', |
|
901 | b'experimental', | |
886 | b'bundlecompthreads.bzip2', |
|
902 | b'bundlecompthreads.bzip2', | |
887 | default=None, |
|
903 | default=None, | |
888 | ) |
|
904 | ) | |
889 | coreconfigitem( |
|
905 | coreconfigitem( | |
890 | b'experimental', |
|
906 | b'experimental', | |
891 | b'bundlecompthreads.gzip', |
|
907 | b'bundlecompthreads.gzip', | |
892 | default=None, |
|
908 | default=None, | |
893 | ) |
|
909 | ) | |
894 | coreconfigitem( |
|
910 | coreconfigitem( | |
895 | b'experimental', |
|
911 | b'experimental', | |
896 | b'bundlecompthreads.none', |
|
912 | b'bundlecompthreads.none', | |
897 | default=None, |
|
913 | default=None, | |
898 | ) |
|
914 | ) | |
899 | coreconfigitem( |
|
915 | coreconfigitem( | |
900 | b'experimental', |
|
916 | b'experimental', | |
901 | b'bundlecompthreads.zstd', |
|
917 | b'bundlecompthreads.zstd', | |
902 | default=None, |
|
918 | default=None, | |
903 | ) |
|
919 | ) | |
904 | coreconfigitem( |
|
920 | coreconfigitem( | |
905 | b'experimental', |
|
921 | b'experimental', | |
906 | b'changegroup3', |
|
922 | b'changegroup3', | |
907 | default=False, |
|
923 | default=False, | |
908 | ) |
|
924 | ) | |
909 | coreconfigitem( |
|
925 | coreconfigitem( | |
910 | b'experimental', |
|
926 | b'experimental', | |
911 | b'changegroup4', |
|
927 | b'changegroup4', | |
912 | default=False, |
|
928 | default=False, | |
913 | ) |
|
929 | ) | |
914 | coreconfigitem( |
|
930 | coreconfigitem( | |
915 | b'experimental', |
|
931 | b'experimental', | |
916 | b'cleanup-as-archived', |
|
932 | b'cleanup-as-archived', | |
917 | default=False, |
|
933 | default=False, | |
918 | ) |
|
934 | ) | |
919 | coreconfigitem( |
|
935 | coreconfigitem( | |
920 | b'experimental', |
|
936 | b'experimental', | |
921 | b'clientcompressionengines', |
|
937 | b'clientcompressionengines', | |
922 | default=list, |
|
938 | default=list, | |
923 | ) |
|
939 | ) | |
924 | coreconfigitem( |
|
940 | coreconfigitem( | |
925 | b'experimental', |
|
941 | b'experimental', | |
926 | b'copytrace', |
|
942 | b'copytrace', | |
927 | default=b'on', |
|
943 | default=b'on', | |
928 | ) |
|
944 | ) | |
929 | coreconfigitem( |
|
945 | coreconfigitem( | |
930 | b'experimental', |
|
946 | b'experimental', | |
931 | b'copytrace.movecandidateslimit', |
|
947 | b'copytrace.movecandidateslimit', | |
932 | default=100, |
|
948 | default=100, | |
933 | ) |
|
949 | ) | |
934 | coreconfigitem( |
|
950 | coreconfigitem( | |
935 | b'experimental', |
|
951 | b'experimental', | |
936 | b'copytrace.sourcecommitlimit', |
|
952 | b'copytrace.sourcecommitlimit', | |
937 | default=100, |
|
953 | default=100, | |
938 | ) |
|
954 | ) | |
939 | coreconfigitem( |
|
955 | coreconfigitem( | |
940 | b'experimental', |
|
956 | b'experimental', | |
941 | b'copies.read-from', |
|
957 | b'copies.read-from', | |
942 | default=b"filelog-only", |
|
958 | default=b"filelog-only", | |
943 | ) |
|
959 | ) | |
944 | coreconfigitem( |
|
960 | coreconfigitem( | |
945 | b'experimental', |
|
961 | b'experimental', | |
946 | b'copies.write-to', |
|
962 | b'copies.write-to', | |
947 | default=b'filelog-only', |
|
963 | default=b'filelog-only', | |
948 | ) |
|
964 | ) | |
949 | coreconfigitem( |
|
965 | coreconfigitem( | |
950 | b'experimental', |
|
966 | b'experimental', | |
951 | b'crecordtest', |
|
967 | b'crecordtest', | |
952 | default=None, |
|
968 | default=None, | |
953 | ) |
|
969 | ) | |
954 | coreconfigitem( |
|
970 | coreconfigitem( | |
955 | b'experimental', |
|
971 | b'experimental', | |
956 | b'directaccess', |
|
972 | b'directaccess', | |
957 | default=False, |
|
973 | default=False, | |
958 | ) |
|
974 | ) | |
959 | coreconfigitem( |
|
975 | coreconfigitem( | |
960 | b'experimental', |
|
976 | b'experimental', | |
961 | b'directaccess.revnums', |
|
977 | b'directaccess.revnums', | |
962 | default=False, |
|
978 | default=False, | |
963 | ) |
|
979 | ) | |
964 | coreconfigitem( |
|
980 | coreconfigitem( | |
965 | b'experimental', |
|
981 | b'experimental', | |
966 | b'editortmpinhg', |
|
982 | b'editortmpinhg', | |
967 | default=False, |
|
983 | default=False, | |
968 | ) |
|
984 | ) | |
969 | coreconfigitem( |
|
985 | coreconfigitem( | |
970 | b'experimental', |
|
986 | b'experimental', | |
971 | b'evolution', |
|
987 | b'evolution', | |
972 | default=list, |
|
988 | default=list, | |
973 | ) |
|
989 | ) | |
974 | coreconfigitem( |
|
990 | coreconfigitem( | |
975 | b'experimental', |
|
991 | b'experimental', | |
976 | b'evolution.allowdivergence', |
|
992 | b'evolution.allowdivergence', | |
977 | default=False, |
|
993 | default=False, | |
978 | alias=[(b'experimental', b'allowdivergence')], |
|
994 | alias=[(b'experimental', b'allowdivergence')], | |
979 | ) |
|
995 | ) | |
980 | coreconfigitem( |
|
996 | coreconfigitem( | |
981 | b'experimental', |
|
997 | b'experimental', | |
982 | b'evolution.allowunstable', |
|
998 | b'evolution.allowunstable', | |
983 | default=None, |
|
999 | default=None, | |
984 | ) |
|
1000 | ) | |
985 | coreconfigitem( |
|
1001 | coreconfigitem( | |
986 | b'experimental', |
|
1002 | b'experimental', | |
987 | b'evolution.createmarkers', |
|
1003 | b'evolution.createmarkers', | |
988 | default=None, |
|
1004 | default=None, | |
989 | ) |
|
1005 | ) | |
990 | coreconfigitem( |
|
1006 | coreconfigitem( | |
991 | b'experimental', |
|
1007 | b'experimental', | |
992 | b'evolution.effect-flags', |
|
1008 | b'evolution.effect-flags', | |
993 | default=True, |
|
1009 | default=True, | |
994 | alias=[(b'experimental', b'effect-flags')], |
|
1010 | alias=[(b'experimental', b'effect-flags')], | |
995 | ) |
|
1011 | ) | |
996 | coreconfigitem( |
|
1012 | coreconfigitem( | |
997 | b'experimental', |
|
1013 | b'experimental', | |
998 | b'evolution.exchange', |
|
1014 | b'evolution.exchange', | |
999 | default=None, |
|
1015 | default=None, | |
1000 | ) |
|
1016 | ) | |
1001 | coreconfigitem( |
|
1017 | coreconfigitem( | |
1002 | b'experimental', |
|
1018 | b'experimental', | |
1003 | b'evolution.bundle-obsmarker', |
|
1019 | b'evolution.bundle-obsmarker', | |
1004 | default=False, |
|
1020 | default=False, | |
1005 | ) |
|
1021 | ) | |
1006 | coreconfigitem( |
|
1022 | coreconfigitem( | |
1007 | b'experimental', |
|
1023 | b'experimental', | |
1008 | b'evolution.bundle-obsmarker:mandatory', |
|
1024 | b'evolution.bundle-obsmarker:mandatory', | |
1009 | default=True, |
|
1025 | default=True, | |
1010 | ) |
|
1026 | ) | |
1011 | coreconfigitem( |
|
1027 | coreconfigitem( | |
1012 | b'experimental', |
|
1028 | b'experimental', | |
1013 | b'log.topo', |
|
1029 | b'log.topo', | |
1014 | default=False, |
|
1030 | default=False, | |
1015 | ) |
|
1031 | ) | |
1016 | coreconfigitem( |
|
1032 | coreconfigitem( | |
1017 | b'experimental', |
|
1033 | b'experimental', | |
1018 | b'evolution.report-instabilities', |
|
1034 | b'evolution.report-instabilities', | |
1019 | default=True, |
|
1035 | default=True, | |
1020 | ) |
|
1036 | ) | |
1021 | coreconfigitem( |
|
1037 | coreconfigitem( | |
1022 | b'experimental', |
|
1038 | b'experimental', | |
1023 | b'evolution.track-operation', |
|
1039 | b'evolution.track-operation', | |
1024 | default=True, |
|
1040 | default=True, | |
1025 | ) |
|
1041 | ) | |
1026 | # repo-level config to exclude a revset visibility |
|
1042 | # repo-level config to exclude a revset visibility | |
1027 | # |
|
1043 | # | |
1028 | # The target use case is to use `share` to expose different subset of the same |
|
1044 | # The target use case is to use `share` to expose different subset of the same | |
1029 | # repository, especially server side. See also `server.view`. |
|
1045 | # repository, especially server side. See also `server.view`. | |
1030 | coreconfigitem( |
|
1046 | coreconfigitem( | |
1031 | b'experimental', |
|
1047 | b'experimental', | |
1032 | b'extra-filter-revs', |
|
1048 | b'extra-filter-revs', | |
1033 | default=None, |
|
1049 | default=None, | |
1034 | ) |
|
1050 | ) | |
1035 | coreconfigitem( |
|
1051 | coreconfigitem( | |
1036 | b'experimental', |
|
1052 | b'experimental', | |
1037 | b'maxdeltachainspan', |
|
1053 | b'maxdeltachainspan', | |
1038 | default=-1, |
|
1054 | default=-1, | |
1039 | ) |
|
1055 | ) | |
1040 | # tracks files which were undeleted (merge might delete them but we explicitly |
|
1056 | # tracks files which were undeleted (merge might delete them but we explicitly | |
1041 | # kept/undeleted them) and creates new filenodes for them |
|
1057 | # kept/undeleted them) and creates new filenodes for them | |
1042 | coreconfigitem( |
|
1058 | coreconfigitem( | |
1043 | b'experimental', |
|
1059 | b'experimental', | |
1044 | b'merge-track-salvaged', |
|
1060 | b'merge-track-salvaged', | |
1045 | default=False, |
|
1061 | default=False, | |
1046 | ) |
|
1062 | ) | |
1047 | coreconfigitem( |
|
1063 | coreconfigitem( | |
1048 | b'experimental', |
|
1064 | b'experimental', | |
1049 | b'mmapindexthreshold', |
|
1065 | b'mmapindexthreshold', | |
1050 | default=None, |
|
1066 | default=None, | |
1051 | ) |
|
1067 | ) | |
1052 | coreconfigitem( |
|
1068 | coreconfigitem( | |
1053 | b'experimental', |
|
1069 | b'experimental', | |
1054 | b'narrow', |
|
1070 | b'narrow', | |
1055 | default=False, |
|
1071 | default=False, | |
1056 | ) |
|
1072 | ) | |
1057 | coreconfigitem( |
|
1073 | coreconfigitem( | |
1058 | b'experimental', |
|
1074 | b'experimental', | |
1059 | b'nonnormalparanoidcheck', |
|
1075 | b'nonnormalparanoidcheck', | |
1060 | default=False, |
|
1076 | default=False, | |
1061 | ) |
|
1077 | ) | |
1062 | coreconfigitem( |
|
1078 | coreconfigitem( | |
1063 | b'experimental', |
|
1079 | b'experimental', | |
1064 | b'exportableenviron', |
|
1080 | b'exportableenviron', | |
1065 | default=list, |
|
1081 | default=list, | |
1066 | ) |
|
1082 | ) | |
1067 | coreconfigitem( |
|
1083 | coreconfigitem( | |
1068 | b'experimental', |
|
1084 | b'experimental', | |
1069 | b'extendedheader.index', |
|
1085 | b'extendedheader.index', | |
1070 | default=None, |
|
1086 | default=None, | |
1071 | ) |
|
1087 | ) | |
1072 | coreconfigitem( |
|
1088 | coreconfigitem( | |
1073 | b'experimental', |
|
1089 | b'experimental', | |
1074 | b'extendedheader.similarity', |
|
1090 | b'extendedheader.similarity', | |
1075 | default=False, |
|
1091 | default=False, | |
1076 | ) |
|
1092 | ) | |
1077 | coreconfigitem( |
|
1093 | coreconfigitem( | |
1078 | b'experimental', |
|
1094 | b'experimental', | |
1079 | b'graphshorten', |
|
1095 | b'graphshorten', | |
1080 | default=False, |
|
1096 | default=False, | |
1081 | ) |
|
1097 | ) | |
1082 | coreconfigitem( |
|
1098 | coreconfigitem( | |
1083 | b'experimental', |
|
1099 | b'experimental', | |
1084 | b'graphstyle.parent', |
|
1100 | b'graphstyle.parent', | |
1085 | default=dynamicdefault, |
|
1101 | default=dynamicdefault, | |
1086 | ) |
|
1102 | ) | |
1087 | coreconfigitem( |
|
1103 | coreconfigitem( | |
1088 | b'experimental', |
|
1104 | b'experimental', | |
1089 | b'graphstyle.missing', |
|
1105 | b'graphstyle.missing', | |
1090 | default=dynamicdefault, |
|
1106 | default=dynamicdefault, | |
1091 | ) |
|
1107 | ) | |
1092 | coreconfigitem( |
|
1108 | coreconfigitem( | |
1093 | b'experimental', |
|
1109 | b'experimental', | |
1094 | b'graphstyle.grandparent', |
|
1110 | b'graphstyle.grandparent', | |
1095 | default=dynamicdefault, |
|
1111 | default=dynamicdefault, | |
1096 | ) |
|
1112 | ) | |
1097 | coreconfigitem( |
|
1113 | coreconfigitem( | |
1098 | b'experimental', |
|
1114 | b'experimental', | |
1099 | b'hook-track-tags', |
|
1115 | b'hook-track-tags', | |
1100 | default=False, |
|
1116 | default=False, | |
1101 | ) |
|
1117 | ) | |
1102 | coreconfigitem( |
|
1118 | coreconfigitem( | |
1103 | b'experimental', |
|
1119 | b'experimental', | |
1104 | b'httppostargs', |
|
1120 | b'httppostargs', | |
1105 | default=False, |
|
1121 | default=False, | |
1106 | ) |
|
1122 | ) | |
1107 | coreconfigitem(b'experimental', b'nointerrupt', default=False) |
|
1123 | coreconfigitem(b'experimental', b'nointerrupt', default=False) | |
1108 | coreconfigitem(b'experimental', b'nointerrupt-interactiveonly', default=True) |
|
1124 | coreconfigitem(b'experimental', b'nointerrupt-interactiveonly', default=True) | |
1109 |
|
1125 | |||
1110 | coreconfigitem( |
|
1126 | coreconfigitem( | |
1111 | b'experimental', |
|
1127 | b'experimental', | |
1112 | b'obsmarkers-exchange-debug', |
|
1128 | b'obsmarkers-exchange-debug', | |
1113 | default=False, |
|
1129 | default=False, | |
1114 | ) |
|
1130 | ) | |
1115 | coreconfigitem( |
|
1131 | coreconfigitem( | |
1116 | b'experimental', |
|
1132 | b'experimental', | |
1117 | b'remotenames', |
|
1133 | b'remotenames', | |
1118 | default=False, |
|
1134 | default=False, | |
1119 | ) |
|
1135 | ) | |
1120 | coreconfigitem( |
|
1136 | coreconfigitem( | |
1121 | b'experimental', |
|
1137 | b'experimental', | |
1122 | b'removeemptydirs', |
|
1138 | b'removeemptydirs', | |
1123 | default=True, |
|
1139 | default=True, | |
1124 | ) |
|
1140 | ) | |
1125 | coreconfigitem( |
|
1141 | coreconfigitem( | |
1126 | b'experimental', |
|
1142 | b'experimental', | |
1127 | b'revert.interactive.select-to-keep', |
|
1143 | b'revert.interactive.select-to-keep', | |
1128 | default=False, |
|
1144 | default=False, | |
1129 | ) |
|
1145 | ) | |
1130 | coreconfigitem( |
|
1146 | coreconfigitem( | |
1131 | b'experimental', |
|
1147 | b'experimental', | |
1132 | b'revisions.prefixhexnode', |
|
1148 | b'revisions.prefixhexnode', | |
1133 | default=False, |
|
1149 | default=False, | |
1134 | ) |
|
1150 | ) | |
1135 | # "out of experimental" todo list. |
|
1151 | # "out of experimental" todo list. | |
1136 | # |
|
1152 | # | |
1137 | # * include management of a persistent nodemap in the main docket |
|
1153 | # * include management of a persistent nodemap in the main docket | |
1138 | # * enforce a "no-truncate" policy for mmap safety |
|
1154 | # * enforce a "no-truncate" policy for mmap safety | |
1139 | # - for censoring operation |
|
1155 | # - for censoring operation | |
1140 | # - for stripping operation |
|
1156 | # - for stripping operation | |
1141 | # - for rollback operation |
|
1157 | # - for rollback operation | |
1142 | # * proper streaming (race free) of the docket file |
|
1158 | # * proper streaming (race free) of the docket file | |
1143 | # * track garbage data to evemtually allow rewriting -existing- sidedata. |
|
1159 | # * track garbage data to evemtually allow rewriting -existing- sidedata. | |
1144 | # * Exchange-wise, we will also need to do something more efficient than |
|
1160 | # * Exchange-wise, we will also need to do something more efficient than | |
1145 | # keeping references to the affected revlogs, especially memory-wise when |
|
1161 | # keeping references to the affected revlogs, especially memory-wise when | |
1146 | # rewriting sidedata. |
|
1162 | # rewriting sidedata. | |
1147 | # * introduce a proper solution to reduce the number of filelog related files. |
|
1163 | # * introduce a proper solution to reduce the number of filelog related files. | |
1148 | # * use caching for reading sidedata (similar to what we do for data). |
|
1164 | # * use caching for reading sidedata (similar to what we do for data). | |
1149 | # * no longer set offset=0 if sidedata_size=0 (simplify cutoff computation). |
|
1165 | # * no longer set offset=0 if sidedata_size=0 (simplify cutoff computation). | |
1150 | # * Improvement to consider |
|
1166 | # * Improvement to consider | |
1151 | # - avoid compression header in chunk using the default compression? |
|
1167 | # - avoid compression header in chunk using the default compression? | |
1152 | # - forbid "inline" compression mode entirely? |
|
1168 | # - forbid "inline" compression mode entirely? | |
1153 | # - split the data offset and flag field (the 2 bytes save are mostly trouble) |
|
1169 | # - split the data offset and flag field (the 2 bytes save are mostly trouble) | |
1154 | # - keep track of uncompressed -chunk- size (to preallocate memory better) |
|
1170 | # - keep track of uncompressed -chunk- size (to preallocate memory better) | |
1155 | # - keep track of chain base or size (probably not that useful anymore) |
|
1171 | # - keep track of chain base or size (probably not that useful anymore) | |
1156 | coreconfigitem( |
|
1172 | coreconfigitem( | |
1157 | b'experimental', |
|
1173 | b'experimental', | |
1158 | b'revlogv2', |
|
1174 | b'revlogv2', | |
1159 | default=None, |
|
1175 | default=None, | |
1160 | ) |
|
1176 | ) | |
1161 | coreconfigitem( |
|
1177 | coreconfigitem( | |
1162 | b'experimental', |
|
1178 | b'experimental', | |
1163 | b'revisions.disambiguatewithin', |
|
1179 | b'revisions.disambiguatewithin', | |
1164 | default=None, |
|
1180 | default=None, | |
1165 | ) |
|
1181 | ) | |
1166 | coreconfigitem( |
|
1182 | coreconfigitem( | |
1167 | b'experimental', |
|
1183 | b'experimental', | |
1168 | b'rust.index', |
|
1184 | b'rust.index', | |
1169 | default=False, |
|
1185 | default=False, | |
1170 | ) |
|
1186 | ) | |
1171 | coreconfigitem( |
|
1187 | coreconfigitem( | |
1172 | b'experimental', |
|
1188 | b'experimental', | |
1173 | b'server.filesdata.recommended-batch-size', |
|
1189 | b'server.filesdata.recommended-batch-size', | |
1174 | default=50000, |
|
1190 | default=50000, | |
1175 | ) |
|
1191 | ) | |
1176 | coreconfigitem( |
|
1192 | coreconfigitem( | |
1177 | b'experimental', |
|
1193 | b'experimental', | |
1178 | b'server.manifestdata.recommended-batch-size', |
|
1194 | b'server.manifestdata.recommended-batch-size', | |
1179 | default=100000, |
|
1195 | default=100000, | |
1180 | ) |
|
1196 | ) | |
1181 | coreconfigitem( |
|
1197 | coreconfigitem( | |
1182 | b'experimental', |
|
1198 | b'experimental', | |
1183 | b'server.stream-narrow-clones', |
|
1199 | b'server.stream-narrow-clones', | |
1184 | default=False, |
|
1200 | default=False, | |
1185 | ) |
|
1201 | ) | |
1186 | coreconfigitem( |
|
1202 | coreconfigitem( | |
1187 | b'experimental', |
|
1203 | b'experimental', | |
1188 | b'single-head-per-branch', |
|
1204 | b'single-head-per-branch', | |
1189 | default=False, |
|
1205 | default=False, | |
1190 | ) |
|
1206 | ) | |
1191 | coreconfigitem( |
|
1207 | coreconfigitem( | |
1192 | b'experimental', |
|
1208 | b'experimental', | |
1193 | b'single-head-per-branch:account-closed-heads', |
|
1209 | b'single-head-per-branch:account-closed-heads', | |
1194 | default=False, |
|
1210 | default=False, | |
1195 | ) |
|
1211 | ) | |
1196 | coreconfigitem( |
|
1212 | coreconfigitem( | |
1197 | b'experimental', |
|
1213 | b'experimental', | |
1198 | b'single-head-per-branch:public-changes-only', |
|
1214 | b'single-head-per-branch:public-changes-only', | |
1199 | default=False, |
|
1215 | default=False, | |
1200 | ) |
|
1216 | ) | |
1201 | coreconfigitem( |
|
1217 | coreconfigitem( | |
1202 | b'experimental', |
|
1218 | b'experimental', | |
1203 | b'sparse-read', |
|
1219 | b'sparse-read', | |
1204 | default=False, |
|
1220 | default=False, | |
1205 | ) |
|
1221 | ) | |
1206 | coreconfigitem( |
|
1222 | coreconfigitem( | |
1207 | b'experimental', |
|
1223 | b'experimental', | |
1208 | b'sparse-read.density-threshold', |
|
1224 | b'sparse-read.density-threshold', | |
1209 | default=0.50, |
|
1225 | default=0.50, | |
1210 | ) |
|
1226 | ) | |
1211 | coreconfigitem( |
|
1227 | coreconfigitem( | |
1212 | b'experimental', |
|
1228 | b'experimental', | |
1213 | b'sparse-read.min-gap-size', |
|
1229 | b'sparse-read.min-gap-size', | |
1214 | default=b'65K', |
|
1230 | default=b'65K', | |
1215 | ) |
|
1231 | ) | |
1216 | coreconfigitem( |
|
1232 | coreconfigitem( | |
1217 | b'experimental', |
|
1233 | b'experimental', | |
1218 | b'treemanifest', |
|
1234 | b'treemanifest', | |
1219 | default=False, |
|
1235 | default=False, | |
1220 | ) |
|
1236 | ) | |
1221 | coreconfigitem( |
|
1237 | coreconfigitem( | |
1222 | b'experimental', |
|
1238 | b'experimental', | |
1223 | b'update.atomic-file', |
|
1239 | b'update.atomic-file', | |
1224 | default=False, |
|
1240 | default=False, | |
1225 | ) |
|
1241 | ) | |
1226 | coreconfigitem( |
|
1242 | coreconfigitem( | |
1227 | b'experimental', |
|
1243 | b'experimental', | |
1228 | b'web.full-garbage-collection-rate', |
|
1244 | b'web.full-garbage-collection-rate', | |
1229 | default=1, # still forcing a full collection on each request |
|
1245 | default=1, # still forcing a full collection on each request | |
1230 | ) |
|
1246 | ) | |
1231 | coreconfigitem( |
|
1247 | coreconfigitem( | |
1232 | b'experimental', |
|
1248 | b'experimental', | |
1233 | b'worker.wdir-get-thread-safe', |
|
1249 | b'worker.wdir-get-thread-safe', | |
1234 | default=False, |
|
1250 | default=False, | |
1235 | ) |
|
1251 | ) | |
1236 | coreconfigitem( |
|
1252 | coreconfigitem( | |
1237 | b'experimental', |
|
1253 | b'experimental', | |
1238 | b'worker.repository-upgrade', |
|
1254 | b'worker.repository-upgrade', | |
1239 | default=False, |
|
1255 | default=False, | |
1240 | ) |
|
1256 | ) | |
1241 | coreconfigitem( |
|
1257 | coreconfigitem( | |
1242 | b'experimental', |
|
1258 | b'experimental', | |
1243 | b'xdiff', |
|
1259 | b'xdiff', | |
1244 | default=False, |
|
1260 | default=False, | |
1245 | ) |
|
1261 | ) | |
1246 | coreconfigitem( |
|
1262 | coreconfigitem( | |
1247 | b'extensions', |
|
1263 | b'extensions', | |
1248 | b'[^:]*', |
|
1264 | b'[^:]*', | |
1249 | default=None, |
|
1265 | default=None, | |
1250 | generic=True, |
|
1266 | generic=True, | |
1251 | ) |
|
1267 | ) | |
1252 | coreconfigitem( |
|
1268 | coreconfigitem( | |
1253 | b'extensions', |
|
1269 | b'extensions', | |
1254 | b'[^:]*:required', |
|
1270 | b'[^:]*:required', | |
1255 | default=False, |
|
1271 | default=False, | |
1256 | generic=True, |
|
1272 | generic=True, | |
1257 | ) |
|
1273 | ) | |
1258 | coreconfigitem( |
|
1274 | coreconfigitem( | |
1259 | b'extdata', |
|
1275 | b'extdata', | |
1260 | b'.*', |
|
1276 | b'.*', | |
1261 | default=None, |
|
1277 | default=None, | |
1262 | generic=True, |
|
1278 | generic=True, | |
1263 | ) |
|
1279 | ) | |
1264 | coreconfigitem( |
|
1280 | coreconfigitem( | |
1265 | b'format', |
|
1281 | b'format', | |
1266 | b'bookmarks-in-store', |
|
1282 | b'bookmarks-in-store', | |
1267 | default=False, |
|
1283 | default=False, | |
1268 | ) |
|
1284 | ) | |
1269 | coreconfigitem( |
|
1285 | coreconfigitem( | |
1270 | b'format', |
|
1286 | b'format', | |
1271 | b'chunkcachesize', |
|
1287 | b'chunkcachesize', | |
1272 | default=None, |
|
1288 | default=None, | |
1273 | experimental=True, |
|
1289 | experimental=True, | |
1274 | ) |
|
1290 | ) | |
1275 | coreconfigitem( |
|
1291 | coreconfigitem( | |
1276 | # Enable this dirstate format *when creating a new repository*. |
|
1292 | # Enable this dirstate format *when creating a new repository*. | |
1277 | # Which format to use for existing repos is controlled by .hg/requires |
|
1293 | # Which format to use for existing repos is controlled by .hg/requires | |
1278 | b'format', |
|
1294 | b'format', | |
1279 | b'use-dirstate-v2', |
|
1295 | b'use-dirstate-v2', | |
1280 | default=False, |
|
1296 | default=False, | |
1281 | experimental=True, |
|
1297 | experimental=True, | |
1282 | alias=[(b'format', b'exp-rc-dirstate-v2')], |
|
1298 | alias=[(b'format', b'exp-rc-dirstate-v2')], | |
1283 | ) |
|
1299 | ) | |
1284 | coreconfigitem( |
|
1300 | coreconfigitem( | |
1285 | b'format', |
|
1301 | b'format', | |
1286 | b'use-dirstate-v2.automatic-upgrade-of-mismatching-repositories', |
|
1302 | b'use-dirstate-v2.automatic-upgrade-of-mismatching-repositories', | |
1287 | default=False, |
|
1303 | default=False, | |
1288 | experimental=True, |
|
1304 | experimental=True, | |
1289 | ) |
|
1305 | ) | |
1290 | coreconfigitem( |
|
1306 | coreconfigitem( | |
1291 | b'format', |
|
1307 | b'format', | |
1292 | b'use-dirstate-v2.automatic-upgrade-of-mismatching-repositories:quiet', |
|
1308 | b'use-dirstate-v2.automatic-upgrade-of-mismatching-repositories:quiet', | |
1293 | default=False, |
|
1309 | default=False, | |
1294 | experimental=True, |
|
1310 | experimental=True, | |
1295 | ) |
|
1311 | ) | |
1296 | coreconfigitem( |
|
1312 | coreconfigitem( | |
1297 | b'format', |
|
1313 | b'format', | |
1298 | b'use-dirstate-tracked-hint', |
|
1314 | b'use-dirstate-tracked-hint', | |
1299 | default=False, |
|
1315 | default=False, | |
1300 | experimental=True, |
|
1316 | experimental=True, | |
1301 | ) |
|
1317 | ) | |
1302 | coreconfigitem( |
|
1318 | coreconfigitem( | |
1303 | b'format', |
|
1319 | b'format', | |
1304 | b'use-dirstate-tracked-hint.version', |
|
1320 | b'use-dirstate-tracked-hint.version', | |
1305 | default=1, |
|
1321 | default=1, | |
1306 | experimental=True, |
|
1322 | experimental=True, | |
1307 | ) |
|
1323 | ) | |
1308 | coreconfigitem( |
|
1324 | coreconfigitem( | |
1309 | b'format', |
|
1325 | b'format', | |
1310 | b'use-dirstate-tracked-hint.automatic-upgrade-of-mismatching-repositories', |
|
1326 | b'use-dirstate-tracked-hint.automatic-upgrade-of-mismatching-repositories', | |
1311 | default=False, |
|
1327 | default=False, | |
1312 | experimental=True, |
|
1328 | experimental=True, | |
1313 | ) |
|
1329 | ) | |
1314 | coreconfigitem( |
|
1330 | coreconfigitem( | |
1315 | b'format', |
|
1331 | b'format', | |
1316 | b'use-dirstate-tracked-hint.automatic-upgrade-of-mismatching-repositories:quiet', |
|
1332 | b'use-dirstate-tracked-hint.automatic-upgrade-of-mismatching-repositories:quiet', | |
1317 | default=False, |
|
1333 | default=False, | |
1318 | experimental=True, |
|
1334 | experimental=True, | |
1319 | ) |
|
1335 | ) | |
1320 | coreconfigitem( |
|
1336 | coreconfigitem( | |
1321 | b'format', |
|
1337 | b'format', | |
1322 | b'dotencode', |
|
1338 | b'dotencode', | |
1323 | default=True, |
|
1339 | default=True, | |
1324 | ) |
|
1340 | ) | |
1325 | coreconfigitem( |
|
1341 | coreconfigitem( | |
1326 | b'format', |
|
1342 | b'format', | |
1327 | b'generaldelta', |
|
1343 | b'generaldelta', | |
1328 | default=False, |
|
1344 | default=False, | |
1329 | experimental=True, |
|
1345 | experimental=True, | |
1330 | ) |
|
1346 | ) | |
1331 | coreconfigitem( |
|
1347 | coreconfigitem( | |
1332 | b'format', |
|
1348 | b'format', | |
1333 | b'manifestcachesize', |
|
1349 | b'manifestcachesize', | |
1334 | default=None, |
|
1350 | default=None, | |
1335 | experimental=True, |
|
1351 | experimental=True, | |
1336 | ) |
|
1352 | ) | |
1337 | coreconfigitem( |
|
1353 | coreconfigitem( | |
1338 | b'format', |
|
1354 | b'format', | |
1339 | b'maxchainlen', |
|
1355 | b'maxchainlen', | |
1340 | default=dynamicdefault, |
|
1356 | default=dynamicdefault, | |
1341 | experimental=True, |
|
1357 | experimental=True, | |
1342 | ) |
|
1358 | ) | |
1343 | coreconfigitem( |
|
1359 | coreconfigitem( | |
1344 | b'format', |
|
1360 | b'format', | |
1345 | b'obsstore-version', |
|
1361 | b'obsstore-version', | |
1346 | default=None, |
|
1362 | default=None, | |
1347 | ) |
|
1363 | ) | |
1348 | coreconfigitem( |
|
1364 | coreconfigitem( | |
1349 | b'format', |
|
1365 | b'format', | |
1350 | b'sparse-revlog', |
|
1366 | b'sparse-revlog', | |
1351 | default=True, |
|
1367 | default=True, | |
1352 | ) |
|
1368 | ) | |
1353 | coreconfigitem( |
|
1369 | coreconfigitem( | |
1354 | b'format', |
|
1370 | b'format', | |
1355 | b'revlog-compression', |
|
1371 | b'revlog-compression', | |
1356 | default=lambda: [b'zstd', b'zlib'], |
|
1372 | default=lambda: [b'zstd', b'zlib'], | |
1357 | alias=[(b'experimental', b'format.compression')], |
|
1373 | alias=[(b'experimental', b'format.compression')], | |
1358 | ) |
|
1374 | ) | |
1359 | # Experimental TODOs: |
|
1375 | # Experimental TODOs: | |
1360 | # |
|
1376 | # | |
1361 | # * Same as for revlogv2 (but for the reduction of the number of files) |
|
1377 | # * Same as for revlogv2 (but for the reduction of the number of files) | |
1362 | # * Actually computing the rank of changesets |
|
1378 | # * Actually computing the rank of changesets | |
1363 | # * Improvement to investigate |
|
1379 | # * Improvement to investigate | |
1364 | # - storing .hgtags fnode |
|
1380 | # - storing .hgtags fnode | |
1365 | # - storing branch related identifier |
|
1381 | # - storing branch related identifier | |
1366 |
|
1382 | |||
1367 | coreconfigitem( |
|
1383 | coreconfigitem( | |
1368 | b'format', |
|
1384 | b'format', | |
1369 | b'exp-use-changelog-v2', |
|
1385 | b'exp-use-changelog-v2', | |
1370 | default=None, |
|
1386 | default=None, | |
1371 | experimental=True, |
|
1387 | experimental=True, | |
1372 | ) |
|
1388 | ) | |
1373 | coreconfigitem( |
|
1389 | coreconfigitem( | |
1374 | b'format', |
|
1390 | b'format', | |
1375 | b'usefncache', |
|
1391 | b'usefncache', | |
1376 | default=True, |
|
1392 | default=True, | |
1377 | ) |
|
1393 | ) | |
1378 | coreconfigitem( |
|
1394 | coreconfigitem( | |
1379 | b'format', |
|
1395 | b'format', | |
1380 | b'usegeneraldelta', |
|
1396 | b'usegeneraldelta', | |
1381 | default=True, |
|
1397 | default=True, | |
1382 | ) |
|
1398 | ) | |
1383 | coreconfigitem( |
|
1399 | coreconfigitem( | |
1384 | b'format', |
|
1400 | b'format', | |
1385 | b'usestore', |
|
1401 | b'usestore', | |
1386 | default=True, |
|
1402 | default=True, | |
1387 | ) |
|
1403 | ) | |
1388 |
|
1404 | |||
1389 |
|
1405 | |||
1390 | def _persistent_nodemap_default(): |
|
1406 | def _persistent_nodemap_default(): | |
1391 | """compute `use-persistent-nodemap` default value |
|
1407 | """compute `use-persistent-nodemap` default value | |
1392 |
|
1408 | |||
1393 | The feature is disabled unless a fast implementation is available. |
|
1409 | The feature is disabled unless a fast implementation is available. | |
1394 | """ |
|
1410 | """ | |
1395 | from . import policy |
|
1411 | from . import policy | |
1396 |
|
1412 | |||
1397 | return policy.importrust('revlog') is not None |
|
1413 | return policy.importrust('revlog') is not None | |
1398 |
|
1414 | |||
1399 |
|
1415 | |||
1400 | coreconfigitem( |
|
1416 | coreconfigitem( | |
1401 | b'format', |
|
1417 | b'format', | |
1402 | b'use-persistent-nodemap', |
|
1418 | b'use-persistent-nodemap', | |
1403 | default=_persistent_nodemap_default, |
|
1419 | default=_persistent_nodemap_default, | |
1404 | ) |
|
1420 | ) | |
1405 | coreconfigitem( |
|
1421 | coreconfigitem( | |
1406 | b'format', |
|
1422 | b'format', | |
1407 | b'exp-use-copies-side-data-changeset', |
|
1423 | b'exp-use-copies-side-data-changeset', | |
1408 | default=False, |
|
1424 | default=False, | |
1409 | experimental=True, |
|
1425 | experimental=True, | |
1410 | ) |
|
1426 | ) | |
1411 | coreconfigitem( |
|
1427 | coreconfigitem( | |
1412 | b'format', |
|
1428 | b'format', | |
1413 | b'use-share-safe', |
|
1429 | b'use-share-safe', | |
1414 | default=True, |
|
1430 | default=True, | |
1415 | ) |
|
1431 | ) | |
1416 | coreconfigitem( |
|
1432 | coreconfigitem( | |
1417 | b'format', |
|
1433 | b'format', | |
1418 | b'use-share-safe.automatic-upgrade-of-mismatching-repositories', |
|
1434 | b'use-share-safe.automatic-upgrade-of-mismatching-repositories', | |
1419 | default=False, |
|
1435 | default=False, | |
1420 | experimental=True, |
|
1436 | experimental=True, | |
1421 | ) |
|
1437 | ) | |
1422 | coreconfigitem( |
|
1438 | coreconfigitem( | |
1423 | b'format', |
|
1439 | b'format', | |
1424 | b'use-share-safe.automatic-upgrade-of-mismatching-repositories:quiet', |
|
1440 | b'use-share-safe.automatic-upgrade-of-mismatching-repositories:quiet', | |
1425 | default=False, |
|
1441 | default=False, | |
1426 | experimental=True, |
|
1442 | experimental=True, | |
1427 | ) |
|
1443 | ) | |
1428 |
|
1444 | |||
1429 | # Moving this on by default means we are confident about the scaling of phases. |
|
1445 | # Moving this on by default means we are confident about the scaling of phases. | |
1430 | # This is not garanteed to be the case at the time this message is written. |
|
1446 | # This is not garanteed to be the case at the time this message is written. | |
1431 | coreconfigitem( |
|
1447 | coreconfigitem( | |
1432 | b'format', |
|
1448 | b'format', | |
1433 | b'use-internal-phase', |
|
1449 | b'use-internal-phase', | |
1434 | default=False, |
|
1450 | default=False, | |
1435 | experimental=True, |
|
1451 | experimental=True, | |
1436 | ) |
|
1452 | ) | |
1437 | # The interaction between the archived phase and obsolescence markers needs to |
|
1453 | # The interaction between the archived phase and obsolescence markers needs to | |
1438 | # be sorted out before wider usage of this are to be considered. |
|
1454 | # be sorted out before wider usage of this are to be considered. | |
1439 | # |
|
1455 | # | |
1440 | # At the time this message is written, behavior when archiving obsolete |
|
1456 | # At the time this message is written, behavior when archiving obsolete | |
1441 | # changeset differ significantly from stripping. As part of stripping, we also |
|
1457 | # changeset differ significantly from stripping. As part of stripping, we also | |
1442 | # remove the obsolescence marker associated to the stripped changesets, |
|
1458 | # remove the obsolescence marker associated to the stripped changesets, | |
1443 | # revealing the precedecessors changesets when applicable. When archiving, we |
|
1459 | # revealing the precedecessors changesets when applicable. When archiving, we | |
1444 | # don't touch the obsolescence markers, keeping everything hidden. This can |
|
1460 | # don't touch the obsolescence markers, keeping everything hidden. This can | |
1445 | # result in quite confusing situation for people combining exchanging draft |
|
1461 | # result in quite confusing situation for people combining exchanging draft | |
1446 | # with the archived phases. As some markers needed by others may be skipped |
|
1462 | # with the archived phases. As some markers needed by others may be skipped | |
1447 | # during exchange. |
|
1463 | # during exchange. | |
1448 | coreconfigitem( |
|
1464 | coreconfigitem( | |
1449 | b'format', |
|
1465 | b'format', | |
1450 | b'exp-archived-phase', |
|
1466 | b'exp-archived-phase', | |
1451 | default=False, |
|
1467 | default=False, | |
1452 | experimental=True, |
|
1468 | experimental=True, | |
1453 | ) |
|
1469 | ) | |
1454 | coreconfigitem( |
|
1470 | coreconfigitem( | |
1455 | b'shelve', |
|
1471 | b'shelve', | |
1456 | b'store', |
|
1472 | b'store', | |
1457 | default=b'internal', |
|
1473 | default=b'internal', | |
1458 | experimental=True, |
|
1474 | experimental=True, | |
1459 | ) |
|
1475 | ) | |
1460 | coreconfigitem( |
|
1476 | coreconfigitem( | |
1461 | b'fsmonitor', |
|
1477 | b'fsmonitor', | |
1462 | b'warn_when_unused', |
|
1478 | b'warn_when_unused', | |
1463 | default=True, |
|
1479 | default=True, | |
1464 | ) |
|
1480 | ) | |
1465 | coreconfigitem( |
|
1481 | coreconfigitem( | |
1466 | b'fsmonitor', |
|
1482 | b'fsmonitor', | |
1467 | b'warn_update_file_count', |
|
1483 | b'warn_update_file_count', | |
1468 | default=50000, |
|
1484 | default=50000, | |
1469 | ) |
|
1485 | ) | |
1470 | coreconfigitem( |
|
1486 | coreconfigitem( | |
1471 | b'fsmonitor', |
|
1487 | b'fsmonitor', | |
1472 | b'warn_update_file_count_rust', |
|
1488 | b'warn_update_file_count_rust', | |
1473 | default=400000, |
|
1489 | default=400000, | |
1474 | ) |
|
1490 | ) | |
1475 | coreconfigitem( |
|
1491 | coreconfigitem( | |
1476 | b'help', |
|
1492 | b'help', | |
1477 | br'hidden-command\..*', |
|
1493 | br'hidden-command\..*', | |
1478 | default=False, |
|
1494 | default=False, | |
1479 | generic=True, |
|
1495 | generic=True, | |
1480 | ) |
|
1496 | ) | |
1481 | coreconfigitem( |
|
1497 | coreconfigitem( | |
1482 | b'help', |
|
1498 | b'help', | |
1483 | br'hidden-topic\..*', |
|
1499 | br'hidden-topic\..*', | |
1484 | default=False, |
|
1500 | default=False, | |
1485 | generic=True, |
|
1501 | generic=True, | |
1486 | ) |
|
1502 | ) | |
1487 | coreconfigitem( |
|
1503 | coreconfigitem( | |
1488 | b'hooks', |
|
1504 | b'hooks', | |
1489 | b'[^:]*', |
|
1505 | b'[^:]*', | |
1490 | default=dynamicdefault, |
|
1506 | default=dynamicdefault, | |
1491 | generic=True, |
|
1507 | generic=True, | |
1492 | ) |
|
1508 | ) | |
1493 | coreconfigitem( |
|
1509 | coreconfigitem( | |
1494 | b'hooks', |
|
1510 | b'hooks', | |
1495 | b'.*:run-with-plain', |
|
1511 | b'.*:run-with-plain', | |
1496 | default=True, |
|
1512 | default=True, | |
1497 | generic=True, |
|
1513 | generic=True, | |
1498 | ) |
|
1514 | ) | |
1499 | coreconfigitem( |
|
1515 | coreconfigitem( | |
1500 | b'hgweb-paths', |
|
1516 | b'hgweb-paths', | |
1501 | b'.*', |
|
1517 | b'.*', | |
1502 | default=list, |
|
1518 | default=list, | |
1503 | generic=True, |
|
1519 | generic=True, | |
1504 | ) |
|
1520 | ) | |
1505 | coreconfigitem( |
|
1521 | coreconfigitem( | |
1506 | b'hostfingerprints', |
|
1522 | b'hostfingerprints', | |
1507 | b'.*', |
|
1523 | b'.*', | |
1508 | default=list, |
|
1524 | default=list, | |
1509 | generic=True, |
|
1525 | generic=True, | |
1510 | ) |
|
1526 | ) | |
1511 | coreconfigitem( |
|
1527 | coreconfigitem( | |
1512 | b'hostsecurity', |
|
1528 | b'hostsecurity', | |
1513 | b'ciphers', |
|
1529 | b'ciphers', | |
1514 | default=None, |
|
1530 | default=None, | |
1515 | ) |
|
1531 | ) | |
1516 | coreconfigitem( |
|
1532 | coreconfigitem( | |
1517 | b'hostsecurity', |
|
1533 | b'hostsecurity', | |
1518 | b'minimumprotocol', |
|
1534 | b'minimumprotocol', | |
1519 | default=dynamicdefault, |
|
1535 | default=dynamicdefault, | |
1520 | ) |
|
1536 | ) | |
1521 | coreconfigitem( |
|
1537 | coreconfigitem( | |
1522 | b'hostsecurity', |
|
1538 | b'hostsecurity', | |
1523 | b'.*:minimumprotocol$', |
|
1539 | b'.*:minimumprotocol$', | |
1524 | default=dynamicdefault, |
|
1540 | default=dynamicdefault, | |
1525 | generic=True, |
|
1541 | generic=True, | |
1526 | ) |
|
1542 | ) | |
1527 | coreconfigitem( |
|
1543 | coreconfigitem( | |
1528 | b'hostsecurity', |
|
1544 | b'hostsecurity', | |
1529 | b'.*:ciphers$', |
|
1545 | b'.*:ciphers$', | |
1530 | default=dynamicdefault, |
|
1546 | default=dynamicdefault, | |
1531 | generic=True, |
|
1547 | generic=True, | |
1532 | ) |
|
1548 | ) | |
1533 | coreconfigitem( |
|
1549 | coreconfigitem( | |
1534 | b'hostsecurity', |
|
1550 | b'hostsecurity', | |
1535 | b'.*:fingerprints$', |
|
1551 | b'.*:fingerprints$', | |
1536 | default=list, |
|
1552 | default=list, | |
1537 | generic=True, |
|
1553 | generic=True, | |
1538 | ) |
|
1554 | ) | |
1539 | coreconfigitem( |
|
1555 | coreconfigitem( | |
1540 | b'hostsecurity', |
|
1556 | b'hostsecurity', | |
1541 | b'.*:verifycertsfile$', |
|
1557 | b'.*:verifycertsfile$', | |
1542 | default=None, |
|
1558 | default=None, | |
1543 | generic=True, |
|
1559 | generic=True, | |
1544 | ) |
|
1560 | ) | |
1545 |
|
1561 | |||
1546 | coreconfigitem( |
|
1562 | coreconfigitem( | |
1547 | b'http_proxy', |
|
1563 | b'http_proxy', | |
1548 | b'always', |
|
1564 | b'always', | |
1549 | default=False, |
|
1565 | default=False, | |
1550 | ) |
|
1566 | ) | |
1551 | coreconfigitem( |
|
1567 | coreconfigitem( | |
1552 | b'http_proxy', |
|
1568 | b'http_proxy', | |
1553 | b'host', |
|
1569 | b'host', | |
1554 | default=None, |
|
1570 | default=None, | |
1555 | ) |
|
1571 | ) | |
1556 | coreconfigitem( |
|
1572 | coreconfigitem( | |
1557 | b'http_proxy', |
|
1573 | b'http_proxy', | |
1558 | b'no', |
|
1574 | b'no', | |
1559 | default=list, |
|
1575 | default=list, | |
1560 | ) |
|
1576 | ) | |
1561 | coreconfigitem( |
|
1577 | coreconfigitem( | |
1562 | b'http_proxy', |
|
1578 | b'http_proxy', | |
1563 | b'passwd', |
|
1579 | b'passwd', | |
1564 | default=None, |
|
1580 | default=None, | |
1565 | ) |
|
1581 | ) | |
1566 | coreconfigitem( |
|
1582 | coreconfigitem( | |
1567 | b'http_proxy', |
|
1583 | b'http_proxy', | |
1568 | b'user', |
|
1584 | b'user', | |
1569 | default=None, |
|
1585 | default=None, | |
1570 | ) |
|
1586 | ) | |
1571 |
|
1587 | |||
1572 | coreconfigitem( |
|
1588 | coreconfigitem( | |
1573 | b'http', |
|
1589 | b'http', | |
1574 | b'timeout', |
|
1590 | b'timeout', | |
1575 | default=None, |
|
1591 | default=None, | |
1576 | ) |
|
1592 | ) | |
1577 |
|
1593 | |||
1578 | coreconfigitem( |
|
1594 | coreconfigitem( | |
1579 | b'logtoprocess', |
|
1595 | b'logtoprocess', | |
1580 | b'commandexception', |
|
1596 | b'commandexception', | |
1581 | default=None, |
|
1597 | default=None, | |
1582 | ) |
|
1598 | ) | |
1583 | coreconfigitem( |
|
1599 | coreconfigitem( | |
1584 | b'logtoprocess', |
|
1600 | b'logtoprocess', | |
1585 | b'commandfinish', |
|
1601 | b'commandfinish', | |
1586 | default=None, |
|
1602 | default=None, | |
1587 | ) |
|
1603 | ) | |
1588 | coreconfigitem( |
|
1604 | coreconfigitem( | |
1589 | b'logtoprocess', |
|
1605 | b'logtoprocess', | |
1590 | b'command', |
|
1606 | b'command', | |
1591 | default=None, |
|
1607 | default=None, | |
1592 | ) |
|
1608 | ) | |
1593 | coreconfigitem( |
|
1609 | coreconfigitem( | |
1594 | b'logtoprocess', |
|
1610 | b'logtoprocess', | |
1595 | b'develwarn', |
|
1611 | b'develwarn', | |
1596 | default=None, |
|
1612 | default=None, | |
1597 | ) |
|
1613 | ) | |
1598 | coreconfigitem( |
|
1614 | coreconfigitem( | |
1599 | b'logtoprocess', |
|
1615 | b'logtoprocess', | |
1600 | b'uiblocked', |
|
1616 | b'uiblocked', | |
1601 | default=None, |
|
1617 | default=None, | |
1602 | ) |
|
1618 | ) | |
1603 | coreconfigitem( |
|
1619 | coreconfigitem( | |
1604 | b'merge', |
|
1620 | b'merge', | |
1605 | b'checkunknown', |
|
1621 | b'checkunknown', | |
1606 | default=b'abort', |
|
1622 | default=b'abort', | |
1607 | ) |
|
1623 | ) | |
1608 | coreconfigitem( |
|
1624 | coreconfigitem( | |
1609 | b'merge', |
|
1625 | b'merge', | |
1610 | b'checkignored', |
|
1626 | b'checkignored', | |
1611 | default=b'abort', |
|
1627 | default=b'abort', | |
1612 | ) |
|
1628 | ) | |
1613 | coreconfigitem( |
|
1629 | coreconfigitem( | |
1614 | b'experimental', |
|
1630 | b'experimental', | |
1615 | b'merge.checkpathconflicts', |
|
1631 | b'merge.checkpathconflicts', | |
1616 | default=False, |
|
1632 | default=False, | |
1617 | ) |
|
1633 | ) | |
1618 | coreconfigitem( |
|
1634 | coreconfigitem( | |
1619 | b'merge', |
|
1635 | b'merge', | |
1620 | b'followcopies', |
|
1636 | b'followcopies', | |
1621 | default=True, |
|
1637 | default=True, | |
1622 | ) |
|
1638 | ) | |
1623 | coreconfigitem( |
|
1639 | coreconfigitem( | |
1624 | b'merge', |
|
1640 | b'merge', | |
1625 | b'on-failure', |
|
1641 | b'on-failure', | |
1626 | default=b'continue', |
|
1642 | default=b'continue', | |
1627 | ) |
|
1643 | ) | |
1628 | coreconfigitem( |
|
1644 | coreconfigitem( | |
1629 | b'merge', |
|
1645 | b'merge', | |
1630 | b'preferancestor', |
|
1646 | b'preferancestor', | |
1631 | default=lambda: [b'*'], |
|
1647 | default=lambda: [b'*'], | |
1632 | experimental=True, |
|
1648 | experimental=True, | |
1633 | ) |
|
1649 | ) | |
1634 | coreconfigitem( |
|
1650 | coreconfigitem( | |
1635 | b'merge', |
|
1651 | b'merge', | |
1636 | b'strict-capability-check', |
|
1652 | b'strict-capability-check', | |
1637 | default=False, |
|
1653 | default=False, | |
1638 | ) |
|
1654 | ) | |
1639 | coreconfigitem( |
|
1655 | coreconfigitem( | |
1640 | b'merge', |
|
1656 | b'merge', | |
1641 | b'disable-partial-tools', |
|
1657 | b'disable-partial-tools', | |
1642 | default=False, |
|
1658 | default=False, | |
1643 | experimental=True, |
|
1659 | experimental=True, | |
1644 | ) |
|
1660 | ) | |
1645 | coreconfigitem( |
|
1661 | coreconfigitem( | |
1646 | b'partial-merge-tools', |
|
1662 | b'partial-merge-tools', | |
1647 | b'.*', |
|
1663 | b'.*', | |
1648 | default=None, |
|
1664 | default=None, | |
1649 | generic=True, |
|
1665 | generic=True, | |
1650 | experimental=True, |
|
1666 | experimental=True, | |
1651 | ) |
|
1667 | ) | |
1652 | coreconfigitem( |
|
1668 | coreconfigitem( | |
1653 | b'partial-merge-tools', |
|
1669 | b'partial-merge-tools', | |
1654 | br'.*\.patterns', |
|
1670 | br'.*\.patterns', | |
1655 | default=dynamicdefault, |
|
1671 | default=dynamicdefault, | |
1656 | generic=True, |
|
1672 | generic=True, | |
1657 | priority=-1, |
|
1673 | priority=-1, | |
1658 | experimental=True, |
|
1674 | experimental=True, | |
1659 | ) |
|
1675 | ) | |
1660 | coreconfigitem( |
|
1676 | coreconfigitem( | |
1661 | b'partial-merge-tools', |
|
1677 | b'partial-merge-tools', | |
1662 | br'.*\.executable$', |
|
1678 | br'.*\.executable$', | |
1663 | default=dynamicdefault, |
|
1679 | default=dynamicdefault, | |
1664 | generic=True, |
|
1680 | generic=True, | |
1665 | priority=-1, |
|
1681 | priority=-1, | |
1666 | experimental=True, |
|
1682 | experimental=True, | |
1667 | ) |
|
1683 | ) | |
1668 | coreconfigitem( |
|
1684 | coreconfigitem( | |
1669 | b'partial-merge-tools', |
|
1685 | b'partial-merge-tools', | |
1670 | br'.*\.order', |
|
1686 | br'.*\.order', | |
1671 | default=0, |
|
1687 | default=0, | |
1672 | generic=True, |
|
1688 | generic=True, | |
1673 | priority=-1, |
|
1689 | priority=-1, | |
1674 | experimental=True, |
|
1690 | experimental=True, | |
1675 | ) |
|
1691 | ) | |
1676 | coreconfigitem( |
|
1692 | coreconfigitem( | |
1677 | b'partial-merge-tools', |
|
1693 | b'partial-merge-tools', | |
1678 | br'.*\.args', |
|
1694 | br'.*\.args', | |
1679 | default=b"$local $base $other", |
|
1695 | default=b"$local $base $other", | |
1680 | generic=True, |
|
1696 | generic=True, | |
1681 | priority=-1, |
|
1697 | priority=-1, | |
1682 | experimental=True, |
|
1698 | experimental=True, | |
1683 | ) |
|
1699 | ) | |
1684 | coreconfigitem( |
|
1700 | coreconfigitem( | |
1685 | b'partial-merge-tools', |
|
1701 | b'partial-merge-tools', | |
1686 | br'.*\.disable', |
|
1702 | br'.*\.disable', | |
1687 | default=False, |
|
1703 | default=False, | |
1688 | generic=True, |
|
1704 | generic=True, | |
1689 | priority=-1, |
|
1705 | priority=-1, | |
1690 | experimental=True, |
|
1706 | experimental=True, | |
1691 | ) |
|
1707 | ) | |
1692 | coreconfigitem( |
|
1708 | coreconfigitem( | |
1693 | b'merge-tools', |
|
1709 | b'merge-tools', | |
1694 | b'.*', |
|
1710 | b'.*', | |
1695 | default=None, |
|
1711 | default=None, | |
1696 | generic=True, |
|
1712 | generic=True, | |
1697 | ) |
|
1713 | ) | |
1698 | coreconfigitem( |
|
1714 | coreconfigitem( | |
1699 | b'merge-tools', |
|
1715 | b'merge-tools', | |
1700 | br'.*\.args$', |
|
1716 | br'.*\.args$', | |
1701 | default=b"$local $base $other", |
|
1717 | default=b"$local $base $other", | |
1702 | generic=True, |
|
1718 | generic=True, | |
1703 | priority=-1, |
|
1719 | priority=-1, | |
1704 | ) |
|
1720 | ) | |
1705 | coreconfigitem( |
|
1721 | coreconfigitem( | |
1706 | b'merge-tools', |
|
1722 | b'merge-tools', | |
1707 | br'.*\.binary$', |
|
1723 | br'.*\.binary$', | |
1708 | default=False, |
|
1724 | default=False, | |
1709 | generic=True, |
|
1725 | generic=True, | |
1710 | priority=-1, |
|
1726 | priority=-1, | |
1711 | ) |
|
1727 | ) | |
1712 | coreconfigitem( |
|
1728 | coreconfigitem( | |
1713 | b'merge-tools', |
|
1729 | b'merge-tools', | |
1714 | br'.*\.check$', |
|
1730 | br'.*\.check$', | |
1715 | default=list, |
|
1731 | default=list, | |
1716 | generic=True, |
|
1732 | generic=True, | |
1717 | priority=-1, |
|
1733 | priority=-1, | |
1718 | ) |
|
1734 | ) | |
1719 | coreconfigitem( |
|
1735 | coreconfigitem( | |
1720 | b'merge-tools', |
|
1736 | b'merge-tools', | |
1721 | br'.*\.checkchanged$', |
|
1737 | br'.*\.checkchanged$', | |
1722 | default=False, |
|
1738 | default=False, | |
1723 | generic=True, |
|
1739 | generic=True, | |
1724 | priority=-1, |
|
1740 | priority=-1, | |
1725 | ) |
|
1741 | ) | |
1726 | coreconfigitem( |
|
1742 | coreconfigitem( | |
1727 | b'merge-tools', |
|
1743 | b'merge-tools', | |
1728 | br'.*\.executable$', |
|
1744 | br'.*\.executable$', | |
1729 | default=dynamicdefault, |
|
1745 | default=dynamicdefault, | |
1730 | generic=True, |
|
1746 | generic=True, | |
1731 | priority=-1, |
|
1747 | priority=-1, | |
1732 | ) |
|
1748 | ) | |
1733 | coreconfigitem( |
|
1749 | coreconfigitem( | |
1734 | b'merge-tools', |
|
1750 | b'merge-tools', | |
1735 | br'.*\.fixeol$', |
|
1751 | br'.*\.fixeol$', | |
1736 | default=False, |
|
1752 | default=False, | |
1737 | generic=True, |
|
1753 | generic=True, | |
1738 | priority=-1, |
|
1754 | priority=-1, | |
1739 | ) |
|
1755 | ) | |
1740 | coreconfigitem( |
|
1756 | coreconfigitem( | |
1741 | b'merge-tools', |
|
1757 | b'merge-tools', | |
1742 | br'.*\.gui$', |
|
1758 | br'.*\.gui$', | |
1743 | default=False, |
|
1759 | default=False, | |
1744 | generic=True, |
|
1760 | generic=True, | |
1745 | priority=-1, |
|
1761 | priority=-1, | |
1746 | ) |
|
1762 | ) | |
1747 | coreconfigitem( |
|
1763 | coreconfigitem( | |
1748 | b'merge-tools', |
|
1764 | b'merge-tools', | |
1749 | br'.*\.mergemarkers$', |
|
1765 | br'.*\.mergemarkers$', | |
1750 | default=b'basic', |
|
1766 | default=b'basic', | |
1751 | generic=True, |
|
1767 | generic=True, | |
1752 | priority=-1, |
|
1768 | priority=-1, | |
1753 | ) |
|
1769 | ) | |
1754 | coreconfigitem( |
|
1770 | coreconfigitem( | |
1755 | b'merge-tools', |
|
1771 | b'merge-tools', | |
1756 | br'.*\.mergemarkertemplate$', |
|
1772 | br'.*\.mergemarkertemplate$', | |
1757 | default=dynamicdefault, # take from command-templates.mergemarker |
|
1773 | default=dynamicdefault, # take from command-templates.mergemarker | |
1758 | generic=True, |
|
1774 | generic=True, | |
1759 | priority=-1, |
|
1775 | priority=-1, | |
1760 | ) |
|
1776 | ) | |
1761 | coreconfigitem( |
|
1777 | coreconfigitem( | |
1762 | b'merge-tools', |
|
1778 | b'merge-tools', | |
1763 | br'.*\.priority$', |
|
1779 | br'.*\.priority$', | |
1764 | default=0, |
|
1780 | default=0, | |
1765 | generic=True, |
|
1781 | generic=True, | |
1766 | priority=-1, |
|
1782 | priority=-1, | |
1767 | ) |
|
1783 | ) | |
1768 | coreconfigitem( |
|
1784 | coreconfigitem( | |
1769 | b'merge-tools', |
|
1785 | b'merge-tools', | |
1770 | br'.*\.premerge$', |
|
1786 | br'.*\.premerge$', | |
1771 | default=dynamicdefault, |
|
1787 | default=dynamicdefault, | |
1772 | generic=True, |
|
1788 | generic=True, | |
1773 | priority=-1, |
|
1789 | priority=-1, | |
1774 | ) |
|
1790 | ) | |
1775 | coreconfigitem( |
|
1791 | coreconfigitem( | |
1776 | b'merge-tools', |
|
1792 | b'merge-tools', | |
1777 | br'.*\.symlink$', |
|
1793 | br'.*\.symlink$', | |
1778 | default=False, |
|
1794 | default=False, | |
1779 | generic=True, |
|
1795 | generic=True, | |
1780 | priority=-1, |
|
1796 | priority=-1, | |
1781 | ) |
|
1797 | ) | |
1782 | coreconfigitem( |
|
1798 | coreconfigitem( | |
1783 | b'pager', |
|
1799 | b'pager', | |
1784 | b'attend-.*', |
|
1800 | b'attend-.*', | |
1785 | default=dynamicdefault, |
|
1801 | default=dynamicdefault, | |
1786 | generic=True, |
|
1802 | generic=True, | |
1787 | ) |
|
1803 | ) | |
1788 | coreconfigitem( |
|
1804 | coreconfigitem( | |
1789 | b'pager', |
|
1805 | b'pager', | |
1790 | b'ignore', |
|
1806 | b'ignore', | |
1791 | default=list, |
|
1807 | default=list, | |
1792 | ) |
|
1808 | ) | |
1793 | coreconfigitem( |
|
1809 | coreconfigitem( | |
1794 | b'pager', |
|
1810 | b'pager', | |
1795 | b'pager', |
|
1811 | b'pager', | |
1796 | default=dynamicdefault, |
|
1812 | default=dynamicdefault, | |
1797 | ) |
|
1813 | ) | |
1798 | coreconfigitem( |
|
1814 | coreconfigitem( | |
1799 | b'patch', |
|
1815 | b'patch', | |
1800 | b'eol', |
|
1816 | b'eol', | |
1801 | default=b'strict', |
|
1817 | default=b'strict', | |
1802 | ) |
|
1818 | ) | |
1803 | coreconfigitem( |
|
1819 | coreconfigitem( | |
1804 | b'patch', |
|
1820 | b'patch', | |
1805 | b'fuzz', |
|
1821 | b'fuzz', | |
1806 | default=2, |
|
1822 | default=2, | |
1807 | ) |
|
1823 | ) | |
1808 | coreconfigitem( |
|
1824 | coreconfigitem( | |
1809 | b'paths', |
|
1825 | b'paths', | |
1810 | b'default', |
|
1826 | b'default', | |
1811 | default=None, |
|
1827 | default=None, | |
1812 | ) |
|
1828 | ) | |
1813 | coreconfigitem( |
|
1829 | coreconfigitem( | |
1814 | b'paths', |
|
1830 | b'paths', | |
1815 | b'default-push', |
|
1831 | b'default-push', | |
1816 | default=None, |
|
1832 | default=None, | |
1817 | ) |
|
1833 | ) | |
1818 | coreconfigitem( |
|
1834 | coreconfigitem( | |
1819 | b'paths', |
|
1835 | b'paths', | |
1820 | b'.*', |
|
1836 | b'.*', | |
1821 | default=None, |
|
1837 | default=None, | |
1822 | generic=True, |
|
1838 | generic=True, | |
1823 | ) |
|
1839 | ) | |
1824 | coreconfigitem( |
|
1840 | coreconfigitem( | |
1825 | b'paths', |
|
1841 | b'paths', | |
1826 | b'.*:bookmarks.mode', |
|
1842 | b'.*:bookmarks.mode', | |
1827 | default='default', |
|
1843 | default='default', | |
1828 | generic=True, |
|
1844 | generic=True, | |
1829 | ) |
|
1845 | ) | |
1830 | coreconfigitem( |
|
1846 | coreconfigitem( | |
1831 | b'paths', |
|
1847 | b'paths', | |
1832 | b'.*:multi-urls', |
|
1848 | b'.*:multi-urls', | |
1833 | default=False, |
|
1849 | default=False, | |
1834 | generic=True, |
|
1850 | generic=True, | |
1835 | ) |
|
1851 | ) | |
1836 | coreconfigitem( |
|
1852 | coreconfigitem( | |
1837 | b'paths', |
|
1853 | b'paths', | |
1838 | b'.*:pushrev', |
|
1854 | b'.*:pushrev', | |
1839 | default=None, |
|
1855 | default=None, | |
1840 | generic=True, |
|
1856 | generic=True, | |
1841 | ) |
|
1857 | ) | |
1842 | coreconfigitem( |
|
1858 | coreconfigitem( | |
1843 | b'paths', |
|
1859 | b'paths', | |
1844 | b'.*:pushurl', |
|
1860 | b'.*:pushurl', | |
1845 | default=None, |
|
1861 | default=None, | |
1846 | generic=True, |
|
1862 | generic=True, | |
1847 | ) |
|
1863 | ) | |
1848 | coreconfigitem( |
|
1864 | coreconfigitem( | |
1849 | b'phases', |
|
1865 | b'phases', | |
1850 | b'checksubrepos', |
|
1866 | b'checksubrepos', | |
1851 | default=b'follow', |
|
1867 | default=b'follow', | |
1852 | ) |
|
1868 | ) | |
1853 | coreconfigitem( |
|
1869 | coreconfigitem( | |
1854 | b'phases', |
|
1870 | b'phases', | |
1855 | b'new-commit', |
|
1871 | b'new-commit', | |
1856 | default=b'draft', |
|
1872 | default=b'draft', | |
1857 | ) |
|
1873 | ) | |
1858 | coreconfigitem( |
|
1874 | coreconfigitem( | |
1859 | b'phases', |
|
1875 | b'phases', | |
1860 | b'publish', |
|
1876 | b'publish', | |
1861 | default=True, |
|
1877 | default=True, | |
1862 | ) |
|
1878 | ) | |
1863 | coreconfigitem( |
|
1879 | coreconfigitem( | |
1864 | b'profiling', |
|
1880 | b'profiling', | |
1865 | b'enabled', |
|
1881 | b'enabled', | |
1866 | default=False, |
|
1882 | default=False, | |
1867 | ) |
|
1883 | ) | |
1868 | coreconfigitem( |
|
1884 | coreconfigitem( | |
1869 | b'profiling', |
|
1885 | b'profiling', | |
1870 | b'format', |
|
1886 | b'format', | |
1871 | default=b'text', |
|
1887 | default=b'text', | |
1872 | ) |
|
1888 | ) | |
1873 | coreconfigitem( |
|
1889 | coreconfigitem( | |
1874 | b'profiling', |
|
1890 | b'profiling', | |
1875 | b'freq', |
|
1891 | b'freq', | |
1876 | default=1000, |
|
1892 | default=1000, | |
1877 | ) |
|
1893 | ) | |
1878 | coreconfigitem( |
|
1894 | coreconfigitem( | |
1879 | b'profiling', |
|
1895 | b'profiling', | |
1880 | b'limit', |
|
1896 | b'limit', | |
1881 | default=30, |
|
1897 | default=30, | |
1882 | ) |
|
1898 | ) | |
1883 | coreconfigitem( |
|
1899 | coreconfigitem( | |
1884 | b'profiling', |
|
1900 | b'profiling', | |
1885 | b'nested', |
|
1901 | b'nested', | |
1886 | default=0, |
|
1902 | default=0, | |
1887 | ) |
|
1903 | ) | |
1888 | coreconfigitem( |
|
1904 | coreconfigitem( | |
1889 | b'profiling', |
|
1905 | b'profiling', | |
1890 | b'output', |
|
1906 | b'output', | |
1891 | default=None, |
|
1907 | default=None, | |
1892 | ) |
|
1908 | ) | |
1893 | coreconfigitem( |
|
1909 | coreconfigitem( | |
1894 | b'profiling', |
|
1910 | b'profiling', | |
1895 | b'showmax', |
|
1911 | b'showmax', | |
1896 | default=0.999, |
|
1912 | default=0.999, | |
1897 | ) |
|
1913 | ) | |
1898 | coreconfigitem( |
|
1914 | coreconfigitem( | |
1899 | b'profiling', |
|
1915 | b'profiling', | |
1900 | b'showmin', |
|
1916 | b'showmin', | |
1901 | default=dynamicdefault, |
|
1917 | default=dynamicdefault, | |
1902 | ) |
|
1918 | ) | |
1903 | coreconfigitem( |
|
1919 | coreconfigitem( | |
1904 | b'profiling', |
|
1920 | b'profiling', | |
1905 | b'showtime', |
|
1921 | b'showtime', | |
1906 | default=True, |
|
1922 | default=True, | |
1907 | ) |
|
1923 | ) | |
1908 | coreconfigitem( |
|
1924 | coreconfigitem( | |
1909 | b'profiling', |
|
1925 | b'profiling', | |
1910 | b'sort', |
|
1926 | b'sort', | |
1911 | default=b'inlinetime', |
|
1927 | default=b'inlinetime', | |
1912 | ) |
|
1928 | ) | |
1913 | coreconfigitem( |
|
1929 | coreconfigitem( | |
1914 | b'profiling', |
|
1930 | b'profiling', | |
1915 | b'statformat', |
|
1931 | b'statformat', | |
1916 | default=b'hotpath', |
|
1932 | default=b'hotpath', | |
1917 | ) |
|
1933 | ) | |
1918 | coreconfigitem( |
|
1934 | coreconfigitem( | |
1919 | b'profiling', |
|
1935 | b'profiling', | |
1920 | b'time-track', |
|
1936 | b'time-track', | |
1921 | default=dynamicdefault, |
|
1937 | default=dynamicdefault, | |
1922 | ) |
|
1938 | ) | |
1923 | coreconfigitem( |
|
1939 | coreconfigitem( | |
1924 | b'profiling', |
|
1940 | b'profiling', | |
1925 | b'type', |
|
1941 | b'type', | |
1926 | default=b'stat', |
|
1942 | default=b'stat', | |
1927 | ) |
|
1943 | ) | |
1928 | coreconfigitem( |
|
1944 | coreconfigitem( | |
1929 | b'progress', |
|
1945 | b'progress', | |
1930 | b'assume-tty', |
|
1946 | b'assume-tty', | |
1931 | default=False, |
|
1947 | default=False, | |
1932 | ) |
|
1948 | ) | |
1933 | coreconfigitem( |
|
1949 | coreconfigitem( | |
1934 | b'progress', |
|
1950 | b'progress', | |
1935 | b'changedelay', |
|
1951 | b'changedelay', | |
1936 | default=1, |
|
1952 | default=1, | |
1937 | ) |
|
1953 | ) | |
1938 | coreconfigitem( |
|
1954 | coreconfigitem( | |
1939 | b'progress', |
|
1955 | b'progress', | |
1940 | b'clear-complete', |
|
1956 | b'clear-complete', | |
1941 | default=True, |
|
1957 | default=True, | |
1942 | ) |
|
1958 | ) | |
1943 | coreconfigitem( |
|
1959 | coreconfigitem( | |
1944 | b'progress', |
|
1960 | b'progress', | |
1945 | b'debug', |
|
1961 | b'debug', | |
1946 | default=False, |
|
1962 | default=False, | |
1947 | ) |
|
1963 | ) | |
1948 | coreconfigitem( |
|
1964 | coreconfigitem( | |
1949 | b'progress', |
|
1965 | b'progress', | |
1950 | b'delay', |
|
1966 | b'delay', | |
1951 | default=3, |
|
1967 | default=3, | |
1952 | ) |
|
1968 | ) | |
1953 | coreconfigitem( |
|
1969 | coreconfigitem( | |
1954 | b'progress', |
|
1970 | b'progress', | |
1955 | b'disable', |
|
1971 | b'disable', | |
1956 | default=False, |
|
1972 | default=False, | |
1957 | ) |
|
1973 | ) | |
1958 | coreconfigitem( |
|
1974 | coreconfigitem( | |
1959 | b'progress', |
|
1975 | b'progress', | |
1960 | b'estimateinterval', |
|
1976 | b'estimateinterval', | |
1961 | default=60.0, |
|
1977 | default=60.0, | |
1962 | ) |
|
1978 | ) | |
1963 | coreconfigitem( |
|
1979 | coreconfigitem( | |
1964 | b'progress', |
|
1980 | b'progress', | |
1965 | b'format', |
|
1981 | b'format', | |
1966 | default=lambda: [b'topic', b'bar', b'number', b'estimate'], |
|
1982 | default=lambda: [b'topic', b'bar', b'number', b'estimate'], | |
1967 | ) |
|
1983 | ) | |
1968 | coreconfigitem( |
|
1984 | coreconfigitem( | |
1969 | b'progress', |
|
1985 | b'progress', | |
1970 | b'refresh', |
|
1986 | b'refresh', | |
1971 | default=0.1, |
|
1987 | default=0.1, | |
1972 | ) |
|
1988 | ) | |
1973 | coreconfigitem( |
|
1989 | coreconfigitem( | |
1974 | b'progress', |
|
1990 | b'progress', | |
1975 | b'width', |
|
1991 | b'width', | |
1976 | default=dynamicdefault, |
|
1992 | default=dynamicdefault, | |
1977 | ) |
|
1993 | ) | |
1978 | coreconfigitem( |
|
1994 | coreconfigitem( | |
1979 | b'pull', |
|
1995 | b'pull', | |
1980 | b'confirm', |
|
1996 | b'confirm', | |
1981 | default=False, |
|
1997 | default=False, | |
1982 | ) |
|
1998 | ) | |
1983 | coreconfigitem( |
|
1999 | coreconfigitem( | |
1984 | b'push', |
|
2000 | b'push', | |
1985 | b'pushvars.server', |
|
2001 | b'pushvars.server', | |
1986 | default=False, |
|
2002 | default=False, | |
1987 | ) |
|
2003 | ) | |
1988 | coreconfigitem( |
|
2004 | coreconfigitem( | |
1989 | b'rewrite', |
|
2005 | b'rewrite', | |
1990 | b'backup-bundle', |
|
2006 | b'backup-bundle', | |
1991 | default=True, |
|
2007 | default=True, | |
1992 | alias=[(b'ui', b'history-editing-backup')], |
|
2008 | alias=[(b'ui', b'history-editing-backup')], | |
1993 | ) |
|
2009 | ) | |
1994 | coreconfigitem( |
|
2010 | coreconfigitem( | |
1995 | b'rewrite', |
|
2011 | b'rewrite', | |
1996 | b'update-timestamp', |
|
2012 | b'update-timestamp', | |
1997 | default=False, |
|
2013 | default=False, | |
1998 | ) |
|
2014 | ) | |
1999 | coreconfigitem( |
|
2015 | coreconfigitem( | |
2000 | b'rewrite', |
|
2016 | b'rewrite', | |
2001 | b'empty-successor', |
|
2017 | b'empty-successor', | |
2002 | default=b'skip', |
|
2018 | default=b'skip', | |
2003 | experimental=True, |
|
2019 | experimental=True, | |
2004 | ) |
|
2020 | ) | |
2005 | # experimental as long as format.use-dirstate-v2 is. |
|
2021 | # experimental as long as format.use-dirstate-v2 is. | |
2006 | coreconfigitem( |
|
2022 | coreconfigitem( | |
2007 | b'storage', |
|
2023 | b'storage', | |
2008 | b'dirstate-v2.slow-path', |
|
2024 | b'dirstate-v2.slow-path', | |
2009 | default=b"abort", |
|
2025 | default=b"abort", | |
2010 | experimental=True, |
|
2026 | experimental=True, | |
2011 | ) |
|
2027 | ) | |
2012 | coreconfigitem( |
|
2028 | coreconfigitem( | |
2013 | b'storage', |
|
2029 | b'storage', | |
2014 | b'new-repo-backend', |
|
2030 | b'new-repo-backend', | |
2015 | default=b'revlogv1', |
|
2031 | default=b'revlogv1', | |
2016 | experimental=True, |
|
2032 | experimental=True, | |
2017 | ) |
|
2033 | ) | |
2018 | coreconfigitem( |
|
2034 | coreconfigitem( | |
2019 | b'storage', |
|
2035 | b'storage', | |
2020 | b'revlog.optimize-delta-parent-choice', |
|
2036 | b'revlog.optimize-delta-parent-choice', | |
2021 | default=True, |
|
2037 | default=True, | |
2022 | alias=[(b'format', b'aggressivemergedeltas')], |
|
2038 | alias=[(b'format', b'aggressivemergedeltas')], | |
2023 | ) |
|
2039 | ) | |
2024 | coreconfigitem( |
|
2040 | coreconfigitem( | |
2025 | b'storage', |
|
2041 | b'storage', | |
2026 | b'revlog.issue6528.fix-incoming', |
|
2042 | b'revlog.issue6528.fix-incoming', | |
2027 | default=True, |
|
2043 | default=True, | |
2028 | ) |
|
2044 | ) | |
2029 | # experimental as long as rust is experimental (or a C version is implemented) |
|
2045 | # experimental as long as rust is experimental (or a C version is implemented) | |
2030 | coreconfigitem( |
|
2046 | coreconfigitem( | |
2031 | b'storage', |
|
2047 | b'storage', | |
2032 | b'revlog.persistent-nodemap.mmap', |
|
2048 | b'revlog.persistent-nodemap.mmap', | |
2033 | default=True, |
|
2049 | default=True, | |
2034 | ) |
|
2050 | ) | |
2035 | # experimental as long as format.use-persistent-nodemap is. |
|
2051 | # experimental as long as format.use-persistent-nodemap is. | |
2036 | coreconfigitem( |
|
2052 | coreconfigitem( | |
2037 | b'storage', |
|
2053 | b'storage', | |
2038 | b'revlog.persistent-nodemap.slow-path', |
|
2054 | b'revlog.persistent-nodemap.slow-path', | |
2039 | default=b"abort", |
|
2055 | default=b"abort", | |
2040 | ) |
|
2056 | ) | |
2041 |
|
2057 | |||
2042 | coreconfigitem( |
|
2058 | coreconfigitem( | |
2043 | b'storage', |
|
2059 | b'storage', | |
2044 | b'revlog.reuse-external-delta', |
|
2060 | b'revlog.reuse-external-delta', | |
2045 | default=True, |
|
2061 | default=True, | |
2046 | ) |
|
2062 | ) | |
2047 | coreconfigitem( |
|
2063 | coreconfigitem( | |
2048 | b'storage', |
|
2064 | b'storage', | |
2049 | b'revlog.reuse-external-delta-parent', |
|
2065 | b'revlog.reuse-external-delta-parent', | |
2050 | default=None, |
|
2066 | default=None, | |
2051 | ) |
|
2067 | ) | |
2052 | coreconfigitem( |
|
2068 | coreconfigitem( | |
2053 | b'storage', |
|
2069 | b'storage', | |
2054 | b'revlog.zlib.level', |
|
2070 | b'revlog.zlib.level', | |
2055 | default=None, |
|
2071 | default=None, | |
2056 | ) |
|
2072 | ) | |
2057 | coreconfigitem( |
|
2073 | coreconfigitem( | |
2058 | b'storage', |
|
2074 | b'storage', | |
2059 | b'revlog.zstd.level', |
|
2075 | b'revlog.zstd.level', | |
2060 | default=None, |
|
2076 | default=None, | |
2061 | ) |
|
2077 | ) | |
2062 | coreconfigitem( |
|
2078 | coreconfigitem( | |
2063 | b'server', |
|
2079 | b'server', | |
2064 | b'bookmarks-pushkey-compat', |
|
2080 | b'bookmarks-pushkey-compat', | |
2065 | default=True, |
|
2081 | default=True, | |
2066 | ) |
|
2082 | ) | |
2067 | coreconfigitem( |
|
2083 | coreconfigitem( | |
2068 | b'server', |
|
2084 | b'server', | |
2069 | b'bundle1', |
|
2085 | b'bundle1', | |
2070 | default=True, |
|
2086 | default=True, | |
2071 | ) |
|
2087 | ) | |
2072 | coreconfigitem( |
|
2088 | coreconfigitem( | |
2073 | b'server', |
|
2089 | b'server', | |
2074 | b'bundle1gd', |
|
2090 | b'bundle1gd', | |
2075 | default=None, |
|
2091 | default=None, | |
2076 | ) |
|
2092 | ) | |
2077 | coreconfigitem( |
|
2093 | coreconfigitem( | |
2078 | b'server', |
|
2094 | b'server', | |
2079 | b'bundle1.pull', |
|
2095 | b'bundle1.pull', | |
2080 | default=None, |
|
2096 | default=None, | |
2081 | ) |
|
2097 | ) | |
2082 | coreconfigitem( |
|
2098 | coreconfigitem( | |
2083 | b'server', |
|
2099 | b'server', | |
2084 | b'bundle1gd.pull', |
|
2100 | b'bundle1gd.pull', | |
2085 | default=None, |
|
2101 | default=None, | |
2086 | ) |
|
2102 | ) | |
2087 | coreconfigitem( |
|
2103 | coreconfigitem( | |
2088 | b'server', |
|
2104 | b'server', | |
2089 | b'bundle1.push', |
|
2105 | b'bundle1.push', | |
2090 | default=None, |
|
2106 | default=None, | |
2091 | ) |
|
2107 | ) | |
2092 | coreconfigitem( |
|
2108 | coreconfigitem( | |
2093 | b'server', |
|
2109 | b'server', | |
2094 | b'bundle1gd.push', |
|
2110 | b'bundle1gd.push', | |
2095 | default=None, |
|
2111 | default=None, | |
2096 | ) |
|
2112 | ) | |
2097 | coreconfigitem( |
|
2113 | coreconfigitem( | |
2098 | b'server', |
|
2114 | b'server', | |
2099 | b'bundle2.stream', |
|
2115 | b'bundle2.stream', | |
2100 | default=True, |
|
2116 | default=True, | |
2101 | alias=[(b'experimental', b'bundle2.stream')], |
|
2117 | alias=[(b'experimental', b'bundle2.stream')], | |
2102 | ) |
|
2118 | ) | |
2103 | coreconfigitem( |
|
2119 | coreconfigitem( | |
2104 | b'server', |
|
2120 | b'server', | |
2105 | b'compressionengines', |
|
2121 | b'compressionengines', | |
2106 | default=list, |
|
2122 | default=list, | |
2107 | ) |
|
2123 | ) | |
2108 | coreconfigitem( |
|
2124 | coreconfigitem( | |
2109 | b'server', |
|
2125 | b'server', | |
2110 | b'concurrent-push-mode', |
|
2126 | b'concurrent-push-mode', | |
2111 | default=b'check-related', |
|
2127 | default=b'check-related', | |
2112 | ) |
|
2128 | ) | |
2113 | coreconfigitem( |
|
2129 | coreconfigitem( | |
2114 | b'server', |
|
2130 | b'server', | |
2115 | b'disablefullbundle', |
|
2131 | b'disablefullbundle', | |
2116 | default=False, |
|
2132 | default=False, | |
2117 | ) |
|
2133 | ) | |
2118 | coreconfigitem( |
|
2134 | coreconfigitem( | |
2119 | b'server', |
|
2135 | b'server', | |
2120 | b'maxhttpheaderlen', |
|
2136 | b'maxhttpheaderlen', | |
2121 | default=1024, |
|
2137 | default=1024, | |
2122 | ) |
|
2138 | ) | |
2123 | coreconfigitem( |
|
2139 | coreconfigitem( | |
2124 | b'server', |
|
2140 | b'server', | |
2125 | b'pullbundle', |
|
2141 | b'pullbundle', | |
2126 | default=False, |
|
2142 | default=False, | |
2127 | ) |
|
2143 | ) | |
2128 | coreconfigitem( |
|
2144 | coreconfigitem( | |
2129 | b'server', |
|
2145 | b'server', | |
2130 | b'preferuncompressed', |
|
2146 | b'preferuncompressed', | |
2131 | default=False, |
|
2147 | default=False, | |
2132 | ) |
|
2148 | ) | |
2133 | coreconfigitem( |
|
2149 | coreconfigitem( | |
2134 | b'server', |
|
2150 | b'server', | |
2135 | b'streamunbundle', |
|
2151 | b'streamunbundle', | |
2136 | default=False, |
|
2152 | default=False, | |
2137 | ) |
|
2153 | ) | |
2138 | coreconfigitem( |
|
2154 | coreconfigitem( | |
2139 | b'server', |
|
2155 | b'server', | |
2140 | b'uncompressed', |
|
2156 | b'uncompressed', | |
2141 | default=True, |
|
2157 | default=True, | |
2142 | ) |
|
2158 | ) | |
2143 | coreconfigitem( |
|
2159 | coreconfigitem( | |
2144 | b'server', |
|
2160 | b'server', | |
2145 | b'uncompressedallowsecret', |
|
2161 | b'uncompressedallowsecret', | |
2146 | default=False, |
|
2162 | default=False, | |
2147 | ) |
|
2163 | ) | |
2148 | coreconfigitem( |
|
2164 | coreconfigitem( | |
2149 | b'server', |
|
2165 | b'server', | |
2150 | b'view', |
|
2166 | b'view', | |
2151 | default=b'served', |
|
2167 | default=b'served', | |
2152 | ) |
|
2168 | ) | |
2153 | coreconfigitem( |
|
2169 | coreconfigitem( | |
2154 | b'server', |
|
2170 | b'server', | |
2155 | b'validate', |
|
2171 | b'validate', | |
2156 | default=False, |
|
2172 | default=False, | |
2157 | ) |
|
2173 | ) | |
2158 | coreconfigitem( |
|
2174 | coreconfigitem( | |
2159 | b'server', |
|
2175 | b'server', | |
2160 | b'zliblevel', |
|
2176 | b'zliblevel', | |
2161 | default=-1, |
|
2177 | default=-1, | |
2162 | ) |
|
2178 | ) | |
2163 | coreconfigitem( |
|
2179 | coreconfigitem( | |
2164 | b'server', |
|
2180 | b'server', | |
2165 | b'zstdlevel', |
|
2181 | b'zstdlevel', | |
2166 | default=3, |
|
2182 | default=3, | |
2167 | ) |
|
2183 | ) | |
2168 | coreconfigitem( |
|
2184 | coreconfigitem( | |
2169 | b'share', |
|
2185 | b'share', | |
2170 | b'pool', |
|
2186 | b'pool', | |
2171 | default=None, |
|
2187 | default=None, | |
2172 | ) |
|
2188 | ) | |
2173 | coreconfigitem( |
|
2189 | coreconfigitem( | |
2174 | b'share', |
|
2190 | b'share', | |
2175 | b'poolnaming', |
|
2191 | b'poolnaming', | |
2176 | default=b'identity', |
|
2192 | default=b'identity', | |
2177 | ) |
|
2193 | ) | |
2178 | coreconfigitem( |
|
2194 | coreconfigitem( | |
2179 | b'share', |
|
2195 | b'share', | |
2180 | b'safe-mismatch.source-not-safe', |
|
2196 | b'safe-mismatch.source-not-safe', | |
2181 | default=b'abort', |
|
2197 | default=b'abort', | |
2182 | ) |
|
2198 | ) | |
2183 | coreconfigitem( |
|
2199 | coreconfigitem( | |
2184 | b'share', |
|
2200 | b'share', | |
2185 | b'safe-mismatch.source-safe', |
|
2201 | b'safe-mismatch.source-safe', | |
2186 | default=b'abort', |
|
2202 | default=b'abort', | |
2187 | ) |
|
2203 | ) | |
2188 | coreconfigitem( |
|
2204 | coreconfigitem( | |
2189 | b'share', |
|
2205 | b'share', | |
2190 | b'safe-mismatch.source-not-safe.warn', |
|
2206 | b'safe-mismatch.source-not-safe.warn', | |
2191 | default=True, |
|
2207 | default=True, | |
2192 | ) |
|
2208 | ) | |
2193 | coreconfigitem( |
|
2209 | coreconfigitem( | |
2194 | b'share', |
|
2210 | b'share', | |
2195 | b'safe-mismatch.source-safe.warn', |
|
2211 | b'safe-mismatch.source-safe.warn', | |
2196 | default=True, |
|
2212 | default=True, | |
2197 | ) |
|
2213 | ) | |
2198 | coreconfigitem( |
|
2214 | coreconfigitem( | |
2199 | b'share', |
|
2215 | b'share', | |
2200 | b'safe-mismatch.source-not-safe:verbose-upgrade', |
|
2216 | b'safe-mismatch.source-not-safe:verbose-upgrade', | |
2201 | default=True, |
|
2217 | default=True, | |
2202 | ) |
|
2218 | ) | |
2203 | coreconfigitem( |
|
2219 | coreconfigitem( | |
2204 | b'share', |
|
2220 | b'share', | |
2205 | b'safe-mismatch.source-safe:verbose-upgrade', |
|
2221 | b'safe-mismatch.source-safe:verbose-upgrade', | |
2206 | default=True, |
|
2222 | default=True, | |
2207 | ) |
|
2223 | ) | |
2208 | coreconfigitem( |
|
2224 | coreconfigitem( | |
2209 | b'shelve', |
|
2225 | b'shelve', | |
2210 | b'maxbackups', |
|
2226 | b'maxbackups', | |
2211 | default=10, |
|
2227 | default=10, | |
2212 | ) |
|
2228 | ) | |
2213 | coreconfigitem( |
|
2229 | coreconfigitem( | |
2214 | b'smtp', |
|
2230 | b'smtp', | |
2215 | b'host', |
|
2231 | b'host', | |
2216 | default=None, |
|
2232 | default=None, | |
2217 | ) |
|
2233 | ) | |
2218 | coreconfigitem( |
|
2234 | coreconfigitem( | |
2219 | b'smtp', |
|
2235 | b'smtp', | |
2220 | b'local_hostname', |
|
2236 | b'local_hostname', | |
2221 | default=None, |
|
2237 | default=None, | |
2222 | ) |
|
2238 | ) | |
2223 | coreconfigitem( |
|
2239 | coreconfigitem( | |
2224 | b'smtp', |
|
2240 | b'smtp', | |
2225 | b'password', |
|
2241 | b'password', | |
2226 | default=None, |
|
2242 | default=None, | |
2227 | ) |
|
2243 | ) | |
2228 | coreconfigitem( |
|
2244 | coreconfigitem( | |
2229 | b'smtp', |
|
2245 | b'smtp', | |
2230 | b'port', |
|
2246 | b'port', | |
2231 | default=dynamicdefault, |
|
2247 | default=dynamicdefault, | |
2232 | ) |
|
2248 | ) | |
2233 | coreconfigitem( |
|
2249 | coreconfigitem( | |
2234 | b'smtp', |
|
2250 | b'smtp', | |
2235 | b'tls', |
|
2251 | b'tls', | |
2236 | default=b'none', |
|
2252 | default=b'none', | |
2237 | ) |
|
2253 | ) | |
2238 | coreconfigitem( |
|
2254 | coreconfigitem( | |
2239 | b'smtp', |
|
2255 | b'smtp', | |
2240 | b'username', |
|
2256 | b'username', | |
2241 | default=None, |
|
2257 | default=None, | |
2242 | ) |
|
2258 | ) | |
2243 | coreconfigitem( |
|
2259 | coreconfigitem( | |
2244 | b'sparse', |
|
2260 | b'sparse', | |
2245 | b'missingwarning', |
|
2261 | b'missingwarning', | |
2246 | default=True, |
|
2262 | default=True, | |
2247 | experimental=True, |
|
2263 | experimental=True, | |
2248 | ) |
|
2264 | ) | |
2249 | coreconfigitem( |
|
2265 | coreconfigitem( | |
2250 | b'subrepos', |
|
2266 | b'subrepos', | |
2251 | b'allowed', |
|
2267 | b'allowed', | |
2252 | default=dynamicdefault, # to make backporting simpler |
|
2268 | default=dynamicdefault, # to make backporting simpler | |
2253 | ) |
|
2269 | ) | |
2254 | coreconfigitem( |
|
2270 | coreconfigitem( | |
2255 | b'subrepos', |
|
2271 | b'subrepos', | |
2256 | b'hg:allowed', |
|
2272 | b'hg:allowed', | |
2257 | default=dynamicdefault, |
|
2273 | default=dynamicdefault, | |
2258 | ) |
|
2274 | ) | |
2259 | coreconfigitem( |
|
2275 | coreconfigitem( | |
2260 | b'subrepos', |
|
2276 | b'subrepos', | |
2261 | b'git:allowed', |
|
2277 | b'git:allowed', | |
2262 | default=dynamicdefault, |
|
2278 | default=dynamicdefault, | |
2263 | ) |
|
2279 | ) | |
2264 | coreconfigitem( |
|
2280 | coreconfigitem( | |
2265 | b'subrepos', |
|
2281 | b'subrepos', | |
2266 | b'svn:allowed', |
|
2282 | b'svn:allowed', | |
2267 | default=dynamicdefault, |
|
2283 | default=dynamicdefault, | |
2268 | ) |
|
2284 | ) | |
2269 | coreconfigitem( |
|
2285 | coreconfigitem( | |
2270 | b'templates', |
|
2286 | b'templates', | |
2271 | b'.*', |
|
2287 | b'.*', | |
2272 | default=None, |
|
2288 | default=None, | |
2273 | generic=True, |
|
2289 | generic=True, | |
2274 | ) |
|
2290 | ) | |
2275 | coreconfigitem( |
|
2291 | coreconfigitem( | |
2276 | b'templateconfig', |
|
2292 | b'templateconfig', | |
2277 | b'.*', |
|
2293 | b'.*', | |
2278 | default=dynamicdefault, |
|
2294 | default=dynamicdefault, | |
2279 | generic=True, |
|
2295 | generic=True, | |
2280 | ) |
|
2296 | ) | |
2281 | coreconfigitem( |
|
2297 | coreconfigitem( | |
2282 | b'trusted', |
|
2298 | b'trusted', | |
2283 | b'groups', |
|
2299 | b'groups', | |
2284 | default=list, |
|
2300 | default=list, | |
2285 | ) |
|
2301 | ) | |
2286 | coreconfigitem( |
|
2302 | coreconfigitem( | |
2287 | b'trusted', |
|
2303 | b'trusted', | |
2288 | b'users', |
|
2304 | b'users', | |
2289 | default=list, |
|
2305 | default=list, | |
2290 | ) |
|
2306 | ) | |
2291 | coreconfigitem( |
|
2307 | coreconfigitem( | |
2292 | b'ui', |
|
2308 | b'ui', | |
2293 | b'_usedassubrepo', |
|
2309 | b'_usedassubrepo', | |
2294 | default=False, |
|
2310 | default=False, | |
2295 | ) |
|
2311 | ) | |
2296 | coreconfigitem( |
|
2312 | coreconfigitem( | |
2297 | b'ui', |
|
2313 | b'ui', | |
2298 | b'allowemptycommit', |
|
2314 | b'allowemptycommit', | |
2299 | default=False, |
|
2315 | default=False, | |
2300 | ) |
|
2316 | ) | |
2301 | coreconfigitem( |
|
2317 | coreconfigitem( | |
2302 | b'ui', |
|
2318 | b'ui', | |
2303 | b'archivemeta', |
|
2319 | b'archivemeta', | |
2304 | default=True, |
|
2320 | default=True, | |
2305 | ) |
|
2321 | ) | |
2306 | coreconfigitem( |
|
2322 | coreconfigitem( | |
2307 | b'ui', |
|
2323 | b'ui', | |
2308 | b'askusername', |
|
2324 | b'askusername', | |
2309 | default=False, |
|
2325 | default=False, | |
2310 | ) |
|
2326 | ) | |
2311 | coreconfigitem( |
|
2327 | coreconfigitem( | |
2312 | b'ui', |
|
2328 | b'ui', | |
2313 | b'available-memory', |
|
2329 | b'available-memory', | |
2314 | default=None, |
|
2330 | default=None, | |
2315 | ) |
|
2331 | ) | |
2316 |
|
2332 | |||
2317 | coreconfigitem( |
|
2333 | coreconfigitem( | |
2318 | b'ui', |
|
2334 | b'ui', | |
2319 | b'clonebundlefallback', |
|
2335 | b'clonebundlefallback', | |
2320 | default=False, |
|
2336 | default=False, | |
2321 | ) |
|
2337 | ) | |
2322 | coreconfigitem( |
|
2338 | coreconfigitem( | |
2323 | b'ui', |
|
2339 | b'ui', | |
2324 | b'clonebundleprefers', |
|
2340 | b'clonebundleprefers', | |
2325 | default=list, |
|
2341 | default=list, | |
2326 | ) |
|
2342 | ) | |
2327 | coreconfigitem( |
|
2343 | coreconfigitem( | |
2328 | b'ui', |
|
2344 | b'ui', | |
2329 | b'clonebundles', |
|
2345 | b'clonebundles', | |
2330 | default=True, |
|
2346 | default=True, | |
2331 | ) |
|
2347 | ) | |
2332 | coreconfigitem( |
|
2348 | coreconfigitem( | |
2333 | b'ui', |
|
2349 | b'ui', | |
2334 | b'color', |
|
2350 | b'color', | |
2335 | default=b'auto', |
|
2351 | default=b'auto', | |
2336 | ) |
|
2352 | ) | |
2337 | coreconfigitem( |
|
2353 | coreconfigitem( | |
2338 | b'ui', |
|
2354 | b'ui', | |
2339 | b'commitsubrepos', |
|
2355 | b'commitsubrepos', | |
2340 | default=False, |
|
2356 | default=False, | |
2341 | ) |
|
2357 | ) | |
2342 | coreconfigitem( |
|
2358 | coreconfigitem( | |
2343 | b'ui', |
|
2359 | b'ui', | |
2344 | b'debug', |
|
2360 | b'debug', | |
2345 | default=False, |
|
2361 | default=False, | |
2346 | ) |
|
2362 | ) | |
2347 | coreconfigitem( |
|
2363 | coreconfigitem( | |
2348 | b'ui', |
|
2364 | b'ui', | |
2349 | b'debugger', |
|
2365 | b'debugger', | |
2350 | default=None, |
|
2366 | default=None, | |
2351 | ) |
|
2367 | ) | |
2352 | coreconfigitem( |
|
2368 | coreconfigitem( | |
2353 | b'ui', |
|
2369 | b'ui', | |
2354 | b'editor', |
|
2370 | b'editor', | |
2355 | default=dynamicdefault, |
|
2371 | default=dynamicdefault, | |
2356 | ) |
|
2372 | ) | |
2357 | coreconfigitem( |
|
2373 | coreconfigitem( | |
2358 | b'ui', |
|
2374 | b'ui', | |
2359 | b'detailed-exit-code', |
|
2375 | b'detailed-exit-code', | |
2360 | default=False, |
|
2376 | default=False, | |
2361 | experimental=True, |
|
2377 | experimental=True, | |
2362 | ) |
|
2378 | ) | |
2363 | coreconfigitem( |
|
2379 | coreconfigitem( | |
2364 | b'ui', |
|
2380 | b'ui', | |
2365 | b'fallbackencoding', |
|
2381 | b'fallbackencoding', | |
2366 | default=None, |
|
2382 | default=None, | |
2367 | ) |
|
2383 | ) | |
2368 | coreconfigitem( |
|
2384 | coreconfigitem( | |
2369 | b'ui', |
|
2385 | b'ui', | |
2370 | b'forcecwd', |
|
2386 | b'forcecwd', | |
2371 | default=None, |
|
2387 | default=None, | |
2372 | ) |
|
2388 | ) | |
2373 | coreconfigitem( |
|
2389 | coreconfigitem( | |
2374 | b'ui', |
|
2390 | b'ui', | |
2375 | b'forcemerge', |
|
2391 | b'forcemerge', | |
2376 | default=None, |
|
2392 | default=None, | |
2377 | ) |
|
2393 | ) | |
2378 | coreconfigitem( |
|
2394 | coreconfigitem( | |
2379 | b'ui', |
|
2395 | b'ui', | |
2380 | b'formatdebug', |
|
2396 | b'formatdebug', | |
2381 | default=False, |
|
2397 | default=False, | |
2382 | ) |
|
2398 | ) | |
2383 | coreconfigitem( |
|
2399 | coreconfigitem( | |
2384 | b'ui', |
|
2400 | b'ui', | |
2385 | b'formatjson', |
|
2401 | b'formatjson', | |
2386 | default=False, |
|
2402 | default=False, | |
2387 | ) |
|
2403 | ) | |
2388 | coreconfigitem( |
|
2404 | coreconfigitem( | |
2389 | b'ui', |
|
2405 | b'ui', | |
2390 | b'formatted', |
|
2406 | b'formatted', | |
2391 | default=None, |
|
2407 | default=None, | |
2392 | ) |
|
2408 | ) | |
2393 | coreconfigitem( |
|
2409 | coreconfigitem( | |
2394 | b'ui', |
|
2410 | b'ui', | |
2395 | b'interactive', |
|
2411 | b'interactive', | |
2396 | default=None, |
|
2412 | default=None, | |
2397 | ) |
|
2413 | ) | |
2398 | coreconfigitem( |
|
2414 | coreconfigitem( | |
2399 | b'ui', |
|
2415 | b'ui', | |
2400 | b'interface', |
|
2416 | b'interface', | |
2401 | default=None, |
|
2417 | default=None, | |
2402 | ) |
|
2418 | ) | |
2403 | coreconfigitem( |
|
2419 | coreconfigitem( | |
2404 | b'ui', |
|
2420 | b'ui', | |
2405 | b'interface.chunkselector', |
|
2421 | b'interface.chunkselector', | |
2406 | default=None, |
|
2422 | default=None, | |
2407 | ) |
|
2423 | ) | |
2408 | coreconfigitem( |
|
2424 | coreconfigitem( | |
2409 | b'ui', |
|
2425 | b'ui', | |
2410 | b'large-file-limit', |
|
2426 | b'large-file-limit', | |
2411 | default=10 * (2 ** 20), |
|
2427 | default=10 * (2 ** 20), | |
2412 | ) |
|
2428 | ) | |
2413 | coreconfigitem( |
|
2429 | coreconfigitem( | |
2414 | b'ui', |
|
2430 | b'ui', | |
2415 | b'logblockedtimes', |
|
2431 | b'logblockedtimes', | |
2416 | default=False, |
|
2432 | default=False, | |
2417 | ) |
|
2433 | ) | |
2418 | coreconfigitem( |
|
2434 | coreconfigitem( | |
2419 | b'ui', |
|
2435 | b'ui', | |
2420 | b'merge', |
|
2436 | b'merge', | |
2421 | default=None, |
|
2437 | default=None, | |
2422 | ) |
|
2438 | ) | |
2423 | coreconfigitem( |
|
2439 | coreconfigitem( | |
2424 | b'ui', |
|
2440 | b'ui', | |
2425 | b'mergemarkers', |
|
2441 | b'mergemarkers', | |
2426 | default=b'basic', |
|
2442 | default=b'basic', | |
2427 | ) |
|
2443 | ) | |
2428 | coreconfigitem( |
|
2444 | coreconfigitem( | |
2429 | b'ui', |
|
2445 | b'ui', | |
2430 | b'message-output', |
|
2446 | b'message-output', | |
2431 | default=b'stdio', |
|
2447 | default=b'stdio', | |
2432 | ) |
|
2448 | ) | |
2433 | coreconfigitem( |
|
2449 | coreconfigitem( | |
2434 | b'ui', |
|
2450 | b'ui', | |
2435 | b'nontty', |
|
2451 | b'nontty', | |
2436 | default=False, |
|
2452 | default=False, | |
2437 | ) |
|
2453 | ) | |
2438 | coreconfigitem( |
|
2454 | coreconfigitem( | |
2439 | b'ui', |
|
2455 | b'ui', | |
2440 | b'origbackuppath', |
|
2456 | b'origbackuppath', | |
2441 | default=None, |
|
2457 | default=None, | |
2442 | ) |
|
2458 | ) | |
2443 | coreconfigitem( |
|
2459 | coreconfigitem( | |
2444 | b'ui', |
|
2460 | b'ui', | |
2445 | b'paginate', |
|
2461 | b'paginate', | |
2446 | default=True, |
|
2462 | default=True, | |
2447 | ) |
|
2463 | ) | |
2448 | coreconfigitem( |
|
2464 | coreconfigitem( | |
2449 | b'ui', |
|
2465 | b'ui', | |
2450 | b'patch', |
|
2466 | b'patch', | |
2451 | default=None, |
|
2467 | default=None, | |
2452 | ) |
|
2468 | ) | |
2453 | coreconfigitem( |
|
2469 | coreconfigitem( | |
2454 | b'ui', |
|
2470 | b'ui', | |
2455 | b'portablefilenames', |
|
2471 | b'portablefilenames', | |
2456 | default=b'warn', |
|
2472 | default=b'warn', | |
2457 | ) |
|
2473 | ) | |
2458 | coreconfigitem( |
|
2474 | coreconfigitem( | |
2459 | b'ui', |
|
2475 | b'ui', | |
2460 | b'promptecho', |
|
2476 | b'promptecho', | |
2461 | default=False, |
|
2477 | default=False, | |
2462 | ) |
|
2478 | ) | |
2463 | coreconfigitem( |
|
2479 | coreconfigitem( | |
2464 | b'ui', |
|
2480 | b'ui', | |
2465 | b'quiet', |
|
2481 | b'quiet', | |
2466 | default=False, |
|
2482 | default=False, | |
2467 | ) |
|
2483 | ) | |
2468 | coreconfigitem( |
|
2484 | coreconfigitem( | |
2469 | b'ui', |
|
2485 | b'ui', | |
2470 | b'quietbookmarkmove', |
|
2486 | b'quietbookmarkmove', | |
2471 | default=False, |
|
2487 | default=False, | |
2472 | ) |
|
2488 | ) | |
2473 | coreconfigitem( |
|
2489 | coreconfigitem( | |
2474 | b'ui', |
|
2490 | b'ui', | |
2475 | b'relative-paths', |
|
2491 | b'relative-paths', | |
2476 | default=b'legacy', |
|
2492 | default=b'legacy', | |
2477 | ) |
|
2493 | ) | |
2478 | coreconfigitem( |
|
2494 | coreconfigitem( | |
2479 | b'ui', |
|
2495 | b'ui', | |
2480 | b'remotecmd', |
|
2496 | b'remotecmd', | |
2481 | default=b'hg', |
|
2497 | default=b'hg', | |
2482 | ) |
|
2498 | ) | |
2483 | coreconfigitem( |
|
2499 | coreconfigitem( | |
2484 | b'ui', |
|
2500 | b'ui', | |
2485 | b'report_untrusted', |
|
2501 | b'report_untrusted', | |
2486 | default=True, |
|
2502 | default=True, | |
2487 | ) |
|
2503 | ) | |
2488 | coreconfigitem( |
|
2504 | coreconfigitem( | |
2489 | b'ui', |
|
2505 | b'ui', | |
2490 | b'rollback', |
|
2506 | b'rollback', | |
2491 | default=True, |
|
2507 | default=True, | |
2492 | ) |
|
2508 | ) | |
2493 | coreconfigitem( |
|
2509 | coreconfigitem( | |
2494 | b'ui', |
|
2510 | b'ui', | |
2495 | b'signal-safe-lock', |
|
2511 | b'signal-safe-lock', | |
2496 | default=True, |
|
2512 | default=True, | |
2497 | ) |
|
2513 | ) | |
2498 | coreconfigitem( |
|
2514 | coreconfigitem( | |
2499 | b'ui', |
|
2515 | b'ui', | |
2500 | b'slash', |
|
2516 | b'slash', | |
2501 | default=False, |
|
2517 | default=False, | |
2502 | ) |
|
2518 | ) | |
2503 | coreconfigitem( |
|
2519 | coreconfigitem( | |
2504 | b'ui', |
|
2520 | b'ui', | |
2505 | b'ssh', |
|
2521 | b'ssh', | |
2506 | default=b'ssh', |
|
2522 | default=b'ssh', | |
2507 | ) |
|
2523 | ) | |
2508 | coreconfigitem( |
|
2524 | coreconfigitem( | |
2509 | b'ui', |
|
2525 | b'ui', | |
2510 | b'ssherrorhint', |
|
2526 | b'ssherrorhint', | |
2511 | default=None, |
|
2527 | default=None, | |
2512 | ) |
|
2528 | ) | |
2513 | coreconfigitem( |
|
2529 | coreconfigitem( | |
2514 | b'ui', |
|
2530 | b'ui', | |
2515 | b'statuscopies', |
|
2531 | b'statuscopies', | |
2516 | default=False, |
|
2532 | default=False, | |
2517 | ) |
|
2533 | ) | |
2518 | coreconfigitem( |
|
2534 | coreconfigitem( | |
2519 | b'ui', |
|
2535 | b'ui', | |
2520 | b'strict', |
|
2536 | b'strict', | |
2521 | default=False, |
|
2537 | default=False, | |
2522 | ) |
|
2538 | ) | |
2523 | coreconfigitem( |
|
2539 | coreconfigitem( | |
2524 | b'ui', |
|
2540 | b'ui', | |
2525 | b'style', |
|
2541 | b'style', | |
2526 | default=b'', |
|
2542 | default=b'', | |
2527 | ) |
|
2543 | ) | |
2528 | coreconfigitem( |
|
2544 | coreconfigitem( | |
2529 | b'ui', |
|
2545 | b'ui', | |
2530 | b'supportcontact', |
|
2546 | b'supportcontact', | |
2531 | default=None, |
|
2547 | default=None, | |
2532 | ) |
|
2548 | ) | |
2533 | coreconfigitem( |
|
2549 | coreconfigitem( | |
2534 | b'ui', |
|
2550 | b'ui', | |
2535 | b'textwidth', |
|
2551 | b'textwidth', | |
2536 | default=78, |
|
2552 | default=78, | |
2537 | ) |
|
2553 | ) | |
2538 | coreconfigitem( |
|
2554 | coreconfigitem( | |
2539 | b'ui', |
|
2555 | b'ui', | |
2540 | b'timeout', |
|
2556 | b'timeout', | |
2541 | default=b'600', |
|
2557 | default=b'600', | |
2542 | ) |
|
2558 | ) | |
2543 | coreconfigitem( |
|
2559 | coreconfigitem( | |
2544 | b'ui', |
|
2560 | b'ui', | |
2545 | b'timeout.warn', |
|
2561 | b'timeout.warn', | |
2546 | default=0, |
|
2562 | default=0, | |
2547 | ) |
|
2563 | ) | |
2548 | coreconfigitem( |
|
2564 | coreconfigitem( | |
2549 | b'ui', |
|
2565 | b'ui', | |
2550 | b'timestamp-output', |
|
2566 | b'timestamp-output', | |
2551 | default=False, |
|
2567 | default=False, | |
2552 | ) |
|
2568 | ) | |
2553 | coreconfigitem( |
|
2569 | coreconfigitem( | |
2554 | b'ui', |
|
2570 | b'ui', | |
2555 | b'traceback', |
|
2571 | b'traceback', | |
2556 | default=False, |
|
2572 | default=False, | |
2557 | ) |
|
2573 | ) | |
2558 | coreconfigitem( |
|
2574 | coreconfigitem( | |
2559 | b'ui', |
|
2575 | b'ui', | |
2560 | b'tweakdefaults', |
|
2576 | b'tweakdefaults', | |
2561 | default=False, |
|
2577 | default=False, | |
2562 | ) |
|
2578 | ) | |
2563 | coreconfigitem(b'ui', b'username', alias=[(b'ui', b'user')]) |
|
2579 | coreconfigitem(b'ui', b'username', alias=[(b'ui', b'user')]) | |
2564 | coreconfigitem( |
|
2580 | coreconfigitem( | |
2565 | b'ui', |
|
2581 | b'ui', | |
2566 | b'verbose', |
|
2582 | b'verbose', | |
2567 | default=False, |
|
2583 | default=False, | |
2568 | ) |
|
2584 | ) | |
2569 | coreconfigitem( |
|
2585 | coreconfigitem( | |
2570 | b'verify', |
|
2586 | b'verify', | |
2571 | b'skipflags', |
|
2587 | b'skipflags', | |
2572 | default=0, |
|
2588 | default=0, | |
2573 | ) |
|
2589 | ) | |
2574 | coreconfigitem( |
|
2590 | coreconfigitem( | |
2575 | b'web', |
|
2591 | b'web', | |
2576 | b'allowbz2', |
|
2592 | b'allowbz2', | |
2577 | default=False, |
|
2593 | default=False, | |
2578 | ) |
|
2594 | ) | |
2579 | coreconfigitem( |
|
2595 | coreconfigitem( | |
2580 | b'web', |
|
2596 | b'web', | |
2581 | b'allowgz', |
|
2597 | b'allowgz', | |
2582 | default=False, |
|
2598 | default=False, | |
2583 | ) |
|
2599 | ) | |
2584 | coreconfigitem( |
|
2600 | coreconfigitem( | |
2585 | b'web', |
|
2601 | b'web', | |
2586 | b'allow-pull', |
|
2602 | b'allow-pull', | |
2587 | alias=[(b'web', b'allowpull')], |
|
2603 | alias=[(b'web', b'allowpull')], | |
2588 | default=True, |
|
2604 | default=True, | |
2589 | ) |
|
2605 | ) | |
2590 | coreconfigitem( |
|
2606 | coreconfigitem( | |
2591 | b'web', |
|
2607 | b'web', | |
2592 | b'allow-push', |
|
2608 | b'allow-push', | |
2593 | alias=[(b'web', b'allow_push')], |
|
2609 | alias=[(b'web', b'allow_push')], | |
2594 | default=list, |
|
2610 | default=list, | |
2595 | ) |
|
2611 | ) | |
2596 | coreconfigitem( |
|
2612 | coreconfigitem( | |
2597 | b'web', |
|
2613 | b'web', | |
2598 | b'allowzip', |
|
2614 | b'allowzip', | |
2599 | default=False, |
|
2615 | default=False, | |
2600 | ) |
|
2616 | ) | |
2601 | coreconfigitem( |
|
2617 | coreconfigitem( | |
2602 | b'web', |
|
2618 | b'web', | |
2603 | b'archivesubrepos', |
|
2619 | b'archivesubrepos', | |
2604 | default=False, |
|
2620 | default=False, | |
2605 | ) |
|
2621 | ) | |
2606 | coreconfigitem( |
|
2622 | coreconfigitem( | |
2607 | b'web', |
|
2623 | b'web', | |
2608 | b'cache', |
|
2624 | b'cache', | |
2609 | default=True, |
|
2625 | default=True, | |
2610 | ) |
|
2626 | ) | |
2611 | coreconfigitem( |
|
2627 | coreconfigitem( | |
2612 | b'web', |
|
2628 | b'web', | |
2613 | b'comparisoncontext', |
|
2629 | b'comparisoncontext', | |
2614 | default=5, |
|
2630 | default=5, | |
2615 | ) |
|
2631 | ) | |
2616 | coreconfigitem( |
|
2632 | coreconfigitem( | |
2617 | b'web', |
|
2633 | b'web', | |
2618 | b'contact', |
|
2634 | b'contact', | |
2619 | default=None, |
|
2635 | default=None, | |
2620 | ) |
|
2636 | ) | |
2621 | coreconfigitem( |
|
2637 | coreconfigitem( | |
2622 | b'web', |
|
2638 | b'web', | |
2623 | b'deny_push', |
|
2639 | b'deny_push', | |
2624 | default=list, |
|
2640 | default=list, | |
2625 | ) |
|
2641 | ) | |
2626 | coreconfigitem( |
|
2642 | coreconfigitem( | |
2627 | b'web', |
|
2643 | b'web', | |
2628 | b'guessmime', |
|
2644 | b'guessmime', | |
2629 | default=False, |
|
2645 | default=False, | |
2630 | ) |
|
2646 | ) | |
2631 | coreconfigitem( |
|
2647 | coreconfigitem( | |
2632 | b'web', |
|
2648 | b'web', | |
2633 | b'hidden', |
|
2649 | b'hidden', | |
2634 | default=False, |
|
2650 | default=False, | |
2635 | ) |
|
2651 | ) | |
2636 | coreconfigitem( |
|
2652 | coreconfigitem( | |
2637 | b'web', |
|
2653 | b'web', | |
2638 | b'labels', |
|
2654 | b'labels', | |
2639 | default=list, |
|
2655 | default=list, | |
2640 | ) |
|
2656 | ) | |
2641 | coreconfigitem( |
|
2657 | coreconfigitem( | |
2642 | b'web', |
|
2658 | b'web', | |
2643 | b'logoimg', |
|
2659 | b'logoimg', | |
2644 | default=b'hglogo.png', |
|
2660 | default=b'hglogo.png', | |
2645 | ) |
|
2661 | ) | |
2646 | coreconfigitem( |
|
2662 | coreconfigitem( | |
2647 | b'web', |
|
2663 | b'web', | |
2648 | b'logourl', |
|
2664 | b'logourl', | |
2649 | default=b'https://mercurial-scm.org/', |
|
2665 | default=b'https://mercurial-scm.org/', | |
2650 | ) |
|
2666 | ) | |
2651 | coreconfigitem( |
|
2667 | coreconfigitem( | |
2652 | b'web', |
|
2668 | b'web', | |
2653 | b'accesslog', |
|
2669 | b'accesslog', | |
2654 | default=b'-', |
|
2670 | default=b'-', | |
2655 | ) |
|
2671 | ) | |
2656 | coreconfigitem( |
|
2672 | coreconfigitem( | |
2657 | b'web', |
|
2673 | b'web', | |
2658 | b'address', |
|
2674 | b'address', | |
2659 | default=b'', |
|
2675 | default=b'', | |
2660 | ) |
|
2676 | ) | |
2661 | coreconfigitem( |
|
2677 | coreconfigitem( | |
2662 | b'web', |
|
2678 | b'web', | |
2663 | b'allow-archive', |
|
2679 | b'allow-archive', | |
2664 | alias=[(b'web', b'allow_archive')], |
|
2680 | alias=[(b'web', b'allow_archive')], | |
2665 | default=list, |
|
2681 | default=list, | |
2666 | ) |
|
2682 | ) | |
2667 | coreconfigitem( |
|
2683 | coreconfigitem( | |
2668 | b'web', |
|
2684 | b'web', | |
2669 | b'allow_read', |
|
2685 | b'allow_read', | |
2670 | default=list, |
|
2686 | default=list, | |
2671 | ) |
|
2687 | ) | |
2672 | coreconfigitem( |
|
2688 | coreconfigitem( | |
2673 | b'web', |
|
2689 | b'web', | |
2674 | b'baseurl', |
|
2690 | b'baseurl', | |
2675 | default=None, |
|
2691 | default=None, | |
2676 | ) |
|
2692 | ) | |
2677 | coreconfigitem( |
|
2693 | coreconfigitem( | |
2678 | b'web', |
|
2694 | b'web', | |
2679 | b'cacerts', |
|
2695 | b'cacerts', | |
2680 | default=None, |
|
2696 | default=None, | |
2681 | ) |
|
2697 | ) | |
2682 | coreconfigitem( |
|
2698 | coreconfigitem( | |
2683 | b'web', |
|
2699 | b'web', | |
2684 | b'certificate', |
|
2700 | b'certificate', | |
2685 | default=None, |
|
2701 | default=None, | |
2686 | ) |
|
2702 | ) | |
2687 | coreconfigitem( |
|
2703 | coreconfigitem( | |
2688 | b'web', |
|
2704 | b'web', | |
2689 | b'collapse', |
|
2705 | b'collapse', | |
2690 | default=False, |
|
2706 | default=False, | |
2691 | ) |
|
2707 | ) | |
2692 | coreconfigitem( |
|
2708 | coreconfigitem( | |
2693 | b'web', |
|
2709 | b'web', | |
2694 | b'csp', |
|
2710 | b'csp', | |
2695 | default=None, |
|
2711 | default=None, | |
2696 | ) |
|
2712 | ) | |
2697 | coreconfigitem( |
|
2713 | coreconfigitem( | |
2698 | b'web', |
|
2714 | b'web', | |
2699 | b'deny_read', |
|
2715 | b'deny_read', | |
2700 | default=list, |
|
2716 | default=list, | |
2701 | ) |
|
2717 | ) | |
2702 | coreconfigitem( |
|
2718 | coreconfigitem( | |
2703 | b'web', |
|
2719 | b'web', | |
2704 | b'descend', |
|
2720 | b'descend', | |
2705 | default=True, |
|
2721 | default=True, | |
2706 | ) |
|
2722 | ) | |
2707 | coreconfigitem( |
|
2723 | coreconfigitem( | |
2708 | b'web', |
|
2724 | b'web', | |
2709 | b'description', |
|
2725 | b'description', | |
2710 | default=b"", |
|
2726 | default=b"", | |
2711 | ) |
|
2727 | ) | |
2712 | coreconfigitem( |
|
2728 | coreconfigitem( | |
2713 | b'web', |
|
2729 | b'web', | |
2714 | b'encoding', |
|
2730 | b'encoding', | |
2715 | default=lambda: encoding.encoding, |
|
2731 | default=lambda: encoding.encoding, | |
2716 | ) |
|
2732 | ) | |
2717 | coreconfigitem( |
|
2733 | coreconfigitem( | |
2718 | b'web', |
|
2734 | b'web', | |
2719 | b'errorlog', |
|
2735 | b'errorlog', | |
2720 | default=b'-', |
|
2736 | default=b'-', | |
2721 | ) |
|
2737 | ) | |
2722 | coreconfigitem( |
|
2738 | coreconfigitem( | |
2723 | b'web', |
|
2739 | b'web', | |
2724 | b'ipv6', |
|
2740 | b'ipv6', | |
2725 | default=False, |
|
2741 | default=False, | |
2726 | ) |
|
2742 | ) | |
2727 | coreconfigitem( |
|
2743 | coreconfigitem( | |
2728 | b'web', |
|
2744 | b'web', | |
2729 | b'maxchanges', |
|
2745 | b'maxchanges', | |
2730 | default=10, |
|
2746 | default=10, | |
2731 | ) |
|
2747 | ) | |
2732 | coreconfigitem( |
|
2748 | coreconfigitem( | |
2733 | b'web', |
|
2749 | b'web', | |
2734 | b'maxfiles', |
|
2750 | b'maxfiles', | |
2735 | default=10, |
|
2751 | default=10, | |
2736 | ) |
|
2752 | ) | |
2737 | coreconfigitem( |
|
2753 | coreconfigitem( | |
2738 | b'web', |
|
2754 | b'web', | |
2739 | b'maxshortchanges', |
|
2755 | b'maxshortchanges', | |
2740 | default=60, |
|
2756 | default=60, | |
2741 | ) |
|
2757 | ) | |
2742 | coreconfigitem( |
|
2758 | coreconfigitem( | |
2743 | b'web', |
|
2759 | b'web', | |
2744 | b'motd', |
|
2760 | b'motd', | |
2745 | default=b'', |
|
2761 | default=b'', | |
2746 | ) |
|
2762 | ) | |
2747 | coreconfigitem( |
|
2763 | coreconfigitem( | |
2748 | b'web', |
|
2764 | b'web', | |
2749 | b'name', |
|
2765 | b'name', | |
2750 | default=dynamicdefault, |
|
2766 | default=dynamicdefault, | |
2751 | ) |
|
2767 | ) | |
2752 | coreconfigitem( |
|
2768 | coreconfigitem( | |
2753 | b'web', |
|
2769 | b'web', | |
2754 | b'port', |
|
2770 | b'port', | |
2755 | default=8000, |
|
2771 | default=8000, | |
2756 | ) |
|
2772 | ) | |
2757 | coreconfigitem( |
|
2773 | coreconfigitem( | |
2758 | b'web', |
|
2774 | b'web', | |
2759 | b'prefix', |
|
2775 | b'prefix', | |
2760 | default=b'', |
|
2776 | default=b'', | |
2761 | ) |
|
2777 | ) | |
2762 | coreconfigitem( |
|
2778 | coreconfigitem( | |
2763 | b'web', |
|
2779 | b'web', | |
2764 | b'push_ssl', |
|
2780 | b'push_ssl', | |
2765 | default=True, |
|
2781 | default=True, | |
2766 | ) |
|
2782 | ) | |
2767 | coreconfigitem( |
|
2783 | coreconfigitem( | |
2768 | b'web', |
|
2784 | b'web', | |
2769 | b'refreshinterval', |
|
2785 | b'refreshinterval', | |
2770 | default=20, |
|
2786 | default=20, | |
2771 | ) |
|
2787 | ) | |
2772 | coreconfigitem( |
|
2788 | coreconfigitem( | |
2773 | b'web', |
|
2789 | b'web', | |
2774 | b'server-header', |
|
2790 | b'server-header', | |
2775 | default=None, |
|
2791 | default=None, | |
2776 | ) |
|
2792 | ) | |
2777 | coreconfigitem( |
|
2793 | coreconfigitem( | |
2778 | b'web', |
|
2794 | b'web', | |
2779 | b'static', |
|
2795 | b'static', | |
2780 | default=None, |
|
2796 | default=None, | |
2781 | ) |
|
2797 | ) | |
2782 | coreconfigitem( |
|
2798 | coreconfigitem( | |
2783 | b'web', |
|
2799 | b'web', | |
2784 | b'staticurl', |
|
2800 | b'staticurl', | |
2785 | default=None, |
|
2801 | default=None, | |
2786 | ) |
|
2802 | ) | |
2787 | coreconfigitem( |
|
2803 | coreconfigitem( | |
2788 | b'web', |
|
2804 | b'web', | |
2789 | b'stripes', |
|
2805 | b'stripes', | |
2790 | default=1, |
|
2806 | default=1, | |
2791 | ) |
|
2807 | ) | |
2792 | coreconfigitem( |
|
2808 | coreconfigitem( | |
2793 | b'web', |
|
2809 | b'web', | |
2794 | b'style', |
|
2810 | b'style', | |
2795 | default=b'paper', |
|
2811 | default=b'paper', | |
2796 | ) |
|
2812 | ) | |
2797 | coreconfigitem( |
|
2813 | coreconfigitem( | |
2798 | b'web', |
|
2814 | b'web', | |
2799 | b'templates', |
|
2815 | b'templates', | |
2800 | default=None, |
|
2816 | default=None, | |
2801 | ) |
|
2817 | ) | |
2802 | coreconfigitem( |
|
2818 | coreconfigitem( | |
2803 | b'web', |
|
2819 | b'web', | |
2804 | b'view', |
|
2820 | b'view', | |
2805 | default=b'served', |
|
2821 | default=b'served', | |
2806 | experimental=True, |
|
2822 | experimental=True, | |
2807 | ) |
|
2823 | ) | |
2808 | coreconfigitem( |
|
2824 | coreconfigitem( | |
2809 | b'worker', |
|
2825 | b'worker', | |
2810 | b'backgroundclose', |
|
2826 | b'backgroundclose', | |
2811 | default=dynamicdefault, |
|
2827 | default=dynamicdefault, | |
2812 | ) |
|
2828 | ) | |
2813 | # Windows defaults to a limit of 512 open files. A buffer of 128 |
|
2829 | # Windows defaults to a limit of 512 open files. A buffer of 128 | |
2814 | # should give us enough headway. |
|
2830 | # should give us enough headway. | |
2815 | coreconfigitem( |
|
2831 | coreconfigitem( | |
2816 | b'worker', |
|
2832 | b'worker', | |
2817 | b'backgroundclosemaxqueue', |
|
2833 | b'backgroundclosemaxqueue', | |
2818 | default=384, |
|
2834 | default=384, | |
2819 | ) |
|
2835 | ) | |
2820 | coreconfigitem( |
|
2836 | coreconfigitem( | |
2821 | b'worker', |
|
2837 | b'worker', | |
2822 | b'backgroundcloseminfilecount', |
|
2838 | b'backgroundcloseminfilecount', | |
2823 | default=2048, |
|
2839 | default=2048, | |
2824 | ) |
|
2840 | ) | |
2825 | coreconfigitem( |
|
2841 | coreconfigitem( | |
2826 | b'worker', |
|
2842 | b'worker', | |
2827 | b'backgroundclosethreadcount', |
|
2843 | b'backgroundclosethreadcount', | |
2828 | default=4, |
|
2844 | default=4, | |
2829 | ) |
|
2845 | ) | |
2830 | coreconfigitem( |
|
2846 | coreconfigitem( | |
2831 | b'worker', |
|
2847 | b'worker', | |
2832 | b'enabled', |
|
2848 | b'enabled', | |
2833 | default=True, |
|
2849 | default=True, | |
2834 | ) |
|
2850 | ) | |
2835 | coreconfigitem( |
|
2851 | coreconfigitem( | |
2836 | b'worker', |
|
2852 | b'worker', | |
2837 | b'numcpus', |
|
2853 | b'numcpus', | |
2838 | default=None, |
|
2854 | default=None, | |
2839 | ) |
|
2855 | ) | |
2840 |
|
2856 | |||
2841 | # Rebase related configuration moved to core because other extension are doing |
|
2857 | # Rebase related configuration moved to core because other extension are doing | |
2842 | # strange things. For example, shelve import the extensions to reuse some bit |
|
2858 | # strange things. For example, shelve import the extensions to reuse some bit | |
2843 | # without formally loading it. |
|
2859 | # without formally loading it. | |
2844 | coreconfigitem( |
|
2860 | coreconfigitem( | |
2845 | b'commands', |
|
2861 | b'commands', | |
2846 | b'rebase.requiredest', |
|
2862 | b'rebase.requiredest', | |
2847 | default=False, |
|
2863 | default=False, | |
2848 | ) |
|
2864 | ) | |
2849 | coreconfigitem( |
|
2865 | coreconfigitem( | |
2850 | b'experimental', |
|
2866 | b'experimental', | |
2851 | b'rebaseskipobsolete', |
|
2867 | b'rebaseskipobsolete', | |
2852 | default=True, |
|
2868 | default=True, | |
2853 | ) |
|
2869 | ) | |
2854 | coreconfigitem( |
|
2870 | coreconfigitem( | |
2855 | b'rebase', |
|
2871 | b'rebase', | |
2856 | b'singletransaction', |
|
2872 | b'singletransaction', | |
2857 | default=False, |
|
2873 | default=False, | |
2858 | ) |
|
2874 | ) | |
2859 | coreconfigitem( |
|
2875 | coreconfigitem( | |
2860 | b'rebase', |
|
2876 | b'rebase', | |
2861 | b'experimental.inmemory', |
|
2877 | b'experimental.inmemory', | |
2862 | default=False, |
|
2878 | default=False, | |
2863 | ) |
|
2879 | ) | |
2864 |
|
2880 | |||
2865 | # This setting controls creation of a rebase_source extra field |
|
2881 | # This setting controls creation of a rebase_source extra field | |
2866 | # during rebase. When False, no such field is created. This is |
|
2882 | # during rebase. When False, no such field is created. This is | |
2867 | # useful eg for incrementally converting changesets and then |
|
2883 | # useful eg for incrementally converting changesets and then | |
2868 | # rebasing them onto an existing repo. |
|
2884 | # rebasing them onto an existing repo. | |
2869 | # WARNING: this is an advanced setting reserved for people who know |
|
2885 | # WARNING: this is an advanced setting reserved for people who know | |
2870 | # exactly what they are doing. Misuse of this setting can easily |
|
2886 | # exactly what they are doing. Misuse of this setting can easily | |
2871 | # result in obsmarker cycles and a vivid headache. |
|
2887 | # result in obsmarker cycles and a vivid headache. | |
2872 | coreconfigitem( |
|
2888 | coreconfigitem( | |
2873 | b'rebase', |
|
2889 | b'rebase', | |
2874 | b'store-source', |
|
2890 | b'store-source', | |
2875 | default=True, |
|
2891 | default=True, | |
2876 | experimental=True, |
|
2892 | experimental=True, | |
2877 | ) |
|
2893 | ) |
@@ -1,3149 +1,3150 b'' | |||||
1 | # context.py - changeset and file context objects for mercurial |
|
1 | # context.py - changeset and file context objects for mercurial | |
2 | # |
|
2 | # | |
3 | # Copyright 2006, 2007 Olivia Mackall <olivia@selenic.com> |
|
3 | # Copyright 2006, 2007 Olivia Mackall <olivia@selenic.com> | |
4 | # |
|
4 | # | |
5 | # This software may be used and distributed according to the terms of the |
|
5 | # This software may be used and distributed according to the terms of the | |
6 | # GNU General Public License version 2 or any later version. |
|
6 | # GNU General Public License version 2 or any later version. | |
7 |
|
7 | |||
8 |
|
8 | |||
9 | import filecmp |
|
9 | import filecmp | |
10 | import os |
|
10 | import os | |
11 | import stat |
|
11 | import stat | |
12 |
|
12 | |||
13 | from .i18n import _ |
|
13 | from .i18n import _ | |
14 | from .node import ( |
|
14 | from .node import ( | |
15 | hex, |
|
15 | hex, | |
16 | nullrev, |
|
16 | nullrev, | |
17 | short, |
|
17 | short, | |
18 | ) |
|
18 | ) | |
19 | from .pycompat import ( |
|
19 | from .pycompat import ( | |
20 | getattr, |
|
20 | getattr, | |
21 | ) |
|
21 | ) | |
22 | from . import ( |
|
22 | from . import ( | |
23 | dagop, |
|
23 | dagop, | |
24 | encoding, |
|
24 | encoding, | |
25 | error, |
|
25 | error, | |
26 | fileset, |
|
26 | fileset, | |
27 | match as matchmod, |
|
27 | match as matchmod, | |
28 | mergestate as mergestatemod, |
|
28 | mergestate as mergestatemod, | |
29 | metadata, |
|
29 | metadata, | |
30 | obsolete as obsmod, |
|
30 | obsolete as obsmod, | |
31 | patch, |
|
31 | patch, | |
32 | pathutil, |
|
32 | pathutil, | |
33 | phases, |
|
33 | phases, | |
34 | repoview, |
|
34 | repoview, | |
35 | scmutil, |
|
35 | scmutil, | |
36 | sparse, |
|
36 | sparse, | |
37 | subrepo, |
|
37 | subrepo, | |
38 | subrepoutil, |
|
38 | subrepoutil, | |
|
39 | testing, | |||
39 | util, |
|
40 | util, | |
40 | ) |
|
41 | ) | |
41 | from .utils import ( |
|
42 | from .utils import ( | |
42 | dateutil, |
|
43 | dateutil, | |
43 | stringutil, |
|
44 | stringutil, | |
44 | ) |
|
45 | ) | |
45 | from .dirstateutils import ( |
|
46 | from .dirstateutils import ( | |
46 | timestamp, |
|
47 | timestamp, | |
47 | ) |
|
48 | ) | |
48 |
|
49 | |||
49 | propertycache = util.propertycache |
|
50 | propertycache = util.propertycache | |
50 |
|
51 | |||
51 |
|
52 | |||
52 | class basectx: |
|
53 | class basectx: | |
53 | """A basectx object represents the common logic for its children: |
|
54 | """A basectx object represents the common logic for its children: | |
54 | changectx: read-only context that is already present in the repo, |
|
55 | changectx: read-only context that is already present in the repo, | |
55 | workingctx: a context that represents the working directory and can |
|
56 | workingctx: a context that represents the working directory and can | |
56 | be committed, |
|
57 | be committed, | |
57 | memctx: a context that represents changes in-memory and can also |
|
58 | memctx: a context that represents changes in-memory and can also | |
58 | be committed.""" |
|
59 | be committed.""" | |
59 |
|
60 | |||
60 | def __init__(self, repo): |
|
61 | def __init__(self, repo): | |
61 | self._repo = repo |
|
62 | self._repo = repo | |
62 |
|
63 | |||
63 | def __bytes__(self): |
|
64 | def __bytes__(self): | |
64 | return short(self.node()) |
|
65 | return short(self.node()) | |
65 |
|
66 | |||
66 | __str__ = encoding.strmethod(__bytes__) |
|
67 | __str__ = encoding.strmethod(__bytes__) | |
67 |
|
68 | |||
68 | def __repr__(self): |
|
69 | def __repr__(self): | |
69 | return "<%s %s>" % (type(self).__name__, str(self)) |
|
70 | return "<%s %s>" % (type(self).__name__, str(self)) | |
70 |
|
71 | |||
71 | def __eq__(self, other): |
|
72 | def __eq__(self, other): | |
72 | try: |
|
73 | try: | |
73 | return type(self) == type(other) and self._rev == other._rev |
|
74 | return type(self) == type(other) and self._rev == other._rev | |
74 | except AttributeError: |
|
75 | except AttributeError: | |
75 | return False |
|
76 | return False | |
76 |
|
77 | |||
77 | def __ne__(self, other): |
|
78 | def __ne__(self, other): | |
78 | return not (self == other) |
|
79 | return not (self == other) | |
79 |
|
80 | |||
80 | def __contains__(self, key): |
|
81 | def __contains__(self, key): | |
81 | return key in self._manifest |
|
82 | return key in self._manifest | |
82 |
|
83 | |||
83 | def __getitem__(self, key): |
|
84 | def __getitem__(self, key): | |
84 | return self.filectx(key) |
|
85 | return self.filectx(key) | |
85 |
|
86 | |||
86 | def __iter__(self): |
|
87 | def __iter__(self): | |
87 | return iter(self._manifest) |
|
88 | return iter(self._manifest) | |
88 |
|
89 | |||
89 | def _buildstatusmanifest(self, status): |
|
90 | def _buildstatusmanifest(self, status): | |
90 | """Builds a manifest that includes the given status results, if this is |
|
91 | """Builds a manifest that includes the given status results, if this is | |
91 | a working copy context. For non-working copy contexts, it just returns |
|
92 | a working copy context. For non-working copy contexts, it just returns | |
92 | the normal manifest.""" |
|
93 | the normal manifest.""" | |
93 | return self.manifest() |
|
94 | return self.manifest() | |
94 |
|
95 | |||
95 | def _matchstatus(self, other, match): |
|
96 | def _matchstatus(self, other, match): | |
96 | """This internal method provides a way for child objects to override the |
|
97 | """This internal method provides a way for child objects to override the | |
97 | match operator. |
|
98 | match operator. | |
98 | """ |
|
99 | """ | |
99 | return match |
|
100 | return match | |
100 |
|
101 | |||
101 | def _buildstatus( |
|
102 | def _buildstatus( | |
102 | self, other, s, match, listignored, listclean, listunknown |
|
103 | self, other, s, match, listignored, listclean, listunknown | |
103 | ): |
|
104 | ): | |
104 | """build a status with respect to another context""" |
|
105 | """build a status with respect to another context""" | |
105 | # Load earliest manifest first for caching reasons. More specifically, |
|
106 | # Load earliest manifest first for caching reasons. More specifically, | |
106 | # if you have revisions 1000 and 1001, 1001 is probably stored as a |
|
107 | # if you have revisions 1000 and 1001, 1001 is probably stored as a | |
107 | # delta against 1000. Thus, if you read 1000 first, we'll reconstruct |
|
108 | # delta against 1000. Thus, if you read 1000 first, we'll reconstruct | |
108 | # 1000 and cache it so that when you read 1001, we just need to apply a |
|
109 | # 1000 and cache it so that when you read 1001, we just need to apply a | |
109 | # delta to what's in the cache. So that's one full reconstruction + one |
|
110 | # delta to what's in the cache. So that's one full reconstruction + one | |
110 | # delta application. |
|
111 | # delta application. | |
111 | mf2 = None |
|
112 | mf2 = None | |
112 | if self.rev() is not None and self.rev() < other.rev(): |
|
113 | if self.rev() is not None and self.rev() < other.rev(): | |
113 | mf2 = self._buildstatusmanifest(s) |
|
114 | mf2 = self._buildstatusmanifest(s) | |
114 | mf1 = other._buildstatusmanifest(s) |
|
115 | mf1 = other._buildstatusmanifest(s) | |
115 | if mf2 is None: |
|
116 | if mf2 is None: | |
116 | mf2 = self._buildstatusmanifest(s) |
|
117 | mf2 = self._buildstatusmanifest(s) | |
117 |
|
118 | |||
118 | modified, added = [], [] |
|
119 | modified, added = [], [] | |
119 | removed = [] |
|
120 | removed = [] | |
120 | clean = [] |
|
121 | clean = [] | |
121 | deleted, unknown, ignored = s.deleted, s.unknown, s.ignored |
|
122 | deleted, unknown, ignored = s.deleted, s.unknown, s.ignored | |
122 | deletedset = set(deleted) |
|
123 | deletedset = set(deleted) | |
123 | d = mf1.diff(mf2, match=match, clean=listclean) |
|
124 | d = mf1.diff(mf2, match=match, clean=listclean) | |
124 | for fn, value in d.items(): |
|
125 | for fn, value in d.items(): | |
125 | if fn in deletedset: |
|
126 | if fn in deletedset: | |
126 | continue |
|
127 | continue | |
127 | if value is None: |
|
128 | if value is None: | |
128 | clean.append(fn) |
|
129 | clean.append(fn) | |
129 | continue |
|
130 | continue | |
130 | (node1, flag1), (node2, flag2) = value |
|
131 | (node1, flag1), (node2, flag2) = value | |
131 | if node1 is None: |
|
132 | if node1 is None: | |
132 | added.append(fn) |
|
133 | added.append(fn) | |
133 | elif node2 is None: |
|
134 | elif node2 is None: | |
134 | removed.append(fn) |
|
135 | removed.append(fn) | |
135 | elif flag1 != flag2: |
|
136 | elif flag1 != flag2: | |
136 | modified.append(fn) |
|
137 | modified.append(fn) | |
137 | elif node2 not in self._repo.nodeconstants.wdirfilenodeids: |
|
138 | elif node2 not in self._repo.nodeconstants.wdirfilenodeids: | |
138 | # When comparing files between two commits, we save time by |
|
139 | # When comparing files between two commits, we save time by | |
139 | # not comparing the file contents when the nodeids differ. |
|
140 | # not comparing the file contents when the nodeids differ. | |
140 | # Note that this means we incorrectly report a reverted change |
|
141 | # Note that this means we incorrectly report a reverted change | |
141 | # to a file as a modification. |
|
142 | # to a file as a modification. | |
142 | modified.append(fn) |
|
143 | modified.append(fn) | |
143 | elif self[fn].cmp(other[fn]): |
|
144 | elif self[fn].cmp(other[fn]): | |
144 | modified.append(fn) |
|
145 | modified.append(fn) | |
145 | else: |
|
146 | else: | |
146 | clean.append(fn) |
|
147 | clean.append(fn) | |
147 |
|
148 | |||
148 | if removed: |
|
149 | if removed: | |
149 | # need to filter files if they are already reported as removed |
|
150 | # need to filter files if they are already reported as removed | |
150 | unknown = [ |
|
151 | unknown = [ | |
151 | fn |
|
152 | fn | |
152 | for fn in unknown |
|
153 | for fn in unknown | |
153 | if fn not in mf1 and (not match or match(fn)) |
|
154 | if fn not in mf1 and (not match or match(fn)) | |
154 | ] |
|
155 | ] | |
155 | ignored = [ |
|
156 | ignored = [ | |
156 | fn |
|
157 | fn | |
157 | for fn in ignored |
|
158 | for fn in ignored | |
158 | if fn not in mf1 and (not match or match(fn)) |
|
159 | if fn not in mf1 and (not match or match(fn)) | |
159 | ] |
|
160 | ] | |
160 | # if they're deleted, don't report them as removed |
|
161 | # if they're deleted, don't report them as removed | |
161 | removed = [fn for fn in removed if fn not in deletedset] |
|
162 | removed = [fn for fn in removed if fn not in deletedset] | |
162 |
|
163 | |||
163 | return scmutil.status( |
|
164 | return scmutil.status( | |
164 | modified, added, removed, deleted, unknown, ignored, clean |
|
165 | modified, added, removed, deleted, unknown, ignored, clean | |
165 | ) |
|
166 | ) | |
166 |
|
167 | |||
167 | @propertycache |
|
168 | @propertycache | |
168 | def substate(self): |
|
169 | def substate(self): | |
169 | return subrepoutil.state(self, self._repo.ui) |
|
170 | return subrepoutil.state(self, self._repo.ui) | |
170 |
|
171 | |||
171 | def subrev(self, subpath): |
|
172 | def subrev(self, subpath): | |
172 | return self.substate[subpath][1] |
|
173 | return self.substate[subpath][1] | |
173 |
|
174 | |||
174 | def rev(self): |
|
175 | def rev(self): | |
175 | return self._rev |
|
176 | return self._rev | |
176 |
|
177 | |||
177 | def node(self): |
|
178 | def node(self): | |
178 | return self._node |
|
179 | return self._node | |
179 |
|
180 | |||
180 | def hex(self): |
|
181 | def hex(self): | |
181 | return hex(self.node()) |
|
182 | return hex(self.node()) | |
182 |
|
183 | |||
183 | def manifest(self): |
|
184 | def manifest(self): | |
184 | return self._manifest |
|
185 | return self._manifest | |
185 |
|
186 | |||
186 | def manifestctx(self): |
|
187 | def manifestctx(self): | |
187 | return self._manifestctx |
|
188 | return self._manifestctx | |
188 |
|
189 | |||
189 | def repo(self): |
|
190 | def repo(self): | |
190 | return self._repo |
|
191 | return self._repo | |
191 |
|
192 | |||
192 | def phasestr(self): |
|
193 | def phasestr(self): | |
193 | return phases.phasenames[self.phase()] |
|
194 | return phases.phasenames[self.phase()] | |
194 |
|
195 | |||
195 | def mutable(self): |
|
196 | def mutable(self): | |
196 | return self.phase() > phases.public |
|
197 | return self.phase() > phases.public | |
197 |
|
198 | |||
198 | def matchfileset(self, cwd, expr, badfn=None): |
|
199 | def matchfileset(self, cwd, expr, badfn=None): | |
199 | return fileset.match(self, cwd, expr, badfn=badfn) |
|
200 | return fileset.match(self, cwd, expr, badfn=badfn) | |
200 |
|
201 | |||
201 | def obsolete(self): |
|
202 | def obsolete(self): | |
202 | """True if the changeset is obsolete""" |
|
203 | """True if the changeset is obsolete""" | |
203 | return self.rev() in obsmod.getrevs(self._repo, b'obsolete') |
|
204 | return self.rev() in obsmod.getrevs(self._repo, b'obsolete') | |
204 |
|
205 | |||
205 | def extinct(self): |
|
206 | def extinct(self): | |
206 | """True if the changeset is extinct""" |
|
207 | """True if the changeset is extinct""" | |
207 | return self.rev() in obsmod.getrevs(self._repo, b'extinct') |
|
208 | return self.rev() in obsmod.getrevs(self._repo, b'extinct') | |
208 |
|
209 | |||
209 | def orphan(self): |
|
210 | def orphan(self): | |
210 | """True if the changeset is not obsolete, but its ancestor is""" |
|
211 | """True if the changeset is not obsolete, but its ancestor is""" | |
211 | return self.rev() in obsmod.getrevs(self._repo, b'orphan') |
|
212 | return self.rev() in obsmod.getrevs(self._repo, b'orphan') | |
212 |
|
213 | |||
213 | def phasedivergent(self): |
|
214 | def phasedivergent(self): | |
214 | """True if the changeset tries to be a successor of a public changeset |
|
215 | """True if the changeset tries to be a successor of a public changeset | |
215 |
|
216 | |||
216 | Only non-public and non-obsolete changesets may be phase-divergent. |
|
217 | Only non-public and non-obsolete changesets may be phase-divergent. | |
217 | """ |
|
218 | """ | |
218 | return self.rev() in obsmod.getrevs(self._repo, b'phasedivergent') |
|
219 | return self.rev() in obsmod.getrevs(self._repo, b'phasedivergent') | |
219 |
|
220 | |||
220 | def contentdivergent(self): |
|
221 | def contentdivergent(self): | |
221 | """Is a successor of a changeset with multiple possible successor sets |
|
222 | """Is a successor of a changeset with multiple possible successor sets | |
222 |
|
223 | |||
223 | Only non-public and non-obsolete changesets may be content-divergent. |
|
224 | Only non-public and non-obsolete changesets may be content-divergent. | |
224 | """ |
|
225 | """ | |
225 | return self.rev() in obsmod.getrevs(self._repo, b'contentdivergent') |
|
226 | return self.rev() in obsmod.getrevs(self._repo, b'contentdivergent') | |
226 |
|
227 | |||
227 | def isunstable(self): |
|
228 | def isunstable(self): | |
228 | """True if the changeset is either orphan, phase-divergent or |
|
229 | """True if the changeset is either orphan, phase-divergent or | |
229 | content-divergent""" |
|
230 | content-divergent""" | |
230 | return self.orphan() or self.phasedivergent() or self.contentdivergent() |
|
231 | return self.orphan() or self.phasedivergent() or self.contentdivergent() | |
231 |
|
232 | |||
232 | def instabilities(self): |
|
233 | def instabilities(self): | |
233 | """return the list of instabilities affecting this changeset. |
|
234 | """return the list of instabilities affecting this changeset. | |
234 |
|
235 | |||
235 | Instabilities are returned as strings. possible values are: |
|
236 | Instabilities are returned as strings. possible values are: | |
236 | - orphan, |
|
237 | - orphan, | |
237 | - phase-divergent, |
|
238 | - phase-divergent, | |
238 | - content-divergent. |
|
239 | - content-divergent. | |
239 | """ |
|
240 | """ | |
240 | instabilities = [] |
|
241 | instabilities = [] | |
241 | if self.orphan(): |
|
242 | if self.orphan(): | |
242 | instabilities.append(b'orphan') |
|
243 | instabilities.append(b'orphan') | |
243 | if self.phasedivergent(): |
|
244 | if self.phasedivergent(): | |
244 | instabilities.append(b'phase-divergent') |
|
245 | instabilities.append(b'phase-divergent') | |
245 | if self.contentdivergent(): |
|
246 | if self.contentdivergent(): | |
246 | instabilities.append(b'content-divergent') |
|
247 | instabilities.append(b'content-divergent') | |
247 | return instabilities |
|
248 | return instabilities | |
248 |
|
249 | |||
249 | def parents(self): |
|
250 | def parents(self): | |
250 | """return contexts for each parent changeset""" |
|
251 | """return contexts for each parent changeset""" | |
251 | return self._parents |
|
252 | return self._parents | |
252 |
|
253 | |||
253 | def p1(self): |
|
254 | def p1(self): | |
254 | return self._parents[0] |
|
255 | return self._parents[0] | |
255 |
|
256 | |||
256 | def p2(self): |
|
257 | def p2(self): | |
257 | parents = self._parents |
|
258 | parents = self._parents | |
258 | if len(parents) == 2: |
|
259 | if len(parents) == 2: | |
259 | return parents[1] |
|
260 | return parents[1] | |
260 | return self._repo[nullrev] |
|
261 | return self._repo[nullrev] | |
261 |
|
262 | |||
262 | def _fileinfo(self, path): |
|
263 | def _fileinfo(self, path): | |
263 | if '_manifest' in self.__dict__: |
|
264 | if '_manifest' in self.__dict__: | |
264 | try: |
|
265 | try: | |
265 | return self._manifest.find(path) |
|
266 | return self._manifest.find(path) | |
266 | except KeyError: |
|
267 | except KeyError: | |
267 | raise error.ManifestLookupError( |
|
268 | raise error.ManifestLookupError( | |
268 | self._node or b'None', path, _(b'not found in manifest') |
|
269 | self._node or b'None', path, _(b'not found in manifest') | |
269 | ) |
|
270 | ) | |
270 | if '_manifestdelta' in self.__dict__ or path in self.files(): |
|
271 | if '_manifestdelta' in self.__dict__ or path in self.files(): | |
271 | if path in self._manifestdelta: |
|
272 | if path in self._manifestdelta: | |
272 | return ( |
|
273 | return ( | |
273 | self._manifestdelta[path], |
|
274 | self._manifestdelta[path], | |
274 | self._manifestdelta.flags(path), |
|
275 | self._manifestdelta.flags(path), | |
275 | ) |
|
276 | ) | |
276 | mfl = self._repo.manifestlog |
|
277 | mfl = self._repo.manifestlog | |
277 | try: |
|
278 | try: | |
278 | node, flag = mfl[self._changeset.manifest].find(path) |
|
279 | node, flag = mfl[self._changeset.manifest].find(path) | |
279 | except KeyError: |
|
280 | except KeyError: | |
280 | raise error.ManifestLookupError( |
|
281 | raise error.ManifestLookupError( | |
281 | self._node or b'None', path, _(b'not found in manifest') |
|
282 | self._node or b'None', path, _(b'not found in manifest') | |
282 | ) |
|
283 | ) | |
283 |
|
284 | |||
284 | return node, flag |
|
285 | return node, flag | |
285 |
|
286 | |||
286 | def filenode(self, path): |
|
287 | def filenode(self, path): | |
287 | return self._fileinfo(path)[0] |
|
288 | return self._fileinfo(path)[0] | |
288 |
|
289 | |||
289 | def flags(self, path): |
|
290 | def flags(self, path): | |
290 | try: |
|
291 | try: | |
291 | return self._fileinfo(path)[1] |
|
292 | return self._fileinfo(path)[1] | |
292 | except error.LookupError: |
|
293 | except error.LookupError: | |
293 | return b'' |
|
294 | return b'' | |
294 |
|
295 | |||
295 | @propertycache |
|
296 | @propertycache | |
296 | def _copies(self): |
|
297 | def _copies(self): | |
297 | return metadata.computechangesetcopies(self) |
|
298 | return metadata.computechangesetcopies(self) | |
298 |
|
299 | |||
299 | def p1copies(self): |
|
300 | def p1copies(self): | |
300 | return self._copies[0] |
|
301 | return self._copies[0] | |
301 |
|
302 | |||
302 | def p2copies(self): |
|
303 | def p2copies(self): | |
303 | return self._copies[1] |
|
304 | return self._copies[1] | |
304 |
|
305 | |||
305 | def sub(self, path, allowcreate=True): |
|
306 | def sub(self, path, allowcreate=True): | |
306 | '''return a subrepo for the stored revision of path, never wdir()''' |
|
307 | '''return a subrepo for the stored revision of path, never wdir()''' | |
307 | return subrepo.subrepo(self, path, allowcreate=allowcreate) |
|
308 | return subrepo.subrepo(self, path, allowcreate=allowcreate) | |
308 |
|
309 | |||
309 | def nullsub(self, path, pctx): |
|
310 | def nullsub(self, path, pctx): | |
310 | return subrepo.nullsubrepo(self, path, pctx) |
|
311 | return subrepo.nullsubrepo(self, path, pctx) | |
311 |
|
312 | |||
312 | def workingsub(self, path): |
|
313 | def workingsub(self, path): | |
313 | """return a subrepo for the stored revision, or wdir if this is a wdir |
|
314 | """return a subrepo for the stored revision, or wdir if this is a wdir | |
314 | context. |
|
315 | context. | |
315 | """ |
|
316 | """ | |
316 | return subrepo.subrepo(self, path, allowwdir=True) |
|
317 | return subrepo.subrepo(self, path, allowwdir=True) | |
317 |
|
318 | |||
318 | def match( |
|
319 | def match( | |
319 | self, |
|
320 | self, | |
320 | pats=None, |
|
321 | pats=None, | |
321 | include=None, |
|
322 | include=None, | |
322 | exclude=None, |
|
323 | exclude=None, | |
323 | default=b'glob', |
|
324 | default=b'glob', | |
324 | listsubrepos=False, |
|
325 | listsubrepos=False, | |
325 | badfn=None, |
|
326 | badfn=None, | |
326 | cwd=None, |
|
327 | cwd=None, | |
327 | ): |
|
328 | ): | |
328 | r = self._repo |
|
329 | r = self._repo | |
329 | if not cwd: |
|
330 | if not cwd: | |
330 | cwd = r.getcwd() |
|
331 | cwd = r.getcwd() | |
331 | return matchmod.match( |
|
332 | return matchmod.match( | |
332 | r.root, |
|
333 | r.root, | |
333 | cwd, |
|
334 | cwd, | |
334 | pats, |
|
335 | pats, | |
335 | include, |
|
336 | include, | |
336 | exclude, |
|
337 | exclude, | |
337 | default, |
|
338 | default, | |
338 | auditor=r.nofsauditor, |
|
339 | auditor=r.nofsauditor, | |
339 | ctx=self, |
|
340 | ctx=self, | |
340 | listsubrepos=listsubrepos, |
|
341 | listsubrepos=listsubrepos, | |
341 | badfn=badfn, |
|
342 | badfn=badfn, | |
342 | ) |
|
343 | ) | |
343 |
|
344 | |||
344 | def diff( |
|
345 | def diff( | |
345 | self, |
|
346 | self, | |
346 | ctx2=None, |
|
347 | ctx2=None, | |
347 | match=None, |
|
348 | match=None, | |
348 | changes=None, |
|
349 | changes=None, | |
349 | opts=None, |
|
350 | opts=None, | |
350 | losedatafn=None, |
|
351 | losedatafn=None, | |
351 | pathfn=None, |
|
352 | pathfn=None, | |
352 | copy=None, |
|
353 | copy=None, | |
353 | copysourcematch=None, |
|
354 | copysourcematch=None, | |
354 | hunksfilterfn=None, |
|
355 | hunksfilterfn=None, | |
355 | ): |
|
356 | ): | |
356 | """Returns a diff generator for the given contexts and matcher""" |
|
357 | """Returns a diff generator for the given contexts and matcher""" | |
357 | if ctx2 is None: |
|
358 | if ctx2 is None: | |
358 | ctx2 = self.p1() |
|
359 | ctx2 = self.p1() | |
359 | if ctx2 is not None: |
|
360 | if ctx2 is not None: | |
360 | ctx2 = self._repo[ctx2] |
|
361 | ctx2 = self._repo[ctx2] | |
361 | return patch.diff( |
|
362 | return patch.diff( | |
362 | self._repo, |
|
363 | self._repo, | |
363 | ctx2, |
|
364 | ctx2, | |
364 | self, |
|
365 | self, | |
365 | match=match, |
|
366 | match=match, | |
366 | changes=changes, |
|
367 | changes=changes, | |
367 | opts=opts, |
|
368 | opts=opts, | |
368 | losedatafn=losedatafn, |
|
369 | losedatafn=losedatafn, | |
369 | pathfn=pathfn, |
|
370 | pathfn=pathfn, | |
370 | copy=copy, |
|
371 | copy=copy, | |
371 | copysourcematch=copysourcematch, |
|
372 | copysourcematch=copysourcematch, | |
372 | hunksfilterfn=hunksfilterfn, |
|
373 | hunksfilterfn=hunksfilterfn, | |
373 | ) |
|
374 | ) | |
374 |
|
375 | |||
375 | def dirs(self): |
|
376 | def dirs(self): | |
376 | return self._manifest.dirs() |
|
377 | return self._manifest.dirs() | |
377 |
|
378 | |||
378 | def hasdir(self, dir): |
|
379 | def hasdir(self, dir): | |
379 | return self._manifest.hasdir(dir) |
|
380 | return self._manifest.hasdir(dir) | |
380 |
|
381 | |||
381 | def status( |
|
382 | def status( | |
382 | self, |
|
383 | self, | |
383 | other=None, |
|
384 | other=None, | |
384 | match=None, |
|
385 | match=None, | |
385 | listignored=False, |
|
386 | listignored=False, | |
386 | listclean=False, |
|
387 | listclean=False, | |
387 | listunknown=False, |
|
388 | listunknown=False, | |
388 | listsubrepos=False, |
|
389 | listsubrepos=False, | |
389 | ): |
|
390 | ): | |
390 | """return status of files between two nodes or node and working |
|
391 | """return status of files between two nodes or node and working | |
391 | directory. |
|
392 | directory. | |
392 |
|
393 | |||
393 | If other is None, compare this node with working directory. |
|
394 | If other is None, compare this node with working directory. | |
394 |
|
395 | |||
395 | ctx1.status(ctx2) returns the status of change from ctx1 to ctx2 |
|
396 | ctx1.status(ctx2) returns the status of change from ctx1 to ctx2 | |
396 |
|
397 | |||
397 | Returns a mercurial.scmutils.status object. |
|
398 | Returns a mercurial.scmutils.status object. | |
398 |
|
399 | |||
399 | Data can be accessed using either tuple notation: |
|
400 | Data can be accessed using either tuple notation: | |
400 |
|
401 | |||
401 | (modified, added, removed, deleted, unknown, ignored, clean) |
|
402 | (modified, added, removed, deleted, unknown, ignored, clean) | |
402 |
|
403 | |||
403 | or direct attribute access: |
|
404 | or direct attribute access: | |
404 |
|
405 | |||
405 | s.modified, s.added, ... |
|
406 | s.modified, s.added, ... | |
406 | """ |
|
407 | """ | |
407 |
|
408 | |||
408 | ctx1 = self |
|
409 | ctx1 = self | |
409 | ctx2 = self._repo[other] |
|
410 | ctx2 = self._repo[other] | |
410 |
|
411 | |||
411 | # This next code block is, admittedly, fragile logic that tests for |
|
412 | # This next code block is, admittedly, fragile logic that tests for | |
412 | # reversing the contexts and wouldn't need to exist if it weren't for |
|
413 | # reversing the contexts and wouldn't need to exist if it weren't for | |
413 | # the fast (and common) code path of comparing the working directory |
|
414 | # the fast (and common) code path of comparing the working directory | |
414 | # with its first parent. |
|
415 | # with its first parent. | |
415 | # |
|
416 | # | |
416 | # What we're aiming for here is the ability to call: |
|
417 | # What we're aiming for here is the ability to call: | |
417 | # |
|
418 | # | |
418 | # workingctx.status(parentctx) |
|
419 | # workingctx.status(parentctx) | |
419 | # |
|
420 | # | |
420 | # If we always built the manifest for each context and compared those, |
|
421 | # If we always built the manifest for each context and compared those, | |
421 | # then we'd be done. But the special case of the above call means we |
|
422 | # then we'd be done. But the special case of the above call means we | |
422 | # just copy the manifest of the parent. |
|
423 | # just copy the manifest of the parent. | |
423 | reversed = False |
|
424 | reversed = False | |
424 | if not isinstance(ctx1, changectx) and isinstance(ctx2, changectx): |
|
425 | if not isinstance(ctx1, changectx) and isinstance(ctx2, changectx): | |
425 | reversed = True |
|
426 | reversed = True | |
426 | ctx1, ctx2 = ctx2, ctx1 |
|
427 | ctx1, ctx2 = ctx2, ctx1 | |
427 |
|
428 | |||
428 | match = self._repo.narrowmatch(match) |
|
429 | match = self._repo.narrowmatch(match) | |
429 | match = ctx2._matchstatus(ctx1, match) |
|
430 | match = ctx2._matchstatus(ctx1, match) | |
430 | r = scmutil.status([], [], [], [], [], [], []) |
|
431 | r = scmutil.status([], [], [], [], [], [], []) | |
431 | r = ctx2._buildstatus( |
|
432 | r = ctx2._buildstatus( | |
432 | ctx1, r, match, listignored, listclean, listunknown |
|
433 | ctx1, r, match, listignored, listclean, listunknown | |
433 | ) |
|
434 | ) | |
434 |
|
435 | |||
435 | if reversed: |
|
436 | if reversed: | |
436 | # Reverse added and removed. Clear deleted, unknown and ignored as |
|
437 | # Reverse added and removed. Clear deleted, unknown and ignored as | |
437 | # these make no sense to reverse. |
|
438 | # these make no sense to reverse. | |
438 | r = scmutil.status( |
|
439 | r = scmutil.status( | |
439 | r.modified, r.removed, r.added, [], [], [], r.clean |
|
440 | r.modified, r.removed, r.added, [], [], [], r.clean | |
440 | ) |
|
441 | ) | |
441 |
|
442 | |||
442 | if listsubrepos: |
|
443 | if listsubrepos: | |
443 | for subpath, sub in scmutil.itersubrepos(ctx1, ctx2): |
|
444 | for subpath, sub in scmutil.itersubrepos(ctx1, ctx2): | |
444 | try: |
|
445 | try: | |
445 | rev2 = ctx2.subrev(subpath) |
|
446 | rev2 = ctx2.subrev(subpath) | |
446 | except KeyError: |
|
447 | except KeyError: | |
447 | # A subrepo that existed in node1 was deleted between |
|
448 | # A subrepo that existed in node1 was deleted between | |
448 | # node1 and node2 (inclusive). Thus, ctx2's substate |
|
449 | # node1 and node2 (inclusive). Thus, ctx2's substate | |
449 | # won't contain that subpath. The best we can do ignore it. |
|
450 | # won't contain that subpath. The best we can do ignore it. | |
450 | rev2 = None |
|
451 | rev2 = None | |
451 | submatch = matchmod.subdirmatcher(subpath, match) |
|
452 | submatch = matchmod.subdirmatcher(subpath, match) | |
452 | s = sub.status( |
|
453 | s = sub.status( | |
453 | rev2, |
|
454 | rev2, | |
454 | match=submatch, |
|
455 | match=submatch, | |
455 | ignored=listignored, |
|
456 | ignored=listignored, | |
456 | clean=listclean, |
|
457 | clean=listclean, | |
457 | unknown=listunknown, |
|
458 | unknown=listunknown, | |
458 | listsubrepos=True, |
|
459 | listsubrepos=True, | |
459 | ) |
|
460 | ) | |
460 | for k in ( |
|
461 | for k in ( | |
461 | 'modified', |
|
462 | 'modified', | |
462 | 'added', |
|
463 | 'added', | |
463 | 'removed', |
|
464 | 'removed', | |
464 | 'deleted', |
|
465 | 'deleted', | |
465 | 'unknown', |
|
466 | 'unknown', | |
466 | 'ignored', |
|
467 | 'ignored', | |
467 | 'clean', |
|
468 | 'clean', | |
468 | ): |
|
469 | ): | |
469 | rfiles, sfiles = getattr(r, k), getattr(s, k) |
|
470 | rfiles, sfiles = getattr(r, k), getattr(s, k) | |
470 | rfiles.extend(b"%s/%s" % (subpath, f) for f in sfiles) |
|
471 | rfiles.extend(b"%s/%s" % (subpath, f) for f in sfiles) | |
471 |
|
472 | |||
472 | r.modified.sort() |
|
473 | r.modified.sort() | |
473 | r.added.sort() |
|
474 | r.added.sort() | |
474 | r.removed.sort() |
|
475 | r.removed.sort() | |
475 | r.deleted.sort() |
|
476 | r.deleted.sort() | |
476 | r.unknown.sort() |
|
477 | r.unknown.sort() | |
477 | r.ignored.sort() |
|
478 | r.ignored.sort() | |
478 | r.clean.sort() |
|
479 | r.clean.sort() | |
479 |
|
480 | |||
480 | return r |
|
481 | return r | |
481 |
|
482 | |||
482 | def mergestate(self, clean=False): |
|
483 | def mergestate(self, clean=False): | |
483 | """Get a mergestate object for this context.""" |
|
484 | """Get a mergestate object for this context.""" | |
484 | raise NotImplementedError( |
|
485 | raise NotImplementedError( | |
485 | '%s does not implement mergestate()' % self.__class__ |
|
486 | '%s does not implement mergestate()' % self.__class__ | |
486 | ) |
|
487 | ) | |
487 |
|
488 | |||
488 | def isempty(self): |
|
489 | def isempty(self): | |
489 | return not ( |
|
490 | return not ( | |
490 | len(self.parents()) > 1 |
|
491 | len(self.parents()) > 1 | |
491 | or self.branch() != self.p1().branch() |
|
492 | or self.branch() != self.p1().branch() | |
492 | or self.closesbranch() |
|
493 | or self.closesbranch() | |
493 | or self.files() |
|
494 | or self.files() | |
494 | ) |
|
495 | ) | |
495 |
|
496 | |||
496 |
|
497 | |||
497 | class changectx(basectx): |
|
498 | class changectx(basectx): | |
498 | """A changecontext object makes access to data related to a particular |
|
499 | """A changecontext object makes access to data related to a particular | |
499 | changeset convenient. It represents a read-only context already present in |
|
500 | changeset convenient. It represents a read-only context already present in | |
500 | the repo.""" |
|
501 | the repo.""" | |
501 |
|
502 | |||
502 | def __init__(self, repo, rev, node, maybe_filtered=True): |
|
503 | def __init__(self, repo, rev, node, maybe_filtered=True): | |
503 | super(changectx, self).__init__(repo) |
|
504 | super(changectx, self).__init__(repo) | |
504 | self._rev = rev |
|
505 | self._rev = rev | |
505 | self._node = node |
|
506 | self._node = node | |
506 | # When maybe_filtered is True, the revision might be affected by |
|
507 | # When maybe_filtered is True, the revision might be affected by | |
507 | # changelog filtering and operation through the filtered changelog must be used. |
|
508 | # changelog filtering and operation through the filtered changelog must be used. | |
508 | # |
|
509 | # | |
509 | # When maybe_filtered is False, the revision has already been checked |
|
510 | # When maybe_filtered is False, the revision has already been checked | |
510 | # against filtering and is not filtered. Operation through the |
|
511 | # against filtering and is not filtered. Operation through the | |
511 | # unfiltered changelog might be used in some case. |
|
512 | # unfiltered changelog might be used in some case. | |
512 | self._maybe_filtered = maybe_filtered |
|
513 | self._maybe_filtered = maybe_filtered | |
513 |
|
514 | |||
514 | def __hash__(self): |
|
515 | def __hash__(self): | |
515 | try: |
|
516 | try: | |
516 | return hash(self._rev) |
|
517 | return hash(self._rev) | |
517 | except AttributeError: |
|
518 | except AttributeError: | |
518 | return id(self) |
|
519 | return id(self) | |
519 |
|
520 | |||
520 | def __nonzero__(self): |
|
521 | def __nonzero__(self): | |
521 | return self._rev != nullrev |
|
522 | return self._rev != nullrev | |
522 |
|
523 | |||
523 | __bool__ = __nonzero__ |
|
524 | __bool__ = __nonzero__ | |
524 |
|
525 | |||
525 | @propertycache |
|
526 | @propertycache | |
526 | def _changeset(self): |
|
527 | def _changeset(self): | |
527 | if self._maybe_filtered: |
|
528 | if self._maybe_filtered: | |
528 | repo = self._repo |
|
529 | repo = self._repo | |
529 | else: |
|
530 | else: | |
530 | repo = self._repo.unfiltered() |
|
531 | repo = self._repo.unfiltered() | |
531 | return repo.changelog.changelogrevision(self.rev()) |
|
532 | return repo.changelog.changelogrevision(self.rev()) | |
532 |
|
533 | |||
533 | @propertycache |
|
534 | @propertycache | |
534 | def _manifest(self): |
|
535 | def _manifest(self): | |
535 | return self._manifestctx.read() |
|
536 | return self._manifestctx.read() | |
536 |
|
537 | |||
537 | @property |
|
538 | @property | |
538 | def _manifestctx(self): |
|
539 | def _manifestctx(self): | |
539 | return self._repo.manifestlog[self._changeset.manifest] |
|
540 | return self._repo.manifestlog[self._changeset.manifest] | |
540 |
|
541 | |||
541 | @propertycache |
|
542 | @propertycache | |
542 | def _manifestdelta(self): |
|
543 | def _manifestdelta(self): | |
543 | return self._manifestctx.readdelta() |
|
544 | return self._manifestctx.readdelta() | |
544 |
|
545 | |||
545 | @propertycache |
|
546 | @propertycache | |
546 | def _parents(self): |
|
547 | def _parents(self): | |
547 | repo = self._repo |
|
548 | repo = self._repo | |
548 | if self._maybe_filtered: |
|
549 | if self._maybe_filtered: | |
549 | cl = repo.changelog |
|
550 | cl = repo.changelog | |
550 | else: |
|
551 | else: | |
551 | cl = repo.unfiltered().changelog |
|
552 | cl = repo.unfiltered().changelog | |
552 |
|
553 | |||
553 | p1, p2 = cl.parentrevs(self._rev) |
|
554 | p1, p2 = cl.parentrevs(self._rev) | |
554 | if p2 == nullrev: |
|
555 | if p2 == nullrev: | |
555 | return [changectx(repo, p1, cl.node(p1), maybe_filtered=False)] |
|
556 | return [changectx(repo, p1, cl.node(p1), maybe_filtered=False)] | |
556 | return [ |
|
557 | return [ | |
557 | changectx(repo, p1, cl.node(p1), maybe_filtered=False), |
|
558 | changectx(repo, p1, cl.node(p1), maybe_filtered=False), | |
558 | changectx(repo, p2, cl.node(p2), maybe_filtered=False), |
|
559 | changectx(repo, p2, cl.node(p2), maybe_filtered=False), | |
559 | ] |
|
560 | ] | |
560 |
|
561 | |||
561 | def changeset(self): |
|
562 | def changeset(self): | |
562 | c = self._changeset |
|
563 | c = self._changeset | |
563 | return ( |
|
564 | return ( | |
564 | c.manifest, |
|
565 | c.manifest, | |
565 | c.user, |
|
566 | c.user, | |
566 | c.date, |
|
567 | c.date, | |
567 | c.files, |
|
568 | c.files, | |
568 | c.description, |
|
569 | c.description, | |
569 | c.extra, |
|
570 | c.extra, | |
570 | ) |
|
571 | ) | |
571 |
|
572 | |||
572 | def manifestnode(self): |
|
573 | def manifestnode(self): | |
573 | return self._changeset.manifest |
|
574 | return self._changeset.manifest | |
574 |
|
575 | |||
575 | def user(self): |
|
576 | def user(self): | |
576 | return self._changeset.user |
|
577 | return self._changeset.user | |
577 |
|
578 | |||
578 | def date(self): |
|
579 | def date(self): | |
579 | return self._changeset.date |
|
580 | return self._changeset.date | |
580 |
|
581 | |||
581 | def files(self): |
|
582 | def files(self): | |
582 | return self._changeset.files |
|
583 | return self._changeset.files | |
583 |
|
584 | |||
584 | def filesmodified(self): |
|
585 | def filesmodified(self): | |
585 | modified = set(self.files()) |
|
586 | modified = set(self.files()) | |
586 | modified.difference_update(self.filesadded()) |
|
587 | modified.difference_update(self.filesadded()) | |
587 | modified.difference_update(self.filesremoved()) |
|
588 | modified.difference_update(self.filesremoved()) | |
588 | return sorted(modified) |
|
589 | return sorted(modified) | |
589 |
|
590 | |||
590 | def filesadded(self): |
|
591 | def filesadded(self): | |
591 | filesadded = self._changeset.filesadded |
|
592 | filesadded = self._changeset.filesadded | |
592 | compute_on_none = True |
|
593 | compute_on_none = True | |
593 | if self._repo.filecopiesmode == b'changeset-sidedata': |
|
594 | if self._repo.filecopiesmode == b'changeset-sidedata': | |
594 | compute_on_none = False |
|
595 | compute_on_none = False | |
595 | else: |
|
596 | else: | |
596 | source = self._repo.ui.config(b'experimental', b'copies.read-from') |
|
597 | source = self._repo.ui.config(b'experimental', b'copies.read-from') | |
597 | if source == b'changeset-only': |
|
598 | if source == b'changeset-only': | |
598 | compute_on_none = False |
|
599 | compute_on_none = False | |
599 | elif source != b'compatibility': |
|
600 | elif source != b'compatibility': | |
600 | # filelog mode, ignore any changelog content |
|
601 | # filelog mode, ignore any changelog content | |
601 | filesadded = None |
|
602 | filesadded = None | |
602 | if filesadded is None: |
|
603 | if filesadded is None: | |
603 | if compute_on_none: |
|
604 | if compute_on_none: | |
604 | filesadded = metadata.computechangesetfilesadded(self) |
|
605 | filesadded = metadata.computechangesetfilesadded(self) | |
605 | else: |
|
606 | else: | |
606 | filesadded = [] |
|
607 | filesadded = [] | |
607 | return filesadded |
|
608 | return filesadded | |
608 |
|
609 | |||
609 | def filesremoved(self): |
|
610 | def filesremoved(self): | |
610 | filesremoved = self._changeset.filesremoved |
|
611 | filesremoved = self._changeset.filesremoved | |
611 | compute_on_none = True |
|
612 | compute_on_none = True | |
612 | if self._repo.filecopiesmode == b'changeset-sidedata': |
|
613 | if self._repo.filecopiesmode == b'changeset-sidedata': | |
613 | compute_on_none = False |
|
614 | compute_on_none = False | |
614 | else: |
|
615 | else: | |
615 | source = self._repo.ui.config(b'experimental', b'copies.read-from') |
|
616 | source = self._repo.ui.config(b'experimental', b'copies.read-from') | |
616 | if source == b'changeset-only': |
|
617 | if source == b'changeset-only': | |
617 | compute_on_none = False |
|
618 | compute_on_none = False | |
618 | elif source != b'compatibility': |
|
619 | elif source != b'compatibility': | |
619 | # filelog mode, ignore any changelog content |
|
620 | # filelog mode, ignore any changelog content | |
620 | filesremoved = None |
|
621 | filesremoved = None | |
621 | if filesremoved is None: |
|
622 | if filesremoved is None: | |
622 | if compute_on_none: |
|
623 | if compute_on_none: | |
623 | filesremoved = metadata.computechangesetfilesremoved(self) |
|
624 | filesremoved = metadata.computechangesetfilesremoved(self) | |
624 | else: |
|
625 | else: | |
625 | filesremoved = [] |
|
626 | filesremoved = [] | |
626 | return filesremoved |
|
627 | return filesremoved | |
627 |
|
628 | |||
628 | @propertycache |
|
629 | @propertycache | |
629 | def _copies(self): |
|
630 | def _copies(self): | |
630 | p1copies = self._changeset.p1copies |
|
631 | p1copies = self._changeset.p1copies | |
631 | p2copies = self._changeset.p2copies |
|
632 | p2copies = self._changeset.p2copies | |
632 | compute_on_none = True |
|
633 | compute_on_none = True | |
633 | if self._repo.filecopiesmode == b'changeset-sidedata': |
|
634 | if self._repo.filecopiesmode == b'changeset-sidedata': | |
634 | compute_on_none = False |
|
635 | compute_on_none = False | |
635 | else: |
|
636 | else: | |
636 | source = self._repo.ui.config(b'experimental', b'copies.read-from') |
|
637 | source = self._repo.ui.config(b'experimental', b'copies.read-from') | |
637 | # If config says to get copy metadata only from changeset, then |
|
638 | # If config says to get copy metadata only from changeset, then | |
638 | # return that, defaulting to {} if there was no copy metadata. In |
|
639 | # return that, defaulting to {} if there was no copy metadata. In | |
639 | # compatibility mode, we return copy data from the changeset if it |
|
640 | # compatibility mode, we return copy data from the changeset if it | |
640 | # was recorded there, and otherwise we fall back to getting it from |
|
641 | # was recorded there, and otherwise we fall back to getting it from | |
641 | # the filelogs (below). |
|
642 | # the filelogs (below). | |
642 | # |
|
643 | # | |
643 | # If we are in compatiblity mode and there is not data in the |
|
644 | # If we are in compatiblity mode and there is not data in the | |
644 | # changeset), we get the copy metadata from the filelogs. |
|
645 | # changeset), we get the copy metadata from the filelogs. | |
645 | # |
|
646 | # | |
646 | # otherwise, when config said to read only from filelog, we get the |
|
647 | # otherwise, when config said to read only from filelog, we get the | |
647 | # copy metadata from the filelogs. |
|
648 | # copy metadata from the filelogs. | |
648 | if source == b'changeset-only': |
|
649 | if source == b'changeset-only': | |
649 | compute_on_none = False |
|
650 | compute_on_none = False | |
650 | elif source != b'compatibility': |
|
651 | elif source != b'compatibility': | |
651 | # filelog mode, ignore any changelog content |
|
652 | # filelog mode, ignore any changelog content | |
652 | p1copies = p2copies = None |
|
653 | p1copies = p2copies = None | |
653 | if p1copies is None: |
|
654 | if p1copies is None: | |
654 | if compute_on_none: |
|
655 | if compute_on_none: | |
655 | p1copies, p2copies = super(changectx, self)._copies |
|
656 | p1copies, p2copies = super(changectx, self)._copies | |
656 | else: |
|
657 | else: | |
657 | if p1copies is None: |
|
658 | if p1copies is None: | |
658 | p1copies = {} |
|
659 | p1copies = {} | |
659 | if p2copies is None: |
|
660 | if p2copies is None: | |
660 | p2copies = {} |
|
661 | p2copies = {} | |
661 | return p1copies, p2copies |
|
662 | return p1copies, p2copies | |
662 |
|
663 | |||
663 | def description(self): |
|
664 | def description(self): | |
664 | return self._changeset.description |
|
665 | return self._changeset.description | |
665 |
|
666 | |||
666 | def branch(self): |
|
667 | def branch(self): | |
667 | return encoding.tolocal(self._changeset.extra.get(b"branch")) |
|
668 | return encoding.tolocal(self._changeset.extra.get(b"branch")) | |
668 |
|
669 | |||
669 | def closesbranch(self): |
|
670 | def closesbranch(self): | |
670 | return b'close' in self._changeset.extra |
|
671 | return b'close' in self._changeset.extra | |
671 |
|
672 | |||
672 | def extra(self): |
|
673 | def extra(self): | |
673 | """Return a dict of extra information.""" |
|
674 | """Return a dict of extra information.""" | |
674 | return self._changeset.extra |
|
675 | return self._changeset.extra | |
675 |
|
676 | |||
676 | def tags(self): |
|
677 | def tags(self): | |
677 | """Return a list of byte tag names""" |
|
678 | """Return a list of byte tag names""" | |
678 | return self._repo.nodetags(self._node) |
|
679 | return self._repo.nodetags(self._node) | |
679 |
|
680 | |||
680 | def bookmarks(self): |
|
681 | def bookmarks(self): | |
681 | """Return a list of byte bookmark names.""" |
|
682 | """Return a list of byte bookmark names.""" | |
682 | return self._repo.nodebookmarks(self._node) |
|
683 | return self._repo.nodebookmarks(self._node) | |
683 |
|
684 | |||
684 | def fast_rank(self): |
|
685 | def fast_rank(self): | |
685 | repo = self._repo |
|
686 | repo = self._repo | |
686 | if self._maybe_filtered: |
|
687 | if self._maybe_filtered: | |
687 | cl = repo.changelog |
|
688 | cl = repo.changelog | |
688 | else: |
|
689 | else: | |
689 | cl = repo.unfiltered().changelog |
|
690 | cl = repo.unfiltered().changelog | |
690 | return cl.fast_rank(self._rev) |
|
691 | return cl.fast_rank(self._rev) | |
691 |
|
692 | |||
692 | def phase(self): |
|
693 | def phase(self): | |
693 | return self._repo._phasecache.phase(self._repo, self._rev) |
|
694 | return self._repo._phasecache.phase(self._repo, self._rev) | |
694 |
|
695 | |||
695 | def hidden(self): |
|
696 | def hidden(self): | |
696 | return self._rev in repoview.filterrevs(self._repo, b'visible') |
|
697 | return self._rev in repoview.filterrevs(self._repo, b'visible') | |
697 |
|
698 | |||
698 | def isinmemory(self): |
|
699 | def isinmemory(self): | |
699 | return False |
|
700 | return False | |
700 |
|
701 | |||
701 | def children(self): |
|
702 | def children(self): | |
702 | """return list of changectx contexts for each child changeset. |
|
703 | """return list of changectx contexts for each child changeset. | |
703 |
|
704 | |||
704 | This returns only the immediate child changesets. Use descendants() to |
|
705 | This returns only the immediate child changesets. Use descendants() to | |
705 | recursively walk children. |
|
706 | recursively walk children. | |
706 | """ |
|
707 | """ | |
707 | c = self._repo.changelog.children(self._node) |
|
708 | c = self._repo.changelog.children(self._node) | |
708 | return [self._repo[x] for x in c] |
|
709 | return [self._repo[x] for x in c] | |
709 |
|
710 | |||
710 | def ancestors(self): |
|
711 | def ancestors(self): | |
711 | for a in self._repo.changelog.ancestors([self._rev]): |
|
712 | for a in self._repo.changelog.ancestors([self._rev]): | |
712 | yield self._repo[a] |
|
713 | yield self._repo[a] | |
713 |
|
714 | |||
714 | def descendants(self): |
|
715 | def descendants(self): | |
715 | """Recursively yield all children of the changeset. |
|
716 | """Recursively yield all children of the changeset. | |
716 |
|
717 | |||
717 | For just the immediate children, use children() |
|
718 | For just the immediate children, use children() | |
718 | """ |
|
719 | """ | |
719 | for d in self._repo.changelog.descendants([self._rev]): |
|
720 | for d in self._repo.changelog.descendants([self._rev]): | |
720 | yield self._repo[d] |
|
721 | yield self._repo[d] | |
721 |
|
722 | |||
722 | def filectx(self, path, fileid=None, filelog=None): |
|
723 | def filectx(self, path, fileid=None, filelog=None): | |
723 | """get a file context from this changeset""" |
|
724 | """get a file context from this changeset""" | |
724 | if fileid is None: |
|
725 | if fileid is None: | |
725 | fileid = self.filenode(path) |
|
726 | fileid = self.filenode(path) | |
726 | return filectx( |
|
727 | return filectx( | |
727 | self._repo, path, fileid=fileid, changectx=self, filelog=filelog |
|
728 | self._repo, path, fileid=fileid, changectx=self, filelog=filelog | |
728 | ) |
|
729 | ) | |
729 |
|
730 | |||
730 | def ancestor(self, c2, warn=False): |
|
731 | def ancestor(self, c2, warn=False): | |
731 | """return the "best" ancestor context of self and c2 |
|
732 | """return the "best" ancestor context of self and c2 | |
732 |
|
733 | |||
733 | If there are multiple candidates, it will show a message and check |
|
734 | If there are multiple candidates, it will show a message and check | |
734 | merge.preferancestor configuration before falling back to the |
|
735 | merge.preferancestor configuration before falling back to the | |
735 | revlog ancestor.""" |
|
736 | revlog ancestor.""" | |
736 | # deal with workingctxs |
|
737 | # deal with workingctxs | |
737 | n2 = c2._node |
|
738 | n2 = c2._node | |
738 | if n2 is None: |
|
739 | if n2 is None: | |
739 | n2 = c2._parents[0]._node |
|
740 | n2 = c2._parents[0]._node | |
740 | cahs = self._repo.changelog.commonancestorsheads(self._node, n2) |
|
741 | cahs = self._repo.changelog.commonancestorsheads(self._node, n2) | |
741 | if not cahs: |
|
742 | if not cahs: | |
742 | anc = self._repo.nodeconstants.nullid |
|
743 | anc = self._repo.nodeconstants.nullid | |
743 | elif len(cahs) == 1: |
|
744 | elif len(cahs) == 1: | |
744 | anc = cahs[0] |
|
745 | anc = cahs[0] | |
745 | else: |
|
746 | else: | |
746 | # experimental config: merge.preferancestor |
|
747 | # experimental config: merge.preferancestor | |
747 | for r in self._repo.ui.configlist(b'merge', b'preferancestor'): |
|
748 | for r in self._repo.ui.configlist(b'merge', b'preferancestor'): | |
748 | try: |
|
749 | try: | |
749 | ctx = scmutil.revsymbol(self._repo, r) |
|
750 | ctx = scmutil.revsymbol(self._repo, r) | |
750 | except error.RepoLookupError: |
|
751 | except error.RepoLookupError: | |
751 | continue |
|
752 | continue | |
752 | anc = ctx.node() |
|
753 | anc = ctx.node() | |
753 | if anc in cahs: |
|
754 | if anc in cahs: | |
754 | break |
|
755 | break | |
755 | else: |
|
756 | else: | |
756 | anc = self._repo.changelog.ancestor(self._node, n2) |
|
757 | anc = self._repo.changelog.ancestor(self._node, n2) | |
757 | if warn: |
|
758 | if warn: | |
758 | self._repo.ui.status( |
|
759 | self._repo.ui.status( | |
759 | ( |
|
760 | ( | |
760 | _(b"note: using %s as ancestor of %s and %s\n") |
|
761 | _(b"note: using %s as ancestor of %s and %s\n") | |
761 | % (short(anc), short(self._node), short(n2)) |
|
762 | % (short(anc), short(self._node), short(n2)) | |
762 | ) |
|
763 | ) | |
763 | + b''.join( |
|
764 | + b''.join( | |
764 | _( |
|
765 | _( | |
765 | b" alternatively, use --config " |
|
766 | b" alternatively, use --config " | |
766 | b"merge.preferancestor=%s\n" |
|
767 | b"merge.preferancestor=%s\n" | |
767 | ) |
|
768 | ) | |
768 | % short(n) |
|
769 | % short(n) | |
769 | for n in sorted(cahs) |
|
770 | for n in sorted(cahs) | |
770 | if n != anc |
|
771 | if n != anc | |
771 | ) |
|
772 | ) | |
772 | ) |
|
773 | ) | |
773 | return self._repo[anc] |
|
774 | return self._repo[anc] | |
774 |
|
775 | |||
775 | def isancestorof(self, other): |
|
776 | def isancestorof(self, other): | |
776 | """True if this changeset is an ancestor of other""" |
|
777 | """True if this changeset is an ancestor of other""" | |
777 | return self._repo.changelog.isancestorrev(self._rev, other._rev) |
|
778 | return self._repo.changelog.isancestorrev(self._rev, other._rev) | |
778 |
|
779 | |||
779 | def walk(self, match): |
|
780 | def walk(self, match): | |
780 | '''Generates matching file names.''' |
|
781 | '''Generates matching file names.''' | |
781 |
|
782 | |||
782 | # Wrap match.bad method to have message with nodeid |
|
783 | # Wrap match.bad method to have message with nodeid | |
783 | def bad(fn, msg): |
|
784 | def bad(fn, msg): | |
784 | # The manifest doesn't know about subrepos, so don't complain about |
|
785 | # The manifest doesn't know about subrepos, so don't complain about | |
785 | # paths into valid subrepos. |
|
786 | # paths into valid subrepos. | |
786 | if any(fn == s or fn.startswith(s + b'/') for s in self.substate): |
|
787 | if any(fn == s or fn.startswith(s + b'/') for s in self.substate): | |
787 | return |
|
788 | return | |
788 | match.bad(fn, _(b'no such file in rev %s') % self) |
|
789 | match.bad(fn, _(b'no such file in rev %s') % self) | |
789 |
|
790 | |||
790 | m = matchmod.badmatch(self._repo.narrowmatch(match), bad) |
|
791 | m = matchmod.badmatch(self._repo.narrowmatch(match), bad) | |
791 | return self._manifest.walk(m) |
|
792 | return self._manifest.walk(m) | |
792 |
|
793 | |||
793 | def matches(self, match): |
|
794 | def matches(self, match): | |
794 | return self.walk(match) |
|
795 | return self.walk(match) | |
795 |
|
796 | |||
796 |
|
797 | |||
797 | class basefilectx: |
|
798 | class basefilectx: | |
798 | """A filecontext object represents the common logic for its children: |
|
799 | """A filecontext object represents the common logic for its children: | |
799 | filectx: read-only access to a filerevision that is already present |
|
800 | filectx: read-only access to a filerevision that is already present | |
800 | in the repo, |
|
801 | in the repo, | |
801 | workingfilectx: a filecontext that represents files from the working |
|
802 | workingfilectx: a filecontext that represents files from the working | |
802 | directory, |
|
803 | directory, | |
803 | memfilectx: a filecontext that represents files in-memory, |
|
804 | memfilectx: a filecontext that represents files in-memory, | |
804 | """ |
|
805 | """ | |
805 |
|
806 | |||
806 | @propertycache |
|
807 | @propertycache | |
807 | def _filelog(self): |
|
808 | def _filelog(self): | |
808 | return self._repo.file(self._path) |
|
809 | return self._repo.file(self._path) | |
809 |
|
810 | |||
810 | @propertycache |
|
811 | @propertycache | |
811 | def _changeid(self): |
|
812 | def _changeid(self): | |
812 | if '_changectx' in self.__dict__: |
|
813 | if '_changectx' in self.__dict__: | |
813 | return self._changectx.rev() |
|
814 | return self._changectx.rev() | |
814 | elif '_descendantrev' in self.__dict__: |
|
815 | elif '_descendantrev' in self.__dict__: | |
815 | # this file context was created from a revision with a known |
|
816 | # this file context was created from a revision with a known | |
816 | # descendant, we can (lazily) correct for linkrev aliases |
|
817 | # descendant, we can (lazily) correct for linkrev aliases | |
817 | return self._adjustlinkrev(self._descendantrev) |
|
818 | return self._adjustlinkrev(self._descendantrev) | |
818 | else: |
|
819 | else: | |
819 | return self._filelog.linkrev(self._filerev) |
|
820 | return self._filelog.linkrev(self._filerev) | |
820 |
|
821 | |||
821 | @propertycache |
|
822 | @propertycache | |
822 | def _filenode(self): |
|
823 | def _filenode(self): | |
823 | if '_fileid' in self.__dict__: |
|
824 | if '_fileid' in self.__dict__: | |
824 | return self._filelog.lookup(self._fileid) |
|
825 | return self._filelog.lookup(self._fileid) | |
825 | else: |
|
826 | else: | |
826 | return self._changectx.filenode(self._path) |
|
827 | return self._changectx.filenode(self._path) | |
827 |
|
828 | |||
828 | @propertycache |
|
829 | @propertycache | |
829 | def _filerev(self): |
|
830 | def _filerev(self): | |
830 | return self._filelog.rev(self._filenode) |
|
831 | return self._filelog.rev(self._filenode) | |
831 |
|
832 | |||
832 | @propertycache |
|
833 | @propertycache | |
833 | def _repopath(self): |
|
834 | def _repopath(self): | |
834 | return self._path |
|
835 | return self._path | |
835 |
|
836 | |||
836 | def __nonzero__(self): |
|
837 | def __nonzero__(self): | |
837 | try: |
|
838 | try: | |
838 | self._filenode |
|
839 | self._filenode | |
839 | return True |
|
840 | return True | |
840 | except error.LookupError: |
|
841 | except error.LookupError: | |
841 | # file is missing |
|
842 | # file is missing | |
842 | return False |
|
843 | return False | |
843 |
|
844 | |||
844 | __bool__ = __nonzero__ |
|
845 | __bool__ = __nonzero__ | |
845 |
|
846 | |||
846 | def __bytes__(self): |
|
847 | def __bytes__(self): | |
847 | try: |
|
848 | try: | |
848 | return b"%s@%s" % (self.path(), self._changectx) |
|
849 | return b"%s@%s" % (self.path(), self._changectx) | |
849 | except error.LookupError: |
|
850 | except error.LookupError: | |
850 | return b"%s@???" % self.path() |
|
851 | return b"%s@???" % self.path() | |
851 |
|
852 | |||
852 | __str__ = encoding.strmethod(__bytes__) |
|
853 | __str__ = encoding.strmethod(__bytes__) | |
853 |
|
854 | |||
854 | def __repr__(self): |
|
855 | def __repr__(self): | |
855 | return "<%s %s>" % (type(self).__name__, str(self)) |
|
856 | return "<%s %s>" % (type(self).__name__, str(self)) | |
856 |
|
857 | |||
857 | def __hash__(self): |
|
858 | def __hash__(self): | |
858 | try: |
|
859 | try: | |
859 | return hash((self._path, self._filenode)) |
|
860 | return hash((self._path, self._filenode)) | |
860 | except AttributeError: |
|
861 | except AttributeError: | |
861 | return id(self) |
|
862 | return id(self) | |
862 |
|
863 | |||
863 | def __eq__(self, other): |
|
864 | def __eq__(self, other): | |
864 | try: |
|
865 | try: | |
865 | return ( |
|
866 | return ( | |
866 | type(self) == type(other) |
|
867 | type(self) == type(other) | |
867 | and self._path == other._path |
|
868 | and self._path == other._path | |
868 | and self._filenode == other._filenode |
|
869 | and self._filenode == other._filenode | |
869 | ) |
|
870 | ) | |
870 | except AttributeError: |
|
871 | except AttributeError: | |
871 | return False |
|
872 | return False | |
872 |
|
873 | |||
873 | def __ne__(self, other): |
|
874 | def __ne__(self, other): | |
874 | return not (self == other) |
|
875 | return not (self == other) | |
875 |
|
876 | |||
876 | def filerev(self): |
|
877 | def filerev(self): | |
877 | return self._filerev |
|
878 | return self._filerev | |
878 |
|
879 | |||
879 | def filenode(self): |
|
880 | def filenode(self): | |
880 | return self._filenode |
|
881 | return self._filenode | |
881 |
|
882 | |||
882 | @propertycache |
|
883 | @propertycache | |
883 | def _flags(self): |
|
884 | def _flags(self): | |
884 | return self._changectx.flags(self._path) |
|
885 | return self._changectx.flags(self._path) | |
885 |
|
886 | |||
886 | def flags(self): |
|
887 | def flags(self): | |
887 | return self._flags |
|
888 | return self._flags | |
888 |
|
889 | |||
889 | def filelog(self): |
|
890 | def filelog(self): | |
890 | return self._filelog |
|
891 | return self._filelog | |
891 |
|
892 | |||
892 | def rev(self): |
|
893 | def rev(self): | |
893 | return self._changeid |
|
894 | return self._changeid | |
894 |
|
895 | |||
895 | def linkrev(self): |
|
896 | def linkrev(self): | |
896 | return self._filelog.linkrev(self._filerev) |
|
897 | return self._filelog.linkrev(self._filerev) | |
897 |
|
898 | |||
898 | def node(self): |
|
899 | def node(self): | |
899 | return self._changectx.node() |
|
900 | return self._changectx.node() | |
900 |
|
901 | |||
901 | def hex(self): |
|
902 | def hex(self): | |
902 | return self._changectx.hex() |
|
903 | return self._changectx.hex() | |
903 |
|
904 | |||
904 | def user(self): |
|
905 | def user(self): | |
905 | return self._changectx.user() |
|
906 | return self._changectx.user() | |
906 |
|
907 | |||
907 | def date(self): |
|
908 | def date(self): | |
908 | return self._changectx.date() |
|
909 | return self._changectx.date() | |
909 |
|
910 | |||
910 | def files(self): |
|
911 | def files(self): | |
911 | return self._changectx.files() |
|
912 | return self._changectx.files() | |
912 |
|
913 | |||
913 | def description(self): |
|
914 | def description(self): | |
914 | return self._changectx.description() |
|
915 | return self._changectx.description() | |
915 |
|
916 | |||
916 | def branch(self): |
|
917 | def branch(self): | |
917 | return self._changectx.branch() |
|
918 | return self._changectx.branch() | |
918 |
|
919 | |||
919 | def extra(self): |
|
920 | def extra(self): | |
920 | return self._changectx.extra() |
|
921 | return self._changectx.extra() | |
921 |
|
922 | |||
922 | def phase(self): |
|
923 | def phase(self): | |
923 | return self._changectx.phase() |
|
924 | return self._changectx.phase() | |
924 |
|
925 | |||
925 | def phasestr(self): |
|
926 | def phasestr(self): | |
926 | return self._changectx.phasestr() |
|
927 | return self._changectx.phasestr() | |
927 |
|
928 | |||
928 | def obsolete(self): |
|
929 | def obsolete(self): | |
929 | return self._changectx.obsolete() |
|
930 | return self._changectx.obsolete() | |
930 |
|
931 | |||
931 | def instabilities(self): |
|
932 | def instabilities(self): | |
932 | return self._changectx.instabilities() |
|
933 | return self._changectx.instabilities() | |
933 |
|
934 | |||
934 | def manifest(self): |
|
935 | def manifest(self): | |
935 | return self._changectx.manifest() |
|
936 | return self._changectx.manifest() | |
936 |
|
937 | |||
937 | def changectx(self): |
|
938 | def changectx(self): | |
938 | return self._changectx |
|
939 | return self._changectx | |
939 |
|
940 | |||
940 | def renamed(self): |
|
941 | def renamed(self): | |
941 | return self._copied |
|
942 | return self._copied | |
942 |
|
943 | |||
943 | def copysource(self): |
|
944 | def copysource(self): | |
944 | return self._copied and self._copied[0] |
|
945 | return self._copied and self._copied[0] | |
945 |
|
946 | |||
946 | def repo(self): |
|
947 | def repo(self): | |
947 | return self._repo |
|
948 | return self._repo | |
948 |
|
949 | |||
949 | def size(self): |
|
950 | def size(self): | |
950 | return len(self.data()) |
|
951 | return len(self.data()) | |
951 |
|
952 | |||
952 | def path(self): |
|
953 | def path(self): | |
953 | return self._path |
|
954 | return self._path | |
954 |
|
955 | |||
955 | def isbinary(self): |
|
956 | def isbinary(self): | |
956 | try: |
|
957 | try: | |
957 | return stringutil.binary(self.data()) |
|
958 | return stringutil.binary(self.data()) | |
958 | except IOError: |
|
959 | except IOError: | |
959 | return False |
|
960 | return False | |
960 |
|
961 | |||
961 | def isexec(self): |
|
962 | def isexec(self): | |
962 | return b'x' in self.flags() |
|
963 | return b'x' in self.flags() | |
963 |
|
964 | |||
964 | def islink(self): |
|
965 | def islink(self): | |
965 | return b'l' in self.flags() |
|
966 | return b'l' in self.flags() | |
966 |
|
967 | |||
967 | def isabsent(self): |
|
968 | def isabsent(self): | |
968 | """whether this filectx represents a file not in self._changectx |
|
969 | """whether this filectx represents a file not in self._changectx | |
969 |
|
970 | |||
970 | This is mainly for merge code to detect change/delete conflicts. This is |
|
971 | This is mainly for merge code to detect change/delete conflicts. This is | |
971 | expected to be True for all subclasses of basectx.""" |
|
972 | expected to be True for all subclasses of basectx.""" | |
972 | return False |
|
973 | return False | |
973 |
|
974 | |||
974 | _customcmp = False |
|
975 | _customcmp = False | |
975 |
|
976 | |||
976 | def cmp(self, fctx): |
|
977 | def cmp(self, fctx): | |
977 | """compare with other file context |
|
978 | """compare with other file context | |
978 |
|
979 | |||
979 | returns True if different than fctx. |
|
980 | returns True if different than fctx. | |
980 | """ |
|
981 | """ | |
981 | if fctx._customcmp: |
|
982 | if fctx._customcmp: | |
982 | return fctx.cmp(self) |
|
983 | return fctx.cmp(self) | |
983 |
|
984 | |||
984 | if self._filenode is None: |
|
985 | if self._filenode is None: | |
985 | raise error.ProgrammingError( |
|
986 | raise error.ProgrammingError( | |
986 | b'filectx.cmp() must be reimplemented if not backed by revlog' |
|
987 | b'filectx.cmp() must be reimplemented if not backed by revlog' | |
987 | ) |
|
988 | ) | |
988 |
|
989 | |||
989 | if fctx._filenode is None: |
|
990 | if fctx._filenode is None: | |
990 | if self._repo._encodefilterpats: |
|
991 | if self._repo._encodefilterpats: | |
991 | # can't rely on size() because wdir content may be decoded |
|
992 | # can't rely on size() because wdir content may be decoded | |
992 | return self._filelog.cmp(self._filenode, fctx.data()) |
|
993 | return self._filelog.cmp(self._filenode, fctx.data()) | |
993 | # filelog.size() has two special cases: |
|
994 | # filelog.size() has two special cases: | |
994 | # - censored metadata |
|
995 | # - censored metadata | |
995 | # - copy/rename tracking |
|
996 | # - copy/rename tracking | |
996 | # The first is detected by peaking into the delta, |
|
997 | # The first is detected by peaking into the delta, | |
997 | # the second is detected by abusing parent order |
|
998 | # the second is detected by abusing parent order | |
998 | # in the revlog index as flag bit. This leaves files using |
|
999 | # in the revlog index as flag bit. This leaves files using | |
999 | # the dummy encoding and non-standard meta attributes. |
|
1000 | # the dummy encoding and non-standard meta attributes. | |
1000 | # The following check is a special case for the empty |
|
1001 | # The following check is a special case for the empty | |
1001 | # metadata block used if the raw file content starts with '\1\n'. |
|
1002 | # metadata block used if the raw file content starts with '\1\n'. | |
1002 | # Cases of arbitrary metadata flags are currently mishandled. |
|
1003 | # Cases of arbitrary metadata flags are currently mishandled. | |
1003 | if self.size() - 4 == fctx.size(): |
|
1004 | if self.size() - 4 == fctx.size(): | |
1004 | # size() can match: |
|
1005 | # size() can match: | |
1005 | # if file data starts with '\1\n', empty metadata block is |
|
1006 | # if file data starts with '\1\n', empty metadata block is | |
1006 | # prepended, which adds 4 bytes to filelog.size(). |
|
1007 | # prepended, which adds 4 bytes to filelog.size(). | |
1007 | return self._filelog.cmp(self._filenode, fctx.data()) |
|
1008 | return self._filelog.cmp(self._filenode, fctx.data()) | |
1008 | if self.size() == fctx.size() or self.flags() == b'l': |
|
1009 | if self.size() == fctx.size() or self.flags() == b'l': | |
1009 | # size() matches: need to compare content |
|
1010 | # size() matches: need to compare content | |
1010 | # issue6456: Always compare symlinks because size can represent |
|
1011 | # issue6456: Always compare symlinks because size can represent | |
1011 | # encrypted string for EXT-4 encryption(fscrypt). |
|
1012 | # encrypted string for EXT-4 encryption(fscrypt). | |
1012 | return self._filelog.cmp(self._filenode, fctx.data()) |
|
1013 | return self._filelog.cmp(self._filenode, fctx.data()) | |
1013 |
|
1014 | |||
1014 | # size() differs |
|
1015 | # size() differs | |
1015 | return True |
|
1016 | return True | |
1016 |
|
1017 | |||
1017 | def _adjustlinkrev(self, srcrev, inclusive=False, stoprev=None): |
|
1018 | def _adjustlinkrev(self, srcrev, inclusive=False, stoprev=None): | |
1018 | """return the first ancestor of <srcrev> introducing <fnode> |
|
1019 | """return the first ancestor of <srcrev> introducing <fnode> | |
1019 |
|
1020 | |||
1020 | If the linkrev of the file revision does not point to an ancestor of |
|
1021 | If the linkrev of the file revision does not point to an ancestor of | |
1021 | srcrev, we'll walk down the ancestors until we find one introducing |
|
1022 | srcrev, we'll walk down the ancestors until we find one introducing | |
1022 | this file revision. |
|
1023 | this file revision. | |
1023 |
|
1024 | |||
1024 | :srcrev: the changeset revision we search ancestors from |
|
1025 | :srcrev: the changeset revision we search ancestors from | |
1025 | :inclusive: if true, the src revision will also be checked |
|
1026 | :inclusive: if true, the src revision will also be checked | |
1026 | :stoprev: an optional revision to stop the walk at. If no introduction |
|
1027 | :stoprev: an optional revision to stop the walk at. If no introduction | |
1027 | of this file content could be found before this floor |
|
1028 | of this file content could be found before this floor | |
1028 | revision, the function will returns "None" and stops its |
|
1029 | revision, the function will returns "None" and stops its | |
1029 | iteration. |
|
1030 | iteration. | |
1030 | """ |
|
1031 | """ | |
1031 | repo = self._repo |
|
1032 | repo = self._repo | |
1032 | cl = repo.unfiltered().changelog |
|
1033 | cl = repo.unfiltered().changelog | |
1033 | mfl = repo.manifestlog |
|
1034 | mfl = repo.manifestlog | |
1034 | # fetch the linkrev |
|
1035 | # fetch the linkrev | |
1035 | lkr = self.linkrev() |
|
1036 | lkr = self.linkrev() | |
1036 | if srcrev == lkr: |
|
1037 | if srcrev == lkr: | |
1037 | return lkr |
|
1038 | return lkr | |
1038 | # hack to reuse ancestor computation when searching for renames |
|
1039 | # hack to reuse ancestor computation when searching for renames | |
1039 | memberanc = getattr(self, '_ancestrycontext', None) |
|
1040 | memberanc = getattr(self, '_ancestrycontext', None) | |
1040 | iteranc = None |
|
1041 | iteranc = None | |
1041 | if srcrev is None: |
|
1042 | if srcrev is None: | |
1042 | # wctx case, used by workingfilectx during mergecopy |
|
1043 | # wctx case, used by workingfilectx during mergecopy | |
1043 | revs = [p.rev() for p in self._repo[None].parents()] |
|
1044 | revs = [p.rev() for p in self._repo[None].parents()] | |
1044 | inclusive = True # we skipped the real (revless) source |
|
1045 | inclusive = True # we skipped the real (revless) source | |
1045 | else: |
|
1046 | else: | |
1046 | revs = [srcrev] |
|
1047 | revs = [srcrev] | |
1047 | if memberanc is None: |
|
1048 | if memberanc is None: | |
1048 | memberanc = iteranc = cl.ancestors(revs, lkr, inclusive=inclusive) |
|
1049 | memberanc = iteranc = cl.ancestors(revs, lkr, inclusive=inclusive) | |
1049 | # check if this linkrev is an ancestor of srcrev |
|
1050 | # check if this linkrev is an ancestor of srcrev | |
1050 | if lkr not in memberanc: |
|
1051 | if lkr not in memberanc: | |
1051 | if iteranc is None: |
|
1052 | if iteranc is None: | |
1052 | iteranc = cl.ancestors(revs, lkr, inclusive=inclusive) |
|
1053 | iteranc = cl.ancestors(revs, lkr, inclusive=inclusive) | |
1053 | fnode = self._filenode |
|
1054 | fnode = self._filenode | |
1054 | path = self._path |
|
1055 | path = self._path | |
1055 | for a in iteranc: |
|
1056 | for a in iteranc: | |
1056 | if stoprev is not None and a < stoprev: |
|
1057 | if stoprev is not None and a < stoprev: | |
1057 | return None |
|
1058 | return None | |
1058 | ac = cl.read(a) # get changeset data (we avoid object creation) |
|
1059 | ac = cl.read(a) # get changeset data (we avoid object creation) | |
1059 | if path in ac[3]: # checking the 'files' field. |
|
1060 | if path in ac[3]: # checking the 'files' field. | |
1060 | # The file has been touched, check if the content is |
|
1061 | # The file has been touched, check if the content is | |
1061 | # similar to the one we search for. |
|
1062 | # similar to the one we search for. | |
1062 | if fnode == mfl[ac[0]].readfast().get(path): |
|
1063 | if fnode == mfl[ac[0]].readfast().get(path): | |
1063 | return a |
|
1064 | return a | |
1064 | # In theory, we should never get out of that loop without a result. |
|
1065 | # In theory, we should never get out of that loop without a result. | |
1065 | # But if manifest uses a buggy file revision (not children of the |
|
1066 | # But if manifest uses a buggy file revision (not children of the | |
1066 | # one it replaces) we could. Such a buggy situation will likely |
|
1067 | # one it replaces) we could. Such a buggy situation will likely | |
1067 | # result is crash somewhere else at to some point. |
|
1068 | # result is crash somewhere else at to some point. | |
1068 | return lkr |
|
1069 | return lkr | |
1069 |
|
1070 | |||
1070 | def isintroducedafter(self, changelogrev): |
|
1071 | def isintroducedafter(self, changelogrev): | |
1071 | """True if a filectx has been introduced after a given floor revision""" |
|
1072 | """True if a filectx has been introduced after a given floor revision""" | |
1072 | if self.linkrev() >= changelogrev: |
|
1073 | if self.linkrev() >= changelogrev: | |
1073 | return True |
|
1074 | return True | |
1074 | introrev = self._introrev(stoprev=changelogrev) |
|
1075 | introrev = self._introrev(stoprev=changelogrev) | |
1075 | if introrev is None: |
|
1076 | if introrev is None: | |
1076 | return False |
|
1077 | return False | |
1077 | return introrev >= changelogrev |
|
1078 | return introrev >= changelogrev | |
1078 |
|
1079 | |||
1079 | def introrev(self): |
|
1080 | def introrev(self): | |
1080 | """return the rev of the changeset which introduced this file revision |
|
1081 | """return the rev of the changeset which introduced this file revision | |
1081 |
|
1082 | |||
1082 | This method is different from linkrev because it take into account the |
|
1083 | This method is different from linkrev because it take into account the | |
1083 | changeset the filectx was created from. It ensures the returned |
|
1084 | changeset the filectx was created from. It ensures the returned | |
1084 | revision is one of its ancestors. This prevents bugs from |
|
1085 | revision is one of its ancestors. This prevents bugs from | |
1085 | 'linkrev-shadowing' when a file revision is used by multiple |
|
1086 | 'linkrev-shadowing' when a file revision is used by multiple | |
1086 | changesets. |
|
1087 | changesets. | |
1087 | """ |
|
1088 | """ | |
1088 | return self._introrev() |
|
1089 | return self._introrev() | |
1089 |
|
1090 | |||
1090 | def _introrev(self, stoprev=None): |
|
1091 | def _introrev(self, stoprev=None): | |
1091 | """ |
|
1092 | """ | |
1092 | Same as `introrev` but, with an extra argument to limit changelog |
|
1093 | Same as `introrev` but, with an extra argument to limit changelog | |
1093 | iteration range in some internal usecase. |
|
1094 | iteration range in some internal usecase. | |
1094 |
|
1095 | |||
1095 | If `stoprev` is set, the `introrev` will not be searched past that |
|
1096 | If `stoprev` is set, the `introrev` will not be searched past that | |
1096 | `stoprev` revision and "None" might be returned. This is useful to |
|
1097 | `stoprev` revision and "None" might be returned. This is useful to | |
1097 | limit the iteration range. |
|
1098 | limit the iteration range. | |
1098 | """ |
|
1099 | """ | |
1099 | toprev = None |
|
1100 | toprev = None | |
1100 | attrs = vars(self) |
|
1101 | attrs = vars(self) | |
1101 | if '_changeid' in attrs: |
|
1102 | if '_changeid' in attrs: | |
1102 | # We have a cached value already |
|
1103 | # We have a cached value already | |
1103 | toprev = self._changeid |
|
1104 | toprev = self._changeid | |
1104 | elif '_changectx' in attrs: |
|
1105 | elif '_changectx' in attrs: | |
1105 | # We know which changelog entry we are coming from |
|
1106 | # We know which changelog entry we are coming from | |
1106 | toprev = self._changectx.rev() |
|
1107 | toprev = self._changectx.rev() | |
1107 |
|
1108 | |||
1108 | if toprev is not None: |
|
1109 | if toprev is not None: | |
1109 | return self._adjustlinkrev(toprev, inclusive=True, stoprev=stoprev) |
|
1110 | return self._adjustlinkrev(toprev, inclusive=True, stoprev=stoprev) | |
1110 | elif '_descendantrev' in attrs: |
|
1111 | elif '_descendantrev' in attrs: | |
1111 | introrev = self._adjustlinkrev(self._descendantrev, stoprev=stoprev) |
|
1112 | introrev = self._adjustlinkrev(self._descendantrev, stoprev=stoprev) | |
1112 | # be nice and cache the result of the computation |
|
1113 | # be nice and cache the result of the computation | |
1113 | if introrev is not None: |
|
1114 | if introrev is not None: | |
1114 | self._changeid = introrev |
|
1115 | self._changeid = introrev | |
1115 | return introrev |
|
1116 | return introrev | |
1116 | else: |
|
1117 | else: | |
1117 | return self.linkrev() |
|
1118 | return self.linkrev() | |
1118 |
|
1119 | |||
1119 | def introfilectx(self): |
|
1120 | def introfilectx(self): | |
1120 | """Return filectx having identical contents, but pointing to the |
|
1121 | """Return filectx having identical contents, but pointing to the | |
1121 | changeset revision where this filectx was introduced""" |
|
1122 | changeset revision where this filectx was introduced""" | |
1122 | introrev = self.introrev() |
|
1123 | introrev = self.introrev() | |
1123 | if self.rev() == introrev: |
|
1124 | if self.rev() == introrev: | |
1124 | return self |
|
1125 | return self | |
1125 | return self.filectx(self.filenode(), changeid=introrev) |
|
1126 | return self.filectx(self.filenode(), changeid=introrev) | |
1126 |
|
1127 | |||
1127 | def _parentfilectx(self, path, fileid, filelog): |
|
1128 | def _parentfilectx(self, path, fileid, filelog): | |
1128 | """create parent filectx keeping ancestry info for _adjustlinkrev()""" |
|
1129 | """create parent filectx keeping ancestry info for _adjustlinkrev()""" | |
1129 | fctx = filectx(self._repo, path, fileid=fileid, filelog=filelog) |
|
1130 | fctx = filectx(self._repo, path, fileid=fileid, filelog=filelog) | |
1130 | if '_changeid' in vars(self) or '_changectx' in vars(self): |
|
1131 | if '_changeid' in vars(self) or '_changectx' in vars(self): | |
1131 | # If self is associated with a changeset (probably explicitly |
|
1132 | # If self is associated with a changeset (probably explicitly | |
1132 | # fed), ensure the created filectx is associated with a |
|
1133 | # fed), ensure the created filectx is associated with a | |
1133 | # changeset that is an ancestor of self.changectx. |
|
1134 | # changeset that is an ancestor of self.changectx. | |
1134 | # This lets us later use _adjustlinkrev to get a correct link. |
|
1135 | # This lets us later use _adjustlinkrev to get a correct link. | |
1135 | fctx._descendantrev = self.rev() |
|
1136 | fctx._descendantrev = self.rev() | |
1136 | fctx._ancestrycontext = getattr(self, '_ancestrycontext', None) |
|
1137 | fctx._ancestrycontext = getattr(self, '_ancestrycontext', None) | |
1137 | elif '_descendantrev' in vars(self): |
|
1138 | elif '_descendantrev' in vars(self): | |
1138 | # Otherwise propagate _descendantrev if we have one associated. |
|
1139 | # Otherwise propagate _descendantrev if we have one associated. | |
1139 | fctx._descendantrev = self._descendantrev |
|
1140 | fctx._descendantrev = self._descendantrev | |
1140 | fctx._ancestrycontext = getattr(self, '_ancestrycontext', None) |
|
1141 | fctx._ancestrycontext = getattr(self, '_ancestrycontext', None) | |
1141 | return fctx |
|
1142 | return fctx | |
1142 |
|
1143 | |||
1143 | def parents(self): |
|
1144 | def parents(self): | |
1144 | _path = self._path |
|
1145 | _path = self._path | |
1145 | fl = self._filelog |
|
1146 | fl = self._filelog | |
1146 | parents = self._filelog.parents(self._filenode) |
|
1147 | parents = self._filelog.parents(self._filenode) | |
1147 | pl = [ |
|
1148 | pl = [ | |
1148 | (_path, node, fl) |
|
1149 | (_path, node, fl) | |
1149 | for node in parents |
|
1150 | for node in parents | |
1150 | if node != self._repo.nodeconstants.nullid |
|
1151 | if node != self._repo.nodeconstants.nullid | |
1151 | ] |
|
1152 | ] | |
1152 |
|
1153 | |||
1153 | r = fl.renamed(self._filenode) |
|
1154 | r = fl.renamed(self._filenode) | |
1154 | if r: |
|
1155 | if r: | |
1155 | # - In the simple rename case, both parent are nullid, pl is empty. |
|
1156 | # - In the simple rename case, both parent are nullid, pl is empty. | |
1156 | # - In case of merge, only one of the parent is null id and should |
|
1157 | # - In case of merge, only one of the parent is null id and should | |
1157 | # be replaced with the rename information. This parent is -always- |
|
1158 | # be replaced with the rename information. This parent is -always- | |
1158 | # the first one. |
|
1159 | # the first one. | |
1159 | # |
|
1160 | # | |
1160 | # As null id have always been filtered out in the previous list |
|
1161 | # As null id have always been filtered out in the previous list | |
1161 | # comprehension, inserting to 0 will always result in "replacing |
|
1162 | # comprehension, inserting to 0 will always result in "replacing | |
1162 | # first nullid parent with rename information. |
|
1163 | # first nullid parent with rename information. | |
1163 | pl.insert(0, (r[0], r[1], self._repo.file(r[0]))) |
|
1164 | pl.insert(0, (r[0], r[1], self._repo.file(r[0]))) | |
1164 |
|
1165 | |||
1165 | return [self._parentfilectx(path, fnode, l) for path, fnode, l in pl] |
|
1166 | return [self._parentfilectx(path, fnode, l) for path, fnode, l in pl] | |
1166 |
|
1167 | |||
1167 | def p1(self): |
|
1168 | def p1(self): | |
1168 | return self.parents()[0] |
|
1169 | return self.parents()[0] | |
1169 |
|
1170 | |||
1170 | def p2(self): |
|
1171 | def p2(self): | |
1171 | p = self.parents() |
|
1172 | p = self.parents() | |
1172 | if len(p) == 2: |
|
1173 | if len(p) == 2: | |
1173 | return p[1] |
|
1174 | return p[1] | |
1174 | return filectx(self._repo, self._path, fileid=-1, filelog=self._filelog) |
|
1175 | return filectx(self._repo, self._path, fileid=-1, filelog=self._filelog) | |
1175 |
|
1176 | |||
1176 | def annotate(self, follow=False, skiprevs=None, diffopts=None): |
|
1177 | def annotate(self, follow=False, skiprevs=None, diffopts=None): | |
1177 | """Returns a list of annotateline objects for each line in the file |
|
1178 | """Returns a list of annotateline objects for each line in the file | |
1178 |
|
1179 | |||
1179 | - line.fctx is the filectx of the node where that line was last changed |
|
1180 | - line.fctx is the filectx of the node where that line was last changed | |
1180 | - line.lineno is the line number at the first appearance in the managed |
|
1181 | - line.lineno is the line number at the first appearance in the managed | |
1181 | file |
|
1182 | file | |
1182 | - line.text is the data on that line (including newline character) |
|
1183 | - line.text is the data on that line (including newline character) | |
1183 | """ |
|
1184 | """ | |
1184 | getlog = util.lrucachefunc(lambda x: self._repo.file(x)) |
|
1185 | getlog = util.lrucachefunc(lambda x: self._repo.file(x)) | |
1185 |
|
1186 | |||
1186 | def parents(f): |
|
1187 | def parents(f): | |
1187 | # Cut _descendantrev here to mitigate the penalty of lazy linkrev |
|
1188 | # Cut _descendantrev here to mitigate the penalty of lazy linkrev | |
1188 | # adjustment. Otherwise, p._adjustlinkrev() would walk changelog |
|
1189 | # adjustment. Otherwise, p._adjustlinkrev() would walk changelog | |
1189 | # from the topmost introrev (= srcrev) down to p.linkrev() if it |
|
1190 | # from the topmost introrev (= srcrev) down to p.linkrev() if it | |
1190 | # isn't an ancestor of the srcrev. |
|
1191 | # isn't an ancestor of the srcrev. | |
1191 | f._changeid |
|
1192 | f._changeid | |
1192 | pl = f.parents() |
|
1193 | pl = f.parents() | |
1193 |
|
1194 | |||
1194 | # Don't return renamed parents if we aren't following. |
|
1195 | # Don't return renamed parents if we aren't following. | |
1195 | if not follow: |
|
1196 | if not follow: | |
1196 | pl = [p for p in pl if p.path() == f.path()] |
|
1197 | pl = [p for p in pl if p.path() == f.path()] | |
1197 |
|
1198 | |||
1198 | # renamed filectx won't have a filelog yet, so set it |
|
1199 | # renamed filectx won't have a filelog yet, so set it | |
1199 | # from the cache to save time |
|
1200 | # from the cache to save time | |
1200 | for p in pl: |
|
1201 | for p in pl: | |
1201 | if not '_filelog' in p.__dict__: |
|
1202 | if not '_filelog' in p.__dict__: | |
1202 | p._filelog = getlog(p.path()) |
|
1203 | p._filelog = getlog(p.path()) | |
1203 |
|
1204 | |||
1204 | return pl |
|
1205 | return pl | |
1205 |
|
1206 | |||
1206 | # use linkrev to find the first changeset where self appeared |
|
1207 | # use linkrev to find the first changeset where self appeared | |
1207 | base = self.introfilectx() |
|
1208 | base = self.introfilectx() | |
1208 | if getattr(base, '_ancestrycontext', None) is None: |
|
1209 | if getattr(base, '_ancestrycontext', None) is None: | |
1209 | # it is safe to use an unfiltered repository here because we are |
|
1210 | # it is safe to use an unfiltered repository here because we are | |
1210 | # walking ancestors only. |
|
1211 | # walking ancestors only. | |
1211 | cl = self._repo.unfiltered().changelog |
|
1212 | cl = self._repo.unfiltered().changelog | |
1212 | if base.rev() is None: |
|
1213 | if base.rev() is None: | |
1213 | # wctx is not inclusive, but works because _ancestrycontext |
|
1214 | # wctx is not inclusive, but works because _ancestrycontext | |
1214 | # is used to test filelog revisions |
|
1215 | # is used to test filelog revisions | |
1215 | ac = cl.ancestors( |
|
1216 | ac = cl.ancestors( | |
1216 | [p.rev() for p in base.parents()], inclusive=True |
|
1217 | [p.rev() for p in base.parents()], inclusive=True | |
1217 | ) |
|
1218 | ) | |
1218 | else: |
|
1219 | else: | |
1219 | ac = cl.ancestors([base.rev()], inclusive=True) |
|
1220 | ac = cl.ancestors([base.rev()], inclusive=True) | |
1220 | base._ancestrycontext = ac |
|
1221 | base._ancestrycontext = ac | |
1221 |
|
1222 | |||
1222 | return dagop.annotate( |
|
1223 | return dagop.annotate( | |
1223 | base, parents, skiprevs=skiprevs, diffopts=diffopts |
|
1224 | base, parents, skiprevs=skiprevs, diffopts=diffopts | |
1224 | ) |
|
1225 | ) | |
1225 |
|
1226 | |||
1226 | def ancestors(self, followfirst=False): |
|
1227 | def ancestors(self, followfirst=False): | |
1227 | visit = {} |
|
1228 | visit = {} | |
1228 | c = self |
|
1229 | c = self | |
1229 | if followfirst: |
|
1230 | if followfirst: | |
1230 | cut = 1 |
|
1231 | cut = 1 | |
1231 | else: |
|
1232 | else: | |
1232 | cut = None |
|
1233 | cut = None | |
1233 |
|
1234 | |||
1234 | while True: |
|
1235 | while True: | |
1235 | for parent in c.parents()[:cut]: |
|
1236 | for parent in c.parents()[:cut]: | |
1236 | visit[(parent.linkrev(), parent.filenode())] = parent |
|
1237 | visit[(parent.linkrev(), parent.filenode())] = parent | |
1237 | if not visit: |
|
1238 | if not visit: | |
1238 | break |
|
1239 | break | |
1239 | c = visit.pop(max(visit)) |
|
1240 | c = visit.pop(max(visit)) | |
1240 | yield c |
|
1241 | yield c | |
1241 |
|
1242 | |||
1242 | def decodeddata(self): |
|
1243 | def decodeddata(self): | |
1243 | """Returns `data()` after running repository decoding filters. |
|
1244 | """Returns `data()` after running repository decoding filters. | |
1244 |
|
1245 | |||
1245 | This is often equivalent to how the data would be expressed on disk. |
|
1246 | This is often equivalent to how the data would be expressed on disk. | |
1246 | """ |
|
1247 | """ | |
1247 | return self._repo.wwritedata(self.path(), self.data()) |
|
1248 | return self._repo.wwritedata(self.path(), self.data()) | |
1248 |
|
1249 | |||
1249 |
|
1250 | |||
1250 | class filectx(basefilectx): |
|
1251 | class filectx(basefilectx): | |
1251 | """A filecontext object makes access to data related to a particular |
|
1252 | """A filecontext object makes access to data related to a particular | |
1252 | filerevision convenient.""" |
|
1253 | filerevision convenient.""" | |
1253 |
|
1254 | |||
1254 | def __init__( |
|
1255 | def __init__( | |
1255 | self, |
|
1256 | self, | |
1256 | repo, |
|
1257 | repo, | |
1257 | path, |
|
1258 | path, | |
1258 | changeid=None, |
|
1259 | changeid=None, | |
1259 | fileid=None, |
|
1260 | fileid=None, | |
1260 | filelog=None, |
|
1261 | filelog=None, | |
1261 | changectx=None, |
|
1262 | changectx=None, | |
1262 | ): |
|
1263 | ): | |
1263 | """changeid must be a revision number, if specified. |
|
1264 | """changeid must be a revision number, if specified. | |
1264 | fileid can be a file revision or node.""" |
|
1265 | fileid can be a file revision or node.""" | |
1265 | self._repo = repo |
|
1266 | self._repo = repo | |
1266 | self._path = path |
|
1267 | self._path = path | |
1267 |
|
1268 | |||
1268 | assert ( |
|
1269 | assert ( | |
1269 | changeid is not None or fileid is not None or changectx is not None |
|
1270 | changeid is not None or fileid is not None or changectx is not None | |
1270 | ), b"bad args: changeid=%r, fileid=%r, changectx=%r" % ( |
|
1271 | ), b"bad args: changeid=%r, fileid=%r, changectx=%r" % ( | |
1271 | changeid, |
|
1272 | changeid, | |
1272 | fileid, |
|
1273 | fileid, | |
1273 | changectx, |
|
1274 | changectx, | |
1274 | ) |
|
1275 | ) | |
1275 |
|
1276 | |||
1276 | if filelog is not None: |
|
1277 | if filelog is not None: | |
1277 | self._filelog = filelog |
|
1278 | self._filelog = filelog | |
1278 |
|
1279 | |||
1279 | if changeid is not None: |
|
1280 | if changeid is not None: | |
1280 | self._changeid = changeid |
|
1281 | self._changeid = changeid | |
1281 | if changectx is not None: |
|
1282 | if changectx is not None: | |
1282 | self._changectx = changectx |
|
1283 | self._changectx = changectx | |
1283 | if fileid is not None: |
|
1284 | if fileid is not None: | |
1284 | self._fileid = fileid |
|
1285 | self._fileid = fileid | |
1285 |
|
1286 | |||
1286 | @propertycache |
|
1287 | @propertycache | |
1287 | def _changectx(self): |
|
1288 | def _changectx(self): | |
1288 | try: |
|
1289 | try: | |
1289 | return self._repo[self._changeid] |
|
1290 | return self._repo[self._changeid] | |
1290 | except error.FilteredRepoLookupError: |
|
1291 | except error.FilteredRepoLookupError: | |
1291 | # Linkrev may point to any revision in the repository. When the |
|
1292 | # Linkrev may point to any revision in the repository. When the | |
1292 | # repository is filtered this may lead to `filectx` trying to build |
|
1293 | # repository is filtered this may lead to `filectx` trying to build | |
1293 | # `changectx` for filtered revision. In such case we fallback to |
|
1294 | # `changectx` for filtered revision. In such case we fallback to | |
1294 | # creating `changectx` on the unfiltered version of the reposition. |
|
1295 | # creating `changectx` on the unfiltered version of the reposition. | |
1295 | # This fallback should not be an issue because `changectx` from |
|
1296 | # This fallback should not be an issue because `changectx` from | |
1296 | # `filectx` are not used in complex operations that care about |
|
1297 | # `filectx` are not used in complex operations that care about | |
1297 | # filtering. |
|
1298 | # filtering. | |
1298 | # |
|
1299 | # | |
1299 | # This fallback is a cheap and dirty fix that prevent several |
|
1300 | # This fallback is a cheap and dirty fix that prevent several | |
1300 | # crashes. It does not ensure the behavior is correct. However the |
|
1301 | # crashes. It does not ensure the behavior is correct. However the | |
1301 | # behavior was not correct before filtering either and "incorrect |
|
1302 | # behavior was not correct before filtering either and "incorrect | |
1302 | # behavior" is seen as better as "crash" |
|
1303 | # behavior" is seen as better as "crash" | |
1303 | # |
|
1304 | # | |
1304 | # Linkrevs have several serious troubles with filtering that are |
|
1305 | # Linkrevs have several serious troubles with filtering that are | |
1305 | # complicated to solve. Proper handling of the issue here should be |
|
1306 | # complicated to solve. Proper handling of the issue here should be | |
1306 | # considered when solving linkrev issue are on the table. |
|
1307 | # considered when solving linkrev issue are on the table. | |
1307 | return self._repo.unfiltered()[self._changeid] |
|
1308 | return self._repo.unfiltered()[self._changeid] | |
1308 |
|
1309 | |||
1309 | def filectx(self, fileid, changeid=None): |
|
1310 | def filectx(self, fileid, changeid=None): | |
1310 | """opens an arbitrary revision of the file without |
|
1311 | """opens an arbitrary revision of the file without | |
1311 | opening a new filelog""" |
|
1312 | opening a new filelog""" | |
1312 | return filectx( |
|
1313 | return filectx( | |
1313 | self._repo, |
|
1314 | self._repo, | |
1314 | self._path, |
|
1315 | self._path, | |
1315 | fileid=fileid, |
|
1316 | fileid=fileid, | |
1316 | filelog=self._filelog, |
|
1317 | filelog=self._filelog, | |
1317 | changeid=changeid, |
|
1318 | changeid=changeid, | |
1318 | ) |
|
1319 | ) | |
1319 |
|
1320 | |||
1320 | def rawdata(self): |
|
1321 | def rawdata(self): | |
1321 | return self._filelog.rawdata(self._filenode) |
|
1322 | return self._filelog.rawdata(self._filenode) | |
1322 |
|
1323 | |||
1323 | def rawflags(self): |
|
1324 | def rawflags(self): | |
1324 | """low-level revlog flags""" |
|
1325 | """low-level revlog flags""" | |
1325 | return self._filelog.flags(self._filerev) |
|
1326 | return self._filelog.flags(self._filerev) | |
1326 |
|
1327 | |||
1327 | def data(self): |
|
1328 | def data(self): | |
1328 | try: |
|
1329 | try: | |
1329 | return self._filelog.read(self._filenode) |
|
1330 | return self._filelog.read(self._filenode) | |
1330 | except error.CensoredNodeError: |
|
1331 | except error.CensoredNodeError: | |
1331 | if self._repo.ui.config(b"censor", b"policy") == b"ignore": |
|
1332 | if self._repo.ui.config(b"censor", b"policy") == b"ignore": | |
1332 | return b"" |
|
1333 | return b"" | |
1333 | raise error.Abort( |
|
1334 | raise error.Abort( | |
1334 | _(b"censored node: %s") % short(self._filenode), |
|
1335 | _(b"censored node: %s") % short(self._filenode), | |
1335 | hint=_(b"set censor.policy to ignore errors"), |
|
1336 | hint=_(b"set censor.policy to ignore errors"), | |
1336 | ) |
|
1337 | ) | |
1337 |
|
1338 | |||
1338 | def size(self): |
|
1339 | def size(self): | |
1339 | return self._filelog.size(self._filerev) |
|
1340 | return self._filelog.size(self._filerev) | |
1340 |
|
1341 | |||
1341 | @propertycache |
|
1342 | @propertycache | |
1342 | def _copied(self): |
|
1343 | def _copied(self): | |
1343 | """check if file was actually renamed in this changeset revision |
|
1344 | """check if file was actually renamed in this changeset revision | |
1344 |
|
1345 | |||
1345 | If rename logged in file revision, we report copy for changeset only |
|
1346 | If rename logged in file revision, we report copy for changeset only | |
1346 | if file revisions linkrev points back to the changeset in question |
|
1347 | if file revisions linkrev points back to the changeset in question | |
1347 | or both changeset parents contain different file revisions. |
|
1348 | or both changeset parents contain different file revisions. | |
1348 | """ |
|
1349 | """ | |
1349 |
|
1350 | |||
1350 | renamed = self._filelog.renamed(self._filenode) |
|
1351 | renamed = self._filelog.renamed(self._filenode) | |
1351 | if not renamed: |
|
1352 | if not renamed: | |
1352 | return None |
|
1353 | return None | |
1353 |
|
1354 | |||
1354 | if self.rev() == self.linkrev(): |
|
1355 | if self.rev() == self.linkrev(): | |
1355 | return renamed |
|
1356 | return renamed | |
1356 |
|
1357 | |||
1357 | name = self.path() |
|
1358 | name = self.path() | |
1358 | fnode = self._filenode |
|
1359 | fnode = self._filenode | |
1359 | for p in self._changectx.parents(): |
|
1360 | for p in self._changectx.parents(): | |
1360 | try: |
|
1361 | try: | |
1361 | if fnode == p.filenode(name): |
|
1362 | if fnode == p.filenode(name): | |
1362 | return None |
|
1363 | return None | |
1363 | except error.LookupError: |
|
1364 | except error.LookupError: | |
1364 | pass |
|
1365 | pass | |
1365 | return renamed |
|
1366 | return renamed | |
1366 |
|
1367 | |||
1367 | def children(self): |
|
1368 | def children(self): | |
1368 | # hard for renames |
|
1369 | # hard for renames | |
1369 | c = self._filelog.children(self._filenode) |
|
1370 | c = self._filelog.children(self._filenode) | |
1370 | return [ |
|
1371 | return [ | |
1371 | filectx(self._repo, self._path, fileid=x, filelog=self._filelog) |
|
1372 | filectx(self._repo, self._path, fileid=x, filelog=self._filelog) | |
1372 | for x in c |
|
1373 | for x in c | |
1373 | ] |
|
1374 | ] | |
1374 |
|
1375 | |||
1375 |
|
1376 | |||
1376 | class committablectx(basectx): |
|
1377 | class committablectx(basectx): | |
1377 | """A committablectx object provides common functionality for a context that |
|
1378 | """A committablectx object provides common functionality for a context that | |
1378 | wants the ability to commit, e.g. workingctx or memctx.""" |
|
1379 | wants the ability to commit, e.g. workingctx or memctx.""" | |
1379 |
|
1380 | |||
1380 | def __init__( |
|
1381 | def __init__( | |
1381 | self, |
|
1382 | self, | |
1382 | repo, |
|
1383 | repo, | |
1383 | text=b"", |
|
1384 | text=b"", | |
1384 | user=None, |
|
1385 | user=None, | |
1385 | date=None, |
|
1386 | date=None, | |
1386 | extra=None, |
|
1387 | extra=None, | |
1387 | changes=None, |
|
1388 | changes=None, | |
1388 | branch=None, |
|
1389 | branch=None, | |
1389 | ): |
|
1390 | ): | |
1390 | super(committablectx, self).__init__(repo) |
|
1391 | super(committablectx, self).__init__(repo) | |
1391 | self._rev = None |
|
1392 | self._rev = None | |
1392 | self._node = None |
|
1393 | self._node = None | |
1393 | self._text = text |
|
1394 | self._text = text | |
1394 | if date: |
|
1395 | if date: | |
1395 | self._date = dateutil.parsedate(date) |
|
1396 | self._date = dateutil.parsedate(date) | |
1396 | if user: |
|
1397 | if user: | |
1397 | self._user = user |
|
1398 | self._user = user | |
1398 | if changes: |
|
1399 | if changes: | |
1399 | self._status = changes |
|
1400 | self._status = changes | |
1400 |
|
1401 | |||
1401 | self._extra = {} |
|
1402 | self._extra = {} | |
1402 | if extra: |
|
1403 | if extra: | |
1403 | self._extra = extra.copy() |
|
1404 | self._extra = extra.copy() | |
1404 | if branch is not None: |
|
1405 | if branch is not None: | |
1405 | self._extra[b'branch'] = encoding.fromlocal(branch) |
|
1406 | self._extra[b'branch'] = encoding.fromlocal(branch) | |
1406 | if not self._extra.get(b'branch'): |
|
1407 | if not self._extra.get(b'branch'): | |
1407 | self._extra[b'branch'] = b'default' |
|
1408 | self._extra[b'branch'] = b'default' | |
1408 |
|
1409 | |||
1409 | def __bytes__(self): |
|
1410 | def __bytes__(self): | |
1410 | return bytes(self._parents[0]) + b"+" |
|
1411 | return bytes(self._parents[0]) + b"+" | |
1411 |
|
1412 | |||
1412 | def hex(self): |
|
1413 | def hex(self): | |
1413 | self._repo.nodeconstants.wdirhex |
|
1414 | self._repo.nodeconstants.wdirhex | |
1414 |
|
1415 | |||
1415 | __str__ = encoding.strmethod(__bytes__) |
|
1416 | __str__ = encoding.strmethod(__bytes__) | |
1416 |
|
1417 | |||
1417 | def __nonzero__(self): |
|
1418 | def __nonzero__(self): | |
1418 | return True |
|
1419 | return True | |
1419 |
|
1420 | |||
1420 | __bool__ = __nonzero__ |
|
1421 | __bool__ = __nonzero__ | |
1421 |
|
1422 | |||
1422 | @propertycache |
|
1423 | @propertycache | |
1423 | def _status(self): |
|
1424 | def _status(self): | |
1424 | return self._repo.status() |
|
1425 | return self._repo.status() | |
1425 |
|
1426 | |||
1426 | @propertycache |
|
1427 | @propertycache | |
1427 | def _user(self): |
|
1428 | def _user(self): | |
1428 | return self._repo.ui.username() |
|
1429 | return self._repo.ui.username() | |
1429 |
|
1430 | |||
1430 | @propertycache |
|
1431 | @propertycache | |
1431 | def _date(self): |
|
1432 | def _date(self): | |
1432 | ui = self._repo.ui |
|
1433 | ui = self._repo.ui | |
1433 | date = ui.configdate(b'devel', b'default-date') |
|
1434 | date = ui.configdate(b'devel', b'default-date') | |
1434 | if date is None: |
|
1435 | if date is None: | |
1435 | date = dateutil.makedate() |
|
1436 | date = dateutil.makedate() | |
1436 | return date |
|
1437 | return date | |
1437 |
|
1438 | |||
1438 | def subrev(self, subpath): |
|
1439 | def subrev(self, subpath): | |
1439 | return None |
|
1440 | return None | |
1440 |
|
1441 | |||
1441 | def manifestnode(self): |
|
1442 | def manifestnode(self): | |
1442 | return None |
|
1443 | return None | |
1443 |
|
1444 | |||
1444 | def user(self): |
|
1445 | def user(self): | |
1445 | return self._user or self._repo.ui.username() |
|
1446 | return self._user or self._repo.ui.username() | |
1446 |
|
1447 | |||
1447 | def date(self): |
|
1448 | def date(self): | |
1448 | return self._date |
|
1449 | return self._date | |
1449 |
|
1450 | |||
1450 | def description(self): |
|
1451 | def description(self): | |
1451 | return self._text |
|
1452 | return self._text | |
1452 |
|
1453 | |||
1453 | def files(self): |
|
1454 | def files(self): | |
1454 | return sorted( |
|
1455 | return sorted( | |
1455 | self._status.modified + self._status.added + self._status.removed |
|
1456 | self._status.modified + self._status.added + self._status.removed | |
1456 | ) |
|
1457 | ) | |
1457 |
|
1458 | |||
1458 | def modified(self): |
|
1459 | def modified(self): | |
1459 | return self._status.modified |
|
1460 | return self._status.modified | |
1460 |
|
1461 | |||
1461 | def added(self): |
|
1462 | def added(self): | |
1462 | return self._status.added |
|
1463 | return self._status.added | |
1463 |
|
1464 | |||
1464 | def removed(self): |
|
1465 | def removed(self): | |
1465 | return self._status.removed |
|
1466 | return self._status.removed | |
1466 |
|
1467 | |||
1467 | def deleted(self): |
|
1468 | def deleted(self): | |
1468 | return self._status.deleted |
|
1469 | return self._status.deleted | |
1469 |
|
1470 | |||
1470 | filesmodified = modified |
|
1471 | filesmodified = modified | |
1471 | filesadded = added |
|
1472 | filesadded = added | |
1472 | filesremoved = removed |
|
1473 | filesremoved = removed | |
1473 |
|
1474 | |||
1474 | def branch(self): |
|
1475 | def branch(self): | |
1475 | return encoding.tolocal(self._extra[b'branch']) |
|
1476 | return encoding.tolocal(self._extra[b'branch']) | |
1476 |
|
1477 | |||
1477 | def closesbranch(self): |
|
1478 | def closesbranch(self): | |
1478 | return b'close' in self._extra |
|
1479 | return b'close' in self._extra | |
1479 |
|
1480 | |||
1480 | def extra(self): |
|
1481 | def extra(self): | |
1481 | return self._extra |
|
1482 | return self._extra | |
1482 |
|
1483 | |||
1483 | def isinmemory(self): |
|
1484 | def isinmemory(self): | |
1484 | return False |
|
1485 | return False | |
1485 |
|
1486 | |||
1486 | def tags(self): |
|
1487 | def tags(self): | |
1487 | return [] |
|
1488 | return [] | |
1488 |
|
1489 | |||
1489 | def bookmarks(self): |
|
1490 | def bookmarks(self): | |
1490 | b = [] |
|
1491 | b = [] | |
1491 | for p in self.parents(): |
|
1492 | for p in self.parents(): | |
1492 | b.extend(p.bookmarks()) |
|
1493 | b.extend(p.bookmarks()) | |
1493 | return b |
|
1494 | return b | |
1494 |
|
1495 | |||
1495 | def phase(self): |
|
1496 | def phase(self): | |
1496 | phase = phases.newcommitphase(self._repo.ui) |
|
1497 | phase = phases.newcommitphase(self._repo.ui) | |
1497 | for p in self.parents(): |
|
1498 | for p in self.parents(): | |
1498 | phase = max(phase, p.phase()) |
|
1499 | phase = max(phase, p.phase()) | |
1499 | return phase |
|
1500 | return phase | |
1500 |
|
1501 | |||
1501 | def hidden(self): |
|
1502 | def hidden(self): | |
1502 | return False |
|
1503 | return False | |
1503 |
|
1504 | |||
1504 | def children(self): |
|
1505 | def children(self): | |
1505 | return [] |
|
1506 | return [] | |
1506 |
|
1507 | |||
1507 | def flags(self, path): |
|
1508 | def flags(self, path): | |
1508 | if '_manifest' in self.__dict__: |
|
1509 | if '_manifest' in self.__dict__: | |
1509 | try: |
|
1510 | try: | |
1510 | return self._manifest.flags(path) |
|
1511 | return self._manifest.flags(path) | |
1511 | except KeyError: |
|
1512 | except KeyError: | |
1512 | return b'' |
|
1513 | return b'' | |
1513 |
|
1514 | |||
1514 | try: |
|
1515 | try: | |
1515 | return self._flagfunc(path) |
|
1516 | return self._flagfunc(path) | |
1516 | except OSError: |
|
1517 | except OSError: | |
1517 | return b'' |
|
1518 | return b'' | |
1518 |
|
1519 | |||
1519 | def ancestor(self, c2): |
|
1520 | def ancestor(self, c2): | |
1520 | """return the "best" ancestor context of self and c2""" |
|
1521 | """return the "best" ancestor context of self and c2""" | |
1521 | return self._parents[0].ancestor(c2) # punt on two parents for now |
|
1522 | return self._parents[0].ancestor(c2) # punt on two parents for now | |
1522 |
|
1523 | |||
1523 | def ancestors(self): |
|
1524 | def ancestors(self): | |
1524 | for p in self._parents: |
|
1525 | for p in self._parents: | |
1525 | yield p |
|
1526 | yield p | |
1526 | for a in self._repo.changelog.ancestors( |
|
1527 | for a in self._repo.changelog.ancestors( | |
1527 | [p.rev() for p in self._parents] |
|
1528 | [p.rev() for p in self._parents] | |
1528 | ): |
|
1529 | ): | |
1529 | yield self._repo[a] |
|
1530 | yield self._repo[a] | |
1530 |
|
1531 | |||
1531 | def markcommitted(self, node): |
|
1532 | def markcommitted(self, node): | |
1532 | """Perform post-commit cleanup necessary after committing this ctx |
|
1533 | """Perform post-commit cleanup necessary after committing this ctx | |
1533 |
|
1534 | |||
1534 | Specifically, this updates backing stores this working context |
|
1535 | Specifically, this updates backing stores this working context | |
1535 | wraps to reflect the fact that the changes reflected by this |
|
1536 | wraps to reflect the fact that the changes reflected by this | |
1536 | workingctx have been committed. For example, it marks |
|
1537 | workingctx have been committed. For example, it marks | |
1537 | modified and added files as normal in the dirstate. |
|
1538 | modified and added files as normal in the dirstate. | |
1538 |
|
1539 | |||
1539 | """ |
|
1540 | """ | |
1540 |
|
1541 | |||
1541 | def dirty(self, missing=False, merge=True, branch=True): |
|
1542 | def dirty(self, missing=False, merge=True, branch=True): | |
1542 | return False |
|
1543 | return False | |
1543 |
|
1544 | |||
1544 |
|
1545 | |||
1545 | class workingctx(committablectx): |
|
1546 | class workingctx(committablectx): | |
1546 | """A workingctx object makes access to data related to |
|
1547 | """A workingctx object makes access to data related to | |
1547 | the current working directory convenient. |
|
1548 | the current working directory convenient. | |
1548 | date - any valid date string or (unixtime, offset), or None. |
|
1549 | date - any valid date string or (unixtime, offset), or None. | |
1549 | user - username string, or None. |
|
1550 | user - username string, or None. | |
1550 | extra - a dictionary of extra values, or None. |
|
1551 | extra - a dictionary of extra values, or None. | |
1551 | changes - a list of file lists as returned by localrepo.status() |
|
1552 | changes - a list of file lists as returned by localrepo.status() | |
1552 | or None to use the repository status. |
|
1553 | or None to use the repository status. | |
1553 | """ |
|
1554 | """ | |
1554 |
|
1555 | |||
1555 | def __init__( |
|
1556 | def __init__( | |
1556 | self, repo, text=b"", user=None, date=None, extra=None, changes=None |
|
1557 | self, repo, text=b"", user=None, date=None, extra=None, changes=None | |
1557 | ): |
|
1558 | ): | |
1558 | branch = None |
|
1559 | branch = None | |
1559 | if not extra or b'branch' not in extra: |
|
1560 | if not extra or b'branch' not in extra: | |
1560 | try: |
|
1561 | try: | |
1561 | branch = repo.dirstate.branch() |
|
1562 | branch = repo.dirstate.branch() | |
1562 | except UnicodeDecodeError: |
|
1563 | except UnicodeDecodeError: | |
1563 | raise error.Abort(_(b'branch name not in UTF-8!')) |
|
1564 | raise error.Abort(_(b'branch name not in UTF-8!')) | |
1564 | super(workingctx, self).__init__( |
|
1565 | super(workingctx, self).__init__( | |
1565 | repo, text, user, date, extra, changes, branch=branch |
|
1566 | repo, text, user, date, extra, changes, branch=branch | |
1566 | ) |
|
1567 | ) | |
1567 |
|
1568 | |||
1568 | def __iter__(self): |
|
1569 | def __iter__(self): | |
1569 | d = self._repo.dirstate |
|
1570 | d = self._repo.dirstate | |
1570 | for f in d: |
|
1571 | for f in d: | |
1571 | if d.get_entry(f).tracked: |
|
1572 | if d.get_entry(f).tracked: | |
1572 | yield f |
|
1573 | yield f | |
1573 |
|
1574 | |||
1574 | def __contains__(self, key): |
|
1575 | def __contains__(self, key): | |
1575 | return self._repo.dirstate.get_entry(key).tracked |
|
1576 | return self._repo.dirstate.get_entry(key).tracked | |
1576 |
|
1577 | |||
1577 | def hex(self): |
|
1578 | def hex(self): | |
1578 | return self._repo.nodeconstants.wdirhex |
|
1579 | return self._repo.nodeconstants.wdirhex | |
1579 |
|
1580 | |||
1580 | @propertycache |
|
1581 | @propertycache | |
1581 | def _parents(self): |
|
1582 | def _parents(self): | |
1582 | p = self._repo.dirstate.parents() |
|
1583 | p = self._repo.dirstate.parents() | |
1583 | if p[1] == self._repo.nodeconstants.nullid: |
|
1584 | if p[1] == self._repo.nodeconstants.nullid: | |
1584 | p = p[:-1] |
|
1585 | p = p[:-1] | |
1585 | # use unfiltered repo to delay/avoid loading obsmarkers |
|
1586 | # use unfiltered repo to delay/avoid loading obsmarkers | |
1586 | unfi = self._repo.unfiltered() |
|
1587 | unfi = self._repo.unfiltered() | |
1587 | return [ |
|
1588 | return [ | |
1588 | changectx( |
|
1589 | changectx( | |
1589 | self._repo, unfi.changelog.rev(n), n, maybe_filtered=False |
|
1590 | self._repo, unfi.changelog.rev(n), n, maybe_filtered=False | |
1590 | ) |
|
1591 | ) | |
1591 | for n in p |
|
1592 | for n in p | |
1592 | ] |
|
1593 | ] | |
1593 |
|
1594 | |||
1594 | def setparents(self, p1node, p2node=None): |
|
1595 | def setparents(self, p1node, p2node=None): | |
1595 | if p2node is None: |
|
1596 | if p2node is None: | |
1596 | p2node = self._repo.nodeconstants.nullid |
|
1597 | p2node = self._repo.nodeconstants.nullid | |
1597 | dirstate = self._repo.dirstate |
|
1598 | dirstate = self._repo.dirstate | |
1598 | with dirstate.parentchange(): |
|
1599 | with dirstate.parentchange(): | |
1599 | copies = dirstate.setparents(p1node, p2node) |
|
1600 | copies = dirstate.setparents(p1node, p2node) | |
1600 | pctx = self._repo[p1node] |
|
1601 | pctx = self._repo[p1node] | |
1601 | if copies: |
|
1602 | if copies: | |
1602 | # Adjust copy records, the dirstate cannot do it, it |
|
1603 | # Adjust copy records, the dirstate cannot do it, it | |
1603 | # requires access to parents manifests. Preserve them |
|
1604 | # requires access to parents manifests. Preserve them | |
1604 | # only for entries added to first parent. |
|
1605 | # only for entries added to first parent. | |
1605 | for f in copies: |
|
1606 | for f in copies: | |
1606 | if f not in pctx and copies[f] in pctx: |
|
1607 | if f not in pctx and copies[f] in pctx: | |
1607 | dirstate.copy(copies[f], f) |
|
1608 | dirstate.copy(copies[f], f) | |
1608 | if p2node == self._repo.nodeconstants.nullid: |
|
1609 | if p2node == self._repo.nodeconstants.nullid: | |
1609 | for f, s in sorted(dirstate.copies().items()): |
|
1610 | for f, s in sorted(dirstate.copies().items()): | |
1610 | if f not in pctx and s not in pctx: |
|
1611 | if f not in pctx and s not in pctx: | |
1611 | dirstate.copy(None, f) |
|
1612 | dirstate.copy(None, f) | |
1612 |
|
1613 | |||
1613 | def _fileinfo(self, path): |
|
1614 | def _fileinfo(self, path): | |
1614 | # populate __dict__['_manifest'] as workingctx has no _manifestdelta |
|
1615 | # populate __dict__['_manifest'] as workingctx has no _manifestdelta | |
1615 | self._manifest |
|
1616 | self._manifest | |
1616 | return super(workingctx, self)._fileinfo(path) |
|
1617 | return super(workingctx, self)._fileinfo(path) | |
1617 |
|
1618 | |||
1618 | def _buildflagfunc(self): |
|
1619 | def _buildflagfunc(self): | |
1619 | # Create a fallback function for getting file flags when the |
|
1620 | # Create a fallback function for getting file flags when the | |
1620 | # filesystem doesn't support them |
|
1621 | # filesystem doesn't support them | |
1621 |
|
1622 | |||
1622 | copiesget = self._repo.dirstate.copies().get |
|
1623 | copiesget = self._repo.dirstate.copies().get | |
1623 | parents = self.parents() |
|
1624 | parents = self.parents() | |
1624 | if len(parents) < 2: |
|
1625 | if len(parents) < 2: | |
1625 | # when we have one parent, it's easy: copy from parent |
|
1626 | # when we have one parent, it's easy: copy from parent | |
1626 | man = parents[0].manifest() |
|
1627 | man = parents[0].manifest() | |
1627 |
|
1628 | |||
1628 | def func(f): |
|
1629 | def func(f): | |
1629 | f = copiesget(f, f) |
|
1630 | f = copiesget(f, f) | |
1630 | return man.flags(f) |
|
1631 | return man.flags(f) | |
1631 |
|
1632 | |||
1632 | else: |
|
1633 | else: | |
1633 | # merges are tricky: we try to reconstruct the unstored |
|
1634 | # merges are tricky: we try to reconstruct the unstored | |
1634 | # result from the merge (issue1802) |
|
1635 | # result from the merge (issue1802) | |
1635 | p1, p2 = parents |
|
1636 | p1, p2 = parents | |
1636 | pa = p1.ancestor(p2) |
|
1637 | pa = p1.ancestor(p2) | |
1637 | m1, m2, ma = p1.manifest(), p2.manifest(), pa.manifest() |
|
1638 | m1, m2, ma = p1.manifest(), p2.manifest(), pa.manifest() | |
1638 |
|
1639 | |||
1639 | def func(f): |
|
1640 | def func(f): | |
1640 | f = copiesget(f, f) # may be wrong for merges with copies |
|
1641 | f = copiesget(f, f) # may be wrong for merges with copies | |
1641 | fl1, fl2, fla = m1.flags(f), m2.flags(f), ma.flags(f) |
|
1642 | fl1, fl2, fla = m1.flags(f), m2.flags(f), ma.flags(f) | |
1642 | if fl1 == fl2: |
|
1643 | if fl1 == fl2: | |
1643 | return fl1 |
|
1644 | return fl1 | |
1644 | if fl1 == fla: |
|
1645 | if fl1 == fla: | |
1645 | return fl2 |
|
1646 | return fl2 | |
1646 | if fl2 == fla: |
|
1647 | if fl2 == fla: | |
1647 | return fl1 |
|
1648 | return fl1 | |
1648 | return b'' # punt for conflicts |
|
1649 | return b'' # punt for conflicts | |
1649 |
|
1650 | |||
1650 | return func |
|
1651 | return func | |
1651 |
|
1652 | |||
1652 | @propertycache |
|
1653 | @propertycache | |
1653 | def _flagfunc(self): |
|
1654 | def _flagfunc(self): | |
1654 | return self._repo.dirstate.flagfunc(self._buildflagfunc) |
|
1655 | return self._repo.dirstate.flagfunc(self._buildflagfunc) | |
1655 |
|
1656 | |||
1656 | def flags(self, path): |
|
1657 | def flags(self, path): | |
1657 | try: |
|
1658 | try: | |
1658 | return self._flagfunc(path) |
|
1659 | return self._flagfunc(path) | |
1659 | except OSError: |
|
1660 | except OSError: | |
1660 | return b'' |
|
1661 | return b'' | |
1661 |
|
1662 | |||
1662 | def filectx(self, path, filelog=None): |
|
1663 | def filectx(self, path, filelog=None): | |
1663 | """get a file context from the working directory""" |
|
1664 | """get a file context from the working directory""" | |
1664 | return workingfilectx( |
|
1665 | return workingfilectx( | |
1665 | self._repo, path, workingctx=self, filelog=filelog |
|
1666 | self._repo, path, workingctx=self, filelog=filelog | |
1666 | ) |
|
1667 | ) | |
1667 |
|
1668 | |||
1668 | def dirty(self, missing=False, merge=True, branch=True): |
|
1669 | def dirty(self, missing=False, merge=True, branch=True): | |
1669 | """check whether a working directory is modified""" |
|
1670 | """check whether a working directory is modified""" | |
1670 | # check subrepos first |
|
1671 | # check subrepos first | |
1671 | for s in sorted(self.substate): |
|
1672 | for s in sorted(self.substate): | |
1672 | if self.sub(s).dirty(missing=missing): |
|
1673 | if self.sub(s).dirty(missing=missing): | |
1673 | return True |
|
1674 | return True | |
1674 | # check current working dir |
|
1675 | # check current working dir | |
1675 | return ( |
|
1676 | return ( | |
1676 | (merge and self.p2()) |
|
1677 | (merge and self.p2()) | |
1677 | or (branch and self.branch() != self.p1().branch()) |
|
1678 | or (branch and self.branch() != self.p1().branch()) | |
1678 | or self.modified() |
|
1679 | or self.modified() | |
1679 | or self.added() |
|
1680 | or self.added() | |
1680 | or self.removed() |
|
1681 | or self.removed() | |
1681 | or (missing and self.deleted()) |
|
1682 | or (missing and self.deleted()) | |
1682 | ) |
|
1683 | ) | |
1683 |
|
1684 | |||
1684 | def add(self, list, prefix=b""): |
|
1685 | def add(self, list, prefix=b""): | |
1685 | with self._repo.wlock(): |
|
1686 | with self._repo.wlock(): | |
1686 | ui, ds = self._repo.ui, self._repo.dirstate |
|
1687 | ui, ds = self._repo.ui, self._repo.dirstate | |
1687 | uipath = lambda f: ds.pathto(pathutil.join(prefix, f)) |
|
1688 | uipath = lambda f: ds.pathto(pathutil.join(prefix, f)) | |
1688 | rejected = [] |
|
1689 | rejected = [] | |
1689 | lstat = self._repo.wvfs.lstat |
|
1690 | lstat = self._repo.wvfs.lstat | |
1690 | for f in list: |
|
1691 | for f in list: | |
1691 | # ds.pathto() returns an absolute file when this is invoked from |
|
1692 | # ds.pathto() returns an absolute file when this is invoked from | |
1692 | # the keyword extension. That gets flagged as non-portable on |
|
1693 | # the keyword extension. That gets flagged as non-portable on | |
1693 | # Windows, since it contains the drive letter and colon. |
|
1694 | # Windows, since it contains the drive letter and colon. | |
1694 | scmutil.checkportable(ui, os.path.join(prefix, f)) |
|
1695 | scmutil.checkportable(ui, os.path.join(prefix, f)) | |
1695 | try: |
|
1696 | try: | |
1696 | st = lstat(f) |
|
1697 | st = lstat(f) | |
1697 | except OSError: |
|
1698 | except OSError: | |
1698 | ui.warn(_(b"%s does not exist!\n") % uipath(f)) |
|
1699 | ui.warn(_(b"%s does not exist!\n") % uipath(f)) | |
1699 | rejected.append(f) |
|
1700 | rejected.append(f) | |
1700 | continue |
|
1701 | continue | |
1701 | limit = ui.configbytes(b'ui', b'large-file-limit') |
|
1702 | limit = ui.configbytes(b'ui', b'large-file-limit') | |
1702 | if limit != 0 and st.st_size > limit: |
|
1703 | if limit != 0 and st.st_size > limit: | |
1703 | ui.warn( |
|
1704 | ui.warn( | |
1704 | _( |
|
1705 | _( | |
1705 | b"%s: up to %d MB of RAM may be required " |
|
1706 | b"%s: up to %d MB of RAM may be required " | |
1706 | b"to manage this file\n" |
|
1707 | b"to manage this file\n" | |
1707 | b"(use 'hg revert %s' to cancel the " |
|
1708 | b"(use 'hg revert %s' to cancel the " | |
1708 | b"pending addition)\n" |
|
1709 | b"pending addition)\n" | |
1709 | ) |
|
1710 | ) | |
1710 | % (f, 3 * st.st_size // 1000000, uipath(f)) |
|
1711 | % (f, 3 * st.st_size // 1000000, uipath(f)) | |
1711 | ) |
|
1712 | ) | |
1712 | if not (stat.S_ISREG(st.st_mode) or stat.S_ISLNK(st.st_mode)): |
|
1713 | if not (stat.S_ISREG(st.st_mode) or stat.S_ISLNK(st.st_mode)): | |
1713 | ui.warn( |
|
1714 | ui.warn( | |
1714 | _( |
|
1715 | _( | |
1715 | b"%s not added: only files and symlinks " |
|
1716 | b"%s not added: only files and symlinks " | |
1716 | b"supported currently\n" |
|
1717 | b"supported currently\n" | |
1717 | ) |
|
1718 | ) | |
1718 | % uipath(f) |
|
1719 | % uipath(f) | |
1719 | ) |
|
1720 | ) | |
1720 | rejected.append(f) |
|
1721 | rejected.append(f) | |
1721 | elif not ds.set_tracked(f): |
|
1722 | elif not ds.set_tracked(f): | |
1722 | ui.warn(_(b"%s already tracked!\n") % uipath(f)) |
|
1723 | ui.warn(_(b"%s already tracked!\n") % uipath(f)) | |
1723 | return rejected |
|
1724 | return rejected | |
1724 |
|
1725 | |||
1725 | def forget(self, files, prefix=b""): |
|
1726 | def forget(self, files, prefix=b""): | |
1726 | with self._repo.wlock(): |
|
1727 | with self._repo.wlock(): | |
1727 | ds = self._repo.dirstate |
|
1728 | ds = self._repo.dirstate | |
1728 | uipath = lambda f: ds.pathto(pathutil.join(prefix, f)) |
|
1729 | uipath = lambda f: ds.pathto(pathutil.join(prefix, f)) | |
1729 | rejected = [] |
|
1730 | rejected = [] | |
1730 | for f in files: |
|
1731 | for f in files: | |
1731 | if not ds.set_untracked(f): |
|
1732 | if not ds.set_untracked(f): | |
1732 | self._repo.ui.warn(_(b"%s not tracked!\n") % uipath(f)) |
|
1733 | self._repo.ui.warn(_(b"%s not tracked!\n") % uipath(f)) | |
1733 | rejected.append(f) |
|
1734 | rejected.append(f) | |
1734 | return rejected |
|
1735 | return rejected | |
1735 |
|
1736 | |||
1736 | def copy(self, source, dest): |
|
1737 | def copy(self, source, dest): | |
1737 | try: |
|
1738 | try: | |
1738 | st = self._repo.wvfs.lstat(dest) |
|
1739 | st = self._repo.wvfs.lstat(dest) | |
1739 | except FileNotFoundError: |
|
1740 | except FileNotFoundError: | |
1740 | self._repo.ui.warn( |
|
1741 | self._repo.ui.warn( | |
1741 | _(b"%s does not exist!\n") % self._repo.dirstate.pathto(dest) |
|
1742 | _(b"%s does not exist!\n") % self._repo.dirstate.pathto(dest) | |
1742 | ) |
|
1743 | ) | |
1743 | return |
|
1744 | return | |
1744 | if not (stat.S_ISREG(st.st_mode) or stat.S_ISLNK(st.st_mode)): |
|
1745 | if not (stat.S_ISREG(st.st_mode) or stat.S_ISLNK(st.st_mode)): | |
1745 | self._repo.ui.warn( |
|
1746 | self._repo.ui.warn( | |
1746 | _(b"copy failed: %s is not a file or a symbolic link\n") |
|
1747 | _(b"copy failed: %s is not a file or a symbolic link\n") | |
1747 | % self._repo.dirstate.pathto(dest) |
|
1748 | % self._repo.dirstate.pathto(dest) | |
1748 | ) |
|
1749 | ) | |
1749 | else: |
|
1750 | else: | |
1750 | with self._repo.wlock(): |
|
1751 | with self._repo.wlock(): | |
1751 | ds = self._repo.dirstate |
|
1752 | ds = self._repo.dirstate | |
1752 | ds.set_tracked(dest) |
|
1753 | ds.set_tracked(dest) | |
1753 | ds.copy(source, dest) |
|
1754 | ds.copy(source, dest) | |
1754 |
|
1755 | |||
1755 | def match( |
|
1756 | def match( | |
1756 | self, |
|
1757 | self, | |
1757 | pats=None, |
|
1758 | pats=None, | |
1758 | include=None, |
|
1759 | include=None, | |
1759 | exclude=None, |
|
1760 | exclude=None, | |
1760 | default=b'glob', |
|
1761 | default=b'glob', | |
1761 | listsubrepos=False, |
|
1762 | listsubrepos=False, | |
1762 | badfn=None, |
|
1763 | badfn=None, | |
1763 | cwd=None, |
|
1764 | cwd=None, | |
1764 | ): |
|
1765 | ): | |
1765 | r = self._repo |
|
1766 | r = self._repo | |
1766 | if not cwd: |
|
1767 | if not cwd: | |
1767 | cwd = r.getcwd() |
|
1768 | cwd = r.getcwd() | |
1768 |
|
1769 | |||
1769 | # Only a case insensitive filesystem needs magic to translate user input |
|
1770 | # Only a case insensitive filesystem needs magic to translate user input | |
1770 | # to actual case in the filesystem. |
|
1771 | # to actual case in the filesystem. | |
1771 | icasefs = not util.fscasesensitive(r.root) |
|
1772 | icasefs = not util.fscasesensitive(r.root) | |
1772 | return matchmod.match( |
|
1773 | return matchmod.match( | |
1773 | r.root, |
|
1774 | r.root, | |
1774 | cwd, |
|
1775 | cwd, | |
1775 | pats, |
|
1776 | pats, | |
1776 | include, |
|
1777 | include, | |
1777 | exclude, |
|
1778 | exclude, | |
1778 | default, |
|
1779 | default, | |
1779 | auditor=r.auditor, |
|
1780 | auditor=r.auditor, | |
1780 | ctx=self, |
|
1781 | ctx=self, | |
1781 | listsubrepos=listsubrepos, |
|
1782 | listsubrepos=listsubrepos, | |
1782 | badfn=badfn, |
|
1783 | badfn=badfn, | |
1783 | icasefs=icasefs, |
|
1784 | icasefs=icasefs, | |
1784 | ) |
|
1785 | ) | |
1785 |
|
1786 | |||
1786 | def _filtersuspectsymlink(self, files): |
|
1787 | def _filtersuspectsymlink(self, files): | |
1787 | if not files or self._repo.dirstate._checklink: |
|
1788 | if not files or self._repo.dirstate._checklink: | |
1788 | return files |
|
1789 | return files | |
1789 |
|
1790 | |||
1790 | # Symlink placeholders may get non-symlink-like contents |
|
1791 | # Symlink placeholders may get non-symlink-like contents | |
1791 | # via user error or dereferencing by NFS or Samba servers, |
|
1792 | # via user error or dereferencing by NFS or Samba servers, | |
1792 | # so we filter out any placeholders that don't look like a |
|
1793 | # so we filter out any placeholders that don't look like a | |
1793 | # symlink |
|
1794 | # symlink | |
1794 | sane = [] |
|
1795 | sane = [] | |
1795 | for f in files: |
|
1796 | for f in files: | |
1796 | if self.flags(f) == b'l': |
|
1797 | if self.flags(f) == b'l': | |
1797 | d = self[f].data() |
|
1798 | d = self[f].data() | |
1798 | if ( |
|
1799 | if ( | |
1799 | d == b'' |
|
1800 | d == b'' | |
1800 | or len(d) >= 1024 |
|
1801 | or len(d) >= 1024 | |
1801 | or b'\n' in d |
|
1802 | or b'\n' in d | |
1802 | or stringutil.binary(d) |
|
1803 | or stringutil.binary(d) | |
1803 | ): |
|
1804 | ): | |
1804 | self._repo.ui.debug( |
|
1805 | self._repo.ui.debug( | |
1805 | b'ignoring suspect symlink placeholder "%s"\n' % f |
|
1806 | b'ignoring suspect symlink placeholder "%s"\n' % f | |
1806 | ) |
|
1807 | ) | |
1807 | continue |
|
1808 | continue | |
1808 | sane.append(f) |
|
1809 | sane.append(f) | |
1809 | return sane |
|
1810 | return sane | |
1810 |
|
1811 | |||
1811 | def _checklookup(self, files, mtime_boundary): |
|
1812 | def _checklookup(self, files, mtime_boundary): | |
1812 | # check for any possibly clean files |
|
1813 | # check for any possibly clean files | |
1813 | if not files: |
|
1814 | if not files: | |
1814 | return [], [], [], [] |
|
1815 | return [], [], [], [] | |
1815 |
|
1816 | |||
1816 | modified = [] |
|
1817 | modified = [] | |
1817 | deleted = [] |
|
1818 | deleted = [] | |
1818 | clean = [] |
|
1819 | clean = [] | |
1819 | fixup = [] |
|
1820 | fixup = [] | |
1820 | pctx = self._parents[0] |
|
1821 | pctx = self._parents[0] | |
1821 | # do a full compare of any files that might have changed |
|
1822 | # do a full compare of any files that might have changed | |
1822 | for f in sorted(files): |
|
1823 | for f in sorted(files): | |
1823 | try: |
|
1824 | try: | |
1824 | # This will return True for a file that got replaced by a |
|
1825 | # This will return True for a file that got replaced by a | |
1825 | # directory in the interim, but fixing that is pretty hard. |
|
1826 | # directory in the interim, but fixing that is pretty hard. | |
1826 | if ( |
|
1827 | if ( | |
1827 | f not in pctx |
|
1828 | f not in pctx | |
1828 | or self.flags(f) != pctx.flags(f) |
|
1829 | or self.flags(f) != pctx.flags(f) | |
1829 | or pctx[f].cmp(self[f]) |
|
1830 | or pctx[f].cmp(self[f]) | |
1830 | ): |
|
1831 | ): | |
1831 | modified.append(f) |
|
1832 | modified.append(f) | |
1832 | elif mtime_boundary is None: |
|
1833 | elif mtime_boundary is None: | |
1833 | clean.append(f) |
|
1834 | clean.append(f) | |
1834 | else: |
|
1835 | else: | |
1835 | s = self[f].lstat() |
|
1836 | s = self[f].lstat() | |
1836 | mode = s.st_mode |
|
1837 | mode = s.st_mode | |
1837 | size = s.st_size |
|
1838 | size = s.st_size | |
1838 | file_mtime = timestamp.reliable_mtime_of(s, mtime_boundary) |
|
1839 | file_mtime = timestamp.reliable_mtime_of(s, mtime_boundary) | |
1839 | if file_mtime is not None: |
|
1840 | if file_mtime is not None: | |
1840 | cache_info = (mode, size, file_mtime) |
|
1841 | cache_info = (mode, size, file_mtime) | |
1841 | fixup.append((f, cache_info)) |
|
1842 | fixup.append((f, cache_info)) | |
1842 | else: |
|
1843 | else: | |
1843 | clean.append(f) |
|
1844 | clean.append(f) | |
1844 | except (IOError, OSError): |
|
1845 | except (IOError, OSError): | |
1845 | # A file become inaccessible in between? Mark it as deleted, |
|
1846 | # A file become inaccessible in between? Mark it as deleted, | |
1846 | # matching dirstate behavior (issue5584). |
|
1847 | # matching dirstate behavior (issue5584). | |
1847 | # The dirstate has more complex behavior around whether a |
|
1848 | # The dirstate has more complex behavior around whether a | |
1848 | # missing file matches a directory, etc, but we don't need to |
|
1849 | # missing file matches a directory, etc, but we don't need to | |
1849 | # bother with that: if f has made it to this point, we're sure |
|
1850 | # bother with that: if f has made it to this point, we're sure | |
1850 | # it's in the dirstate. |
|
1851 | # it's in the dirstate. | |
1851 | deleted.append(f) |
|
1852 | deleted.append(f) | |
1852 |
|
1853 | |||
1853 | return modified, deleted, clean, fixup |
|
1854 | return modified, deleted, clean, fixup | |
1854 |
|
1855 | |||
1855 | def _poststatusfixup(self, status, fixup): |
|
1856 | def _poststatusfixup(self, status, fixup): | |
1856 | """update dirstate for files that are actually clean""" |
|
1857 | """update dirstate for files that are actually clean""" | |
|
1858 | ui = self._repo.ui | |||
|
1859 | testing.wait_on_cfg(self._repo.ui, b'status.pre-dirstate-write-file') | |||
1857 | poststatus = self._repo.postdsstatus() |
|
1860 | poststatus = self._repo.postdsstatus() | |
1858 | if fixup or poststatus or self._repo.dirstate._dirty: |
|
1861 | if fixup or poststatus or self._repo.dirstate._dirty: | |
1859 | try: |
|
1862 | try: | |
1860 | oldid = self._repo.dirstate.identity() |
|
1863 | oldid = self._repo.dirstate.identity() | |
1861 |
|
1864 | |||
1862 | # updating the dirstate is optional |
|
1865 | # updating the dirstate is optional | |
1863 | # so we don't wait on the lock |
|
1866 | # so we don't wait on the lock | |
1864 | # wlock can invalidate the dirstate, so cache normal _after_ |
|
1867 | # wlock can invalidate the dirstate, so cache normal _after_ | |
1865 | # taking the lock |
|
1868 | # taking the lock | |
1866 | with self._repo.wlock(False): |
|
1869 | with self._repo.wlock(False): | |
1867 | dirstate = self._repo.dirstate |
|
1870 | dirstate = self._repo.dirstate | |
1868 | if dirstate.identity() == oldid: |
|
1871 | if dirstate.identity() == oldid: | |
1869 | if fixup: |
|
1872 | if fixup: | |
1870 | if dirstate.pendingparentchange(): |
|
1873 | if dirstate.pendingparentchange(): | |
1871 | normal = lambda f, pfd: dirstate.update_file( |
|
1874 | normal = lambda f, pfd: dirstate.update_file( | |
1872 | f, p1_tracked=True, wc_tracked=True |
|
1875 | f, p1_tracked=True, wc_tracked=True | |
1873 | ) |
|
1876 | ) | |
1874 | else: |
|
1877 | else: | |
1875 | normal = dirstate.set_clean |
|
1878 | normal = dirstate.set_clean | |
1876 | for f, pdf in fixup: |
|
1879 | for f, pdf in fixup: | |
1877 | normal(f, pdf) |
|
1880 | normal(f, pdf) | |
1878 | # write changes out explicitly, because nesting |
|
1881 | # write changes out explicitly, because nesting | |
1879 | # wlock at runtime may prevent 'wlock.release()' |
|
1882 | # wlock at runtime may prevent 'wlock.release()' | |
1880 | # after this block from doing so for subsequent |
|
1883 | # after this block from doing so for subsequent | |
1881 | # changing files |
|
1884 | # changing files | |
1882 | tr = self._repo.currenttransaction() |
|
1885 | tr = self._repo.currenttransaction() | |
1883 | self._repo.dirstate.write(tr) |
|
1886 | self._repo.dirstate.write(tr) | |
1884 |
|
1887 | |||
1885 | if poststatus: |
|
1888 | if poststatus: | |
1886 | for ps in poststatus: |
|
1889 | for ps in poststatus: | |
1887 | ps(self, status) |
|
1890 | ps(self, status) | |
1888 | else: |
|
1891 | else: | |
1889 | # in this case, writing changes out breaks |
|
1892 | # in this case, writing changes out breaks | |
1890 | # consistency, because .hg/dirstate was |
|
1893 | # consistency, because .hg/dirstate was | |
1891 | # already changed simultaneously after last |
|
1894 | # already changed simultaneously after last | |
1892 | # caching (see also issue5584 for detail) |
|
1895 | # caching (see also issue5584 for detail) | |
1893 | self._repo.ui.debug( |
|
1896 | ui.debug(b'skip updating dirstate: identity mismatch\n') | |
1894 | b'skip updating dirstate: identity mismatch\n' |
|
|||
1895 | ) |
|
|||
1896 | except error.LockError: |
|
1897 | except error.LockError: | |
1897 | pass |
|
1898 | pass | |
1898 | finally: |
|
1899 | finally: | |
1899 | # Even if the wlock couldn't be grabbed, clear out the list. |
|
1900 | # Even if the wlock couldn't be grabbed, clear out the list. | |
1900 | self._repo.clearpostdsstatus() |
|
1901 | self._repo.clearpostdsstatus() | |
1901 |
|
1902 | |||
1902 | def _dirstatestatus(self, match, ignored=False, clean=False, unknown=False): |
|
1903 | def _dirstatestatus(self, match, ignored=False, clean=False, unknown=False): | |
1903 | '''Gets the status from the dirstate -- internal use only.''' |
|
1904 | '''Gets the status from the dirstate -- internal use only.''' | |
1904 | subrepos = [] |
|
1905 | subrepos = [] | |
1905 | if b'.hgsub' in self: |
|
1906 | if b'.hgsub' in self: | |
1906 | subrepos = sorted(self.substate) |
|
1907 | subrepos = sorted(self.substate) | |
1907 | cmp, s, mtime_boundary = self._repo.dirstate.status( |
|
1908 | cmp, s, mtime_boundary = self._repo.dirstate.status( | |
1908 | match, subrepos, ignored=ignored, clean=clean, unknown=unknown |
|
1909 | match, subrepos, ignored=ignored, clean=clean, unknown=unknown | |
1909 | ) |
|
1910 | ) | |
1910 |
|
1911 | |||
1911 | # check for any possibly clean files |
|
1912 | # check for any possibly clean files | |
1912 | fixup = [] |
|
1913 | fixup = [] | |
1913 | if cmp: |
|
1914 | if cmp: | |
1914 | modified2, deleted2, clean_set, fixup = self._checklookup( |
|
1915 | modified2, deleted2, clean_set, fixup = self._checklookup( | |
1915 | cmp, mtime_boundary |
|
1916 | cmp, mtime_boundary | |
1916 | ) |
|
1917 | ) | |
1917 | s.modified.extend(modified2) |
|
1918 | s.modified.extend(modified2) | |
1918 | s.deleted.extend(deleted2) |
|
1919 | s.deleted.extend(deleted2) | |
1919 |
|
1920 | |||
1920 | if clean_set and clean: |
|
1921 | if clean_set and clean: | |
1921 | s.clean.extend(clean_set) |
|
1922 | s.clean.extend(clean_set) | |
1922 | if fixup and clean: |
|
1923 | if fixup and clean: | |
1923 | s.clean.extend((f for f, _ in fixup)) |
|
1924 | s.clean.extend((f for f, _ in fixup)) | |
1924 |
|
1925 | |||
1925 | self._poststatusfixup(s, fixup) |
|
1926 | self._poststatusfixup(s, fixup) | |
1926 |
|
1927 | |||
1927 | if match.always(): |
|
1928 | if match.always(): | |
1928 | # cache for performance |
|
1929 | # cache for performance | |
1929 | if s.unknown or s.ignored or s.clean: |
|
1930 | if s.unknown or s.ignored or s.clean: | |
1930 | # "_status" is cached with list*=False in the normal route |
|
1931 | # "_status" is cached with list*=False in the normal route | |
1931 | self._status = scmutil.status( |
|
1932 | self._status = scmutil.status( | |
1932 | s.modified, s.added, s.removed, s.deleted, [], [], [] |
|
1933 | s.modified, s.added, s.removed, s.deleted, [], [], [] | |
1933 | ) |
|
1934 | ) | |
1934 | else: |
|
1935 | else: | |
1935 | self._status = s |
|
1936 | self._status = s | |
1936 |
|
1937 | |||
1937 | return s |
|
1938 | return s | |
1938 |
|
1939 | |||
1939 | @propertycache |
|
1940 | @propertycache | |
1940 | def _copies(self): |
|
1941 | def _copies(self): | |
1941 | p1copies = {} |
|
1942 | p1copies = {} | |
1942 | p2copies = {} |
|
1943 | p2copies = {} | |
1943 | parents = self._repo.dirstate.parents() |
|
1944 | parents = self._repo.dirstate.parents() | |
1944 | p1manifest = self._repo[parents[0]].manifest() |
|
1945 | p1manifest = self._repo[parents[0]].manifest() | |
1945 | p2manifest = self._repo[parents[1]].manifest() |
|
1946 | p2manifest = self._repo[parents[1]].manifest() | |
1946 | changedset = set(self.added()) | set(self.modified()) |
|
1947 | changedset = set(self.added()) | set(self.modified()) | |
1947 | narrowmatch = self._repo.narrowmatch() |
|
1948 | narrowmatch = self._repo.narrowmatch() | |
1948 | for dst, src in self._repo.dirstate.copies().items(): |
|
1949 | for dst, src in self._repo.dirstate.copies().items(): | |
1949 | if dst not in changedset or not narrowmatch(dst): |
|
1950 | if dst not in changedset or not narrowmatch(dst): | |
1950 | continue |
|
1951 | continue | |
1951 | if src in p1manifest: |
|
1952 | if src in p1manifest: | |
1952 | p1copies[dst] = src |
|
1953 | p1copies[dst] = src | |
1953 | elif src in p2manifest: |
|
1954 | elif src in p2manifest: | |
1954 | p2copies[dst] = src |
|
1955 | p2copies[dst] = src | |
1955 | return p1copies, p2copies |
|
1956 | return p1copies, p2copies | |
1956 |
|
1957 | |||
1957 | @propertycache |
|
1958 | @propertycache | |
1958 | def _manifest(self): |
|
1959 | def _manifest(self): | |
1959 | """generate a manifest corresponding to the values in self._status |
|
1960 | """generate a manifest corresponding to the values in self._status | |
1960 |
|
1961 | |||
1961 | This reuse the file nodeid from parent, but we use special node |
|
1962 | This reuse the file nodeid from parent, but we use special node | |
1962 | identifiers for added and modified files. This is used by manifests |
|
1963 | identifiers for added and modified files. This is used by manifests | |
1963 | merge to see that files are different and by update logic to avoid |
|
1964 | merge to see that files are different and by update logic to avoid | |
1964 | deleting newly added files. |
|
1965 | deleting newly added files. | |
1965 | """ |
|
1966 | """ | |
1966 | return self._buildstatusmanifest(self._status) |
|
1967 | return self._buildstatusmanifest(self._status) | |
1967 |
|
1968 | |||
1968 | def _buildstatusmanifest(self, status): |
|
1969 | def _buildstatusmanifest(self, status): | |
1969 | """Builds a manifest that includes the given status results.""" |
|
1970 | """Builds a manifest that includes the given status results.""" | |
1970 | parents = self.parents() |
|
1971 | parents = self.parents() | |
1971 |
|
1972 | |||
1972 | man = parents[0].manifest().copy() |
|
1973 | man = parents[0].manifest().copy() | |
1973 |
|
1974 | |||
1974 | ff = self._flagfunc |
|
1975 | ff = self._flagfunc | |
1975 | for i, l in ( |
|
1976 | for i, l in ( | |
1976 | (self._repo.nodeconstants.addednodeid, status.added), |
|
1977 | (self._repo.nodeconstants.addednodeid, status.added), | |
1977 | (self._repo.nodeconstants.modifiednodeid, status.modified), |
|
1978 | (self._repo.nodeconstants.modifiednodeid, status.modified), | |
1978 | ): |
|
1979 | ): | |
1979 | for f in l: |
|
1980 | for f in l: | |
1980 | man[f] = i |
|
1981 | man[f] = i | |
1981 | try: |
|
1982 | try: | |
1982 | man.setflag(f, ff(f)) |
|
1983 | man.setflag(f, ff(f)) | |
1983 | except OSError: |
|
1984 | except OSError: | |
1984 | pass |
|
1985 | pass | |
1985 |
|
1986 | |||
1986 | for f in status.deleted + status.removed: |
|
1987 | for f in status.deleted + status.removed: | |
1987 | if f in man: |
|
1988 | if f in man: | |
1988 | del man[f] |
|
1989 | del man[f] | |
1989 |
|
1990 | |||
1990 | return man |
|
1991 | return man | |
1991 |
|
1992 | |||
1992 | def _buildstatus( |
|
1993 | def _buildstatus( | |
1993 | self, other, s, match, listignored, listclean, listunknown |
|
1994 | self, other, s, match, listignored, listclean, listunknown | |
1994 | ): |
|
1995 | ): | |
1995 | """build a status with respect to another context |
|
1996 | """build a status with respect to another context | |
1996 |
|
1997 | |||
1997 | This includes logic for maintaining the fast path of status when |
|
1998 | This includes logic for maintaining the fast path of status when | |
1998 | comparing the working directory against its parent, which is to skip |
|
1999 | comparing the working directory against its parent, which is to skip | |
1999 | building a new manifest if self (working directory) is not comparing |
|
2000 | building a new manifest if self (working directory) is not comparing | |
2000 | against its parent (repo['.']). |
|
2001 | against its parent (repo['.']). | |
2001 | """ |
|
2002 | """ | |
2002 | s = self._dirstatestatus(match, listignored, listclean, listunknown) |
|
2003 | s = self._dirstatestatus(match, listignored, listclean, listunknown) | |
2003 | # Filter out symlinks that, in the case of FAT32 and NTFS filesystems, |
|
2004 | # Filter out symlinks that, in the case of FAT32 and NTFS filesystems, | |
2004 | # might have accidentally ended up with the entire contents of the file |
|
2005 | # might have accidentally ended up with the entire contents of the file | |
2005 | # they are supposed to be linking to. |
|
2006 | # they are supposed to be linking to. | |
2006 | s.modified[:] = self._filtersuspectsymlink(s.modified) |
|
2007 | s.modified[:] = self._filtersuspectsymlink(s.modified) | |
2007 | if other != self._repo[b'.']: |
|
2008 | if other != self._repo[b'.']: | |
2008 | s = super(workingctx, self)._buildstatus( |
|
2009 | s = super(workingctx, self)._buildstatus( | |
2009 | other, s, match, listignored, listclean, listunknown |
|
2010 | other, s, match, listignored, listclean, listunknown | |
2010 | ) |
|
2011 | ) | |
2011 | return s |
|
2012 | return s | |
2012 |
|
2013 | |||
2013 | def _matchstatus(self, other, match): |
|
2014 | def _matchstatus(self, other, match): | |
2014 | """override the match method with a filter for directory patterns |
|
2015 | """override the match method with a filter for directory patterns | |
2015 |
|
2016 | |||
2016 | We use inheritance to customize the match.bad method only in cases of |
|
2017 | We use inheritance to customize the match.bad method only in cases of | |
2017 | workingctx since it belongs only to the working directory when |
|
2018 | workingctx since it belongs only to the working directory when | |
2018 | comparing against the parent changeset. |
|
2019 | comparing against the parent changeset. | |
2019 |
|
2020 | |||
2020 | If we aren't comparing against the working directory's parent, then we |
|
2021 | If we aren't comparing against the working directory's parent, then we | |
2021 | just use the default match object sent to us. |
|
2022 | just use the default match object sent to us. | |
2022 | """ |
|
2023 | """ | |
2023 | if other != self._repo[b'.']: |
|
2024 | if other != self._repo[b'.']: | |
2024 |
|
2025 | |||
2025 | def bad(f, msg): |
|
2026 | def bad(f, msg): | |
2026 | # 'f' may be a directory pattern from 'match.files()', |
|
2027 | # 'f' may be a directory pattern from 'match.files()', | |
2027 | # so 'f not in ctx1' is not enough |
|
2028 | # so 'f not in ctx1' is not enough | |
2028 | if f not in other and not other.hasdir(f): |
|
2029 | if f not in other and not other.hasdir(f): | |
2029 | self._repo.ui.warn( |
|
2030 | self._repo.ui.warn( | |
2030 | b'%s: %s\n' % (self._repo.dirstate.pathto(f), msg) |
|
2031 | b'%s: %s\n' % (self._repo.dirstate.pathto(f), msg) | |
2031 | ) |
|
2032 | ) | |
2032 |
|
2033 | |||
2033 | match.bad = bad |
|
2034 | match.bad = bad | |
2034 | return match |
|
2035 | return match | |
2035 |
|
2036 | |||
2036 | def walk(self, match): |
|
2037 | def walk(self, match): | |
2037 | '''Generates matching file names.''' |
|
2038 | '''Generates matching file names.''' | |
2038 | return sorted( |
|
2039 | return sorted( | |
2039 | self._repo.dirstate.walk( |
|
2040 | self._repo.dirstate.walk( | |
2040 | self._repo.narrowmatch(match), |
|
2041 | self._repo.narrowmatch(match), | |
2041 | subrepos=sorted(self.substate), |
|
2042 | subrepos=sorted(self.substate), | |
2042 | unknown=True, |
|
2043 | unknown=True, | |
2043 | ignored=False, |
|
2044 | ignored=False, | |
2044 | ) |
|
2045 | ) | |
2045 | ) |
|
2046 | ) | |
2046 |
|
2047 | |||
2047 | def matches(self, match): |
|
2048 | def matches(self, match): | |
2048 | match = self._repo.narrowmatch(match) |
|
2049 | match = self._repo.narrowmatch(match) | |
2049 | ds = self._repo.dirstate |
|
2050 | ds = self._repo.dirstate | |
2050 | return sorted(f for f in ds.matches(match) if ds.get_entry(f).tracked) |
|
2051 | return sorted(f for f in ds.matches(match) if ds.get_entry(f).tracked) | |
2051 |
|
2052 | |||
2052 | def markcommitted(self, node): |
|
2053 | def markcommitted(self, node): | |
2053 | with self._repo.dirstate.parentchange(): |
|
2054 | with self._repo.dirstate.parentchange(): | |
2054 | for f in self.modified() + self.added(): |
|
2055 | for f in self.modified() + self.added(): | |
2055 | self._repo.dirstate.update_file( |
|
2056 | self._repo.dirstate.update_file( | |
2056 | f, p1_tracked=True, wc_tracked=True |
|
2057 | f, p1_tracked=True, wc_tracked=True | |
2057 | ) |
|
2058 | ) | |
2058 | for f in self.removed(): |
|
2059 | for f in self.removed(): | |
2059 | self._repo.dirstate.update_file( |
|
2060 | self._repo.dirstate.update_file( | |
2060 | f, p1_tracked=False, wc_tracked=False |
|
2061 | f, p1_tracked=False, wc_tracked=False | |
2061 | ) |
|
2062 | ) | |
2062 | self._repo.dirstate.setparents(node) |
|
2063 | self._repo.dirstate.setparents(node) | |
2063 | self._repo._quick_access_changeid_invalidate() |
|
2064 | self._repo._quick_access_changeid_invalidate() | |
2064 |
|
2065 | |||
2065 | sparse.aftercommit(self._repo, node) |
|
2066 | sparse.aftercommit(self._repo, node) | |
2066 |
|
2067 | |||
2067 | # write changes out explicitly, because nesting wlock at |
|
2068 | # write changes out explicitly, because nesting wlock at | |
2068 | # runtime may prevent 'wlock.release()' in 'repo.commit()' |
|
2069 | # runtime may prevent 'wlock.release()' in 'repo.commit()' | |
2069 | # from immediately doing so for subsequent changing files |
|
2070 | # from immediately doing so for subsequent changing files | |
2070 | self._repo.dirstate.write(self._repo.currenttransaction()) |
|
2071 | self._repo.dirstate.write(self._repo.currenttransaction()) | |
2071 |
|
2072 | |||
2072 | def mergestate(self, clean=False): |
|
2073 | def mergestate(self, clean=False): | |
2073 | if clean: |
|
2074 | if clean: | |
2074 | return mergestatemod.mergestate.clean(self._repo) |
|
2075 | return mergestatemod.mergestate.clean(self._repo) | |
2075 | return mergestatemod.mergestate.read(self._repo) |
|
2076 | return mergestatemod.mergestate.read(self._repo) | |
2076 |
|
2077 | |||
2077 |
|
2078 | |||
2078 | class committablefilectx(basefilectx): |
|
2079 | class committablefilectx(basefilectx): | |
2079 | """A committablefilectx provides common functionality for a file context |
|
2080 | """A committablefilectx provides common functionality for a file context | |
2080 | that wants the ability to commit, e.g. workingfilectx or memfilectx.""" |
|
2081 | that wants the ability to commit, e.g. workingfilectx or memfilectx.""" | |
2081 |
|
2082 | |||
2082 | def __init__(self, repo, path, filelog=None, ctx=None): |
|
2083 | def __init__(self, repo, path, filelog=None, ctx=None): | |
2083 | self._repo = repo |
|
2084 | self._repo = repo | |
2084 | self._path = path |
|
2085 | self._path = path | |
2085 | self._changeid = None |
|
2086 | self._changeid = None | |
2086 | self._filerev = self._filenode = None |
|
2087 | self._filerev = self._filenode = None | |
2087 |
|
2088 | |||
2088 | if filelog is not None: |
|
2089 | if filelog is not None: | |
2089 | self._filelog = filelog |
|
2090 | self._filelog = filelog | |
2090 | if ctx: |
|
2091 | if ctx: | |
2091 | self._changectx = ctx |
|
2092 | self._changectx = ctx | |
2092 |
|
2093 | |||
2093 | def __nonzero__(self): |
|
2094 | def __nonzero__(self): | |
2094 | return True |
|
2095 | return True | |
2095 |
|
2096 | |||
2096 | __bool__ = __nonzero__ |
|
2097 | __bool__ = __nonzero__ | |
2097 |
|
2098 | |||
2098 | def linkrev(self): |
|
2099 | def linkrev(self): | |
2099 | # linked to self._changectx no matter if file is modified or not |
|
2100 | # linked to self._changectx no matter if file is modified or not | |
2100 | return self.rev() |
|
2101 | return self.rev() | |
2101 |
|
2102 | |||
2102 | def renamed(self): |
|
2103 | def renamed(self): | |
2103 | path = self.copysource() |
|
2104 | path = self.copysource() | |
2104 | if not path: |
|
2105 | if not path: | |
2105 | return None |
|
2106 | return None | |
2106 | return ( |
|
2107 | return ( | |
2107 | path, |
|
2108 | path, | |
2108 | self._changectx._parents[0]._manifest.get( |
|
2109 | self._changectx._parents[0]._manifest.get( | |
2109 | path, self._repo.nodeconstants.nullid |
|
2110 | path, self._repo.nodeconstants.nullid | |
2110 | ), |
|
2111 | ), | |
2111 | ) |
|
2112 | ) | |
2112 |
|
2113 | |||
2113 | def parents(self): |
|
2114 | def parents(self): | |
2114 | '''return parent filectxs, following copies if necessary''' |
|
2115 | '''return parent filectxs, following copies if necessary''' | |
2115 |
|
2116 | |||
2116 | def filenode(ctx, path): |
|
2117 | def filenode(ctx, path): | |
2117 | return ctx._manifest.get(path, self._repo.nodeconstants.nullid) |
|
2118 | return ctx._manifest.get(path, self._repo.nodeconstants.nullid) | |
2118 |
|
2119 | |||
2119 | path = self._path |
|
2120 | path = self._path | |
2120 | fl = self._filelog |
|
2121 | fl = self._filelog | |
2121 | pcl = self._changectx._parents |
|
2122 | pcl = self._changectx._parents | |
2122 | renamed = self.renamed() |
|
2123 | renamed = self.renamed() | |
2123 |
|
2124 | |||
2124 | if renamed: |
|
2125 | if renamed: | |
2125 | pl = [renamed + (None,)] |
|
2126 | pl = [renamed + (None,)] | |
2126 | else: |
|
2127 | else: | |
2127 | pl = [(path, filenode(pcl[0], path), fl)] |
|
2128 | pl = [(path, filenode(pcl[0], path), fl)] | |
2128 |
|
2129 | |||
2129 | for pc in pcl[1:]: |
|
2130 | for pc in pcl[1:]: | |
2130 | pl.append((path, filenode(pc, path), fl)) |
|
2131 | pl.append((path, filenode(pc, path), fl)) | |
2131 |
|
2132 | |||
2132 | return [ |
|
2133 | return [ | |
2133 | self._parentfilectx(p, fileid=n, filelog=l) |
|
2134 | self._parentfilectx(p, fileid=n, filelog=l) | |
2134 | for p, n, l in pl |
|
2135 | for p, n, l in pl | |
2135 | if n != self._repo.nodeconstants.nullid |
|
2136 | if n != self._repo.nodeconstants.nullid | |
2136 | ] |
|
2137 | ] | |
2137 |
|
2138 | |||
2138 | def children(self): |
|
2139 | def children(self): | |
2139 | return [] |
|
2140 | return [] | |
2140 |
|
2141 | |||
2141 |
|
2142 | |||
2142 | class workingfilectx(committablefilectx): |
|
2143 | class workingfilectx(committablefilectx): | |
2143 | """A workingfilectx object makes access to data related to a particular |
|
2144 | """A workingfilectx object makes access to data related to a particular | |
2144 | file in the working directory convenient.""" |
|
2145 | file in the working directory convenient.""" | |
2145 |
|
2146 | |||
2146 | def __init__(self, repo, path, filelog=None, workingctx=None): |
|
2147 | def __init__(self, repo, path, filelog=None, workingctx=None): | |
2147 | super(workingfilectx, self).__init__(repo, path, filelog, workingctx) |
|
2148 | super(workingfilectx, self).__init__(repo, path, filelog, workingctx) | |
2148 |
|
2149 | |||
2149 | @propertycache |
|
2150 | @propertycache | |
2150 | def _changectx(self): |
|
2151 | def _changectx(self): | |
2151 | return workingctx(self._repo) |
|
2152 | return workingctx(self._repo) | |
2152 |
|
2153 | |||
2153 | def data(self): |
|
2154 | def data(self): | |
2154 | return self._repo.wread(self._path) |
|
2155 | return self._repo.wread(self._path) | |
2155 |
|
2156 | |||
2156 | def copysource(self): |
|
2157 | def copysource(self): | |
2157 | return self._repo.dirstate.copied(self._path) |
|
2158 | return self._repo.dirstate.copied(self._path) | |
2158 |
|
2159 | |||
2159 | def size(self): |
|
2160 | def size(self): | |
2160 | return self._repo.wvfs.lstat(self._path).st_size |
|
2161 | return self._repo.wvfs.lstat(self._path).st_size | |
2161 |
|
2162 | |||
2162 | def lstat(self): |
|
2163 | def lstat(self): | |
2163 | return self._repo.wvfs.lstat(self._path) |
|
2164 | return self._repo.wvfs.lstat(self._path) | |
2164 |
|
2165 | |||
2165 | def date(self): |
|
2166 | def date(self): | |
2166 | t, tz = self._changectx.date() |
|
2167 | t, tz = self._changectx.date() | |
2167 | try: |
|
2168 | try: | |
2168 | return (self._repo.wvfs.lstat(self._path)[stat.ST_MTIME], tz) |
|
2169 | return (self._repo.wvfs.lstat(self._path)[stat.ST_MTIME], tz) | |
2169 | except FileNotFoundError: |
|
2170 | except FileNotFoundError: | |
2170 | return (t, tz) |
|
2171 | return (t, tz) | |
2171 |
|
2172 | |||
2172 | def exists(self): |
|
2173 | def exists(self): | |
2173 | return self._repo.wvfs.exists(self._path) |
|
2174 | return self._repo.wvfs.exists(self._path) | |
2174 |
|
2175 | |||
2175 | def lexists(self): |
|
2176 | def lexists(self): | |
2176 | return self._repo.wvfs.lexists(self._path) |
|
2177 | return self._repo.wvfs.lexists(self._path) | |
2177 |
|
2178 | |||
2178 | def audit(self): |
|
2179 | def audit(self): | |
2179 | return self._repo.wvfs.audit(self._path) |
|
2180 | return self._repo.wvfs.audit(self._path) | |
2180 |
|
2181 | |||
2181 | def cmp(self, fctx): |
|
2182 | def cmp(self, fctx): | |
2182 | """compare with other file context |
|
2183 | """compare with other file context | |
2183 |
|
2184 | |||
2184 | returns True if different than fctx. |
|
2185 | returns True if different than fctx. | |
2185 | """ |
|
2186 | """ | |
2186 | # fctx should be a filectx (not a workingfilectx) |
|
2187 | # fctx should be a filectx (not a workingfilectx) | |
2187 | # invert comparison to reuse the same code path |
|
2188 | # invert comparison to reuse the same code path | |
2188 | return fctx.cmp(self) |
|
2189 | return fctx.cmp(self) | |
2189 |
|
2190 | |||
2190 | def remove(self, ignoremissing=False): |
|
2191 | def remove(self, ignoremissing=False): | |
2191 | """wraps unlink for a repo's working directory""" |
|
2192 | """wraps unlink for a repo's working directory""" | |
2192 | rmdir = self._repo.ui.configbool(b'experimental', b'removeemptydirs') |
|
2193 | rmdir = self._repo.ui.configbool(b'experimental', b'removeemptydirs') | |
2193 | self._repo.wvfs.unlinkpath( |
|
2194 | self._repo.wvfs.unlinkpath( | |
2194 | self._path, ignoremissing=ignoremissing, rmdir=rmdir |
|
2195 | self._path, ignoremissing=ignoremissing, rmdir=rmdir | |
2195 | ) |
|
2196 | ) | |
2196 |
|
2197 | |||
2197 | def write(self, data, flags, backgroundclose=False, **kwargs): |
|
2198 | def write(self, data, flags, backgroundclose=False, **kwargs): | |
2198 | """wraps repo.wwrite""" |
|
2199 | """wraps repo.wwrite""" | |
2199 | return self._repo.wwrite( |
|
2200 | return self._repo.wwrite( | |
2200 | self._path, data, flags, backgroundclose=backgroundclose, **kwargs |
|
2201 | self._path, data, flags, backgroundclose=backgroundclose, **kwargs | |
2201 | ) |
|
2202 | ) | |
2202 |
|
2203 | |||
2203 | def markcopied(self, src): |
|
2204 | def markcopied(self, src): | |
2204 | """marks this file a copy of `src`""" |
|
2205 | """marks this file a copy of `src`""" | |
2205 | self._repo.dirstate.copy(src, self._path) |
|
2206 | self._repo.dirstate.copy(src, self._path) | |
2206 |
|
2207 | |||
2207 | def clearunknown(self): |
|
2208 | def clearunknown(self): | |
2208 | """Removes conflicting items in the working directory so that |
|
2209 | """Removes conflicting items in the working directory so that | |
2209 | ``write()`` can be called successfully. |
|
2210 | ``write()`` can be called successfully. | |
2210 | """ |
|
2211 | """ | |
2211 | wvfs = self._repo.wvfs |
|
2212 | wvfs = self._repo.wvfs | |
2212 | f = self._path |
|
2213 | f = self._path | |
2213 | wvfs.audit(f) |
|
2214 | wvfs.audit(f) | |
2214 | if self._repo.ui.configbool( |
|
2215 | if self._repo.ui.configbool( | |
2215 | b'experimental', b'merge.checkpathconflicts' |
|
2216 | b'experimental', b'merge.checkpathconflicts' | |
2216 | ): |
|
2217 | ): | |
2217 | # remove files under the directory as they should already be |
|
2218 | # remove files under the directory as they should already be | |
2218 | # warned and backed up |
|
2219 | # warned and backed up | |
2219 | if wvfs.isdir(f) and not wvfs.islink(f): |
|
2220 | if wvfs.isdir(f) and not wvfs.islink(f): | |
2220 | wvfs.rmtree(f, forcibly=True) |
|
2221 | wvfs.rmtree(f, forcibly=True) | |
2221 | for p in reversed(list(pathutil.finddirs(f))): |
|
2222 | for p in reversed(list(pathutil.finddirs(f))): | |
2222 | if wvfs.isfileorlink(p): |
|
2223 | if wvfs.isfileorlink(p): | |
2223 | wvfs.unlink(p) |
|
2224 | wvfs.unlink(p) | |
2224 | break |
|
2225 | break | |
2225 | else: |
|
2226 | else: | |
2226 | # don't remove files if path conflicts are not processed |
|
2227 | # don't remove files if path conflicts are not processed | |
2227 | if wvfs.isdir(f) and not wvfs.islink(f): |
|
2228 | if wvfs.isdir(f) and not wvfs.islink(f): | |
2228 | wvfs.removedirs(f) |
|
2229 | wvfs.removedirs(f) | |
2229 |
|
2230 | |||
2230 | def setflags(self, l, x): |
|
2231 | def setflags(self, l, x): | |
2231 | self._repo.wvfs.setflags(self._path, l, x) |
|
2232 | self._repo.wvfs.setflags(self._path, l, x) | |
2232 |
|
2233 | |||
2233 |
|
2234 | |||
2234 | class overlayworkingctx(committablectx): |
|
2235 | class overlayworkingctx(committablectx): | |
2235 | """Wraps another mutable context with a write-back cache that can be |
|
2236 | """Wraps another mutable context with a write-back cache that can be | |
2236 | converted into a commit context. |
|
2237 | converted into a commit context. | |
2237 |
|
2238 | |||
2238 | self._cache[path] maps to a dict with keys: { |
|
2239 | self._cache[path] maps to a dict with keys: { | |
2239 | 'exists': bool? |
|
2240 | 'exists': bool? | |
2240 | 'date': date? |
|
2241 | 'date': date? | |
2241 | 'data': str? |
|
2242 | 'data': str? | |
2242 | 'flags': str? |
|
2243 | 'flags': str? | |
2243 | 'copied': str? (path or None) |
|
2244 | 'copied': str? (path or None) | |
2244 | } |
|
2245 | } | |
2245 | If `exists` is True, `flags` must be non-None and 'date' is non-None. If it |
|
2246 | If `exists` is True, `flags` must be non-None and 'date' is non-None. If it | |
2246 | is `False`, the file was deleted. |
|
2247 | is `False`, the file was deleted. | |
2247 | """ |
|
2248 | """ | |
2248 |
|
2249 | |||
2249 | def __init__(self, repo): |
|
2250 | def __init__(self, repo): | |
2250 | super(overlayworkingctx, self).__init__(repo) |
|
2251 | super(overlayworkingctx, self).__init__(repo) | |
2251 | self.clean() |
|
2252 | self.clean() | |
2252 |
|
2253 | |||
2253 | def setbase(self, wrappedctx): |
|
2254 | def setbase(self, wrappedctx): | |
2254 | self._wrappedctx = wrappedctx |
|
2255 | self._wrappedctx = wrappedctx | |
2255 | self._parents = [wrappedctx] |
|
2256 | self._parents = [wrappedctx] | |
2256 | # Drop old manifest cache as it is now out of date. |
|
2257 | # Drop old manifest cache as it is now out of date. | |
2257 | # This is necessary when, e.g., rebasing several nodes with one |
|
2258 | # This is necessary when, e.g., rebasing several nodes with one | |
2258 | # ``overlayworkingctx`` (e.g. with --collapse). |
|
2259 | # ``overlayworkingctx`` (e.g. with --collapse). | |
2259 | util.clearcachedproperty(self, b'_manifest') |
|
2260 | util.clearcachedproperty(self, b'_manifest') | |
2260 |
|
2261 | |||
2261 | def setparents(self, p1node, p2node=None): |
|
2262 | def setparents(self, p1node, p2node=None): | |
2262 | if p2node is None: |
|
2263 | if p2node is None: | |
2263 | p2node = self._repo.nodeconstants.nullid |
|
2264 | p2node = self._repo.nodeconstants.nullid | |
2264 | assert p1node == self._wrappedctx.node() |
|
2265 | assert p1node == self._wrappedctx.node() | |
2265 | self._parents = [self._wrappedctx, self._repo.unfiltered()[p2node]] |
|
2266 | self._parents = [self._wrappedctx, self._repo.unfiltered()[p2node]] | |
2266 |
|
2267 | |||
2267 | def data(self, path): |
|
2268 | def data(self, path): | |
2268 | if self.isdirty(path): |
|
2269 | if self.isdirty(path): | |
2269 | if self._cache[path][b'exists']: |
|
2270 | if self._cache[path][b'exists']: | |
2270 | if self._cache[path][b'data'] is not None: |
|
2271 | if self._cache[path][b'data'] is not None: | |
2271 | return self._cache[path][b'data'] |
|
2272 | return self._cache[path][b'data'] | |
2272 | else: |
|
2273 | else: | |
2273 | # Must fallback here, too, because we only set flags. |
|
2274 | # Must fallback here, too, because we only set flags. | |
2274 | return self._wrappedctx[path].data() |
|
2275 | return self._wrappedctx[path].data() | |
2275 | else: |
|
2276 | else: | |
2276 | raise error.ProgrammingError( |
|
2277 | raise error.ProgrammingError( | |
2277 | b"No such file or directory: %s" % path |
|
2278 | b"No such file or directory: %s" % path | |
2278 | ) |
|
2279 | ) | |
2279 | else: |
|
2280 | else: | |
2280 | return self._wrappedctx[path].data() |
|
2281 | return self._wrappedctx[path].data() | |
2281 |
|
2282 | |||
2282 | @propertycache |
|
2283 | @propertycache | |
2283 | def _manifest(self): |
|
2284 | def _manifest(self): | |
2284 | parents = self.parents() |
|
2285 | parents = self.parents() | |
2285 | man = parents[0].manifest().copy() |
|
2286 | man = parents[0].manifest().copy() | |
2286 |
|
2287 | |||
2287 | flag = self._flagfunc |
|
2288 | flag = self._flagfunc | |
2288 | for path in self.added(): |
|
2289 | for path in self.added(): | |
2289 | man[path] = self._repo.nodeconstants.addednodeid |
|
2290 | man[path] = self._repo.nodeconstants.addednodeid | |
2290 | man.setflag(path, flag(path)) |
|
2291 | man.setflag(path, flag(path)) | |
2291 | for path in self.modified(): |
|
2292 | for path in self.modified(): | |
2292 | man[path] = self._repo.nodeconstants.modifiednodeid |
|
2293 | man[path] = self._repo.nodeconstants.modifiednodeid | |
2293 | man.setflag(path, flag(path)) |
|
2294 | man.setflag(path, flag(path)) | |
2294 | for path in self.removed(): |
|
2295 | for path in self.removed(): | |
2295 | del man[path] |
|
2296 | del man[path] | |
2296 | return man |
|
2297 | return man | |
2297 |
|
2298 | |||
2298 | @propertycache |
|
2299 | @propertycache | |
2299 | def _flagfunc(self): |
|
2300 | def _flagfunc(self): | |
2300 | def f(path): |
|
2301 | def f(path): | |
2301 | return self._cache[path][b'flags'] |
|
2302 | return self._cache[path][b'flags'] | |
2302 |
|
2303 | |||
2303 | return f |
|
2304 | return f | |
2304 |
|
2305 | |||
2305 | def files(self): |
|
2306 | def files(self): | |
2306 | return sorted(self.added() + self.modified() + self.removed()) |
|
2307 | return sorted(self.added() + self.modified() + self.removed()) | |
2307 |
|
2308 | |||
2308 | def modified(self): |
|
2309 | def modified(self): | |
2309 | return [ |
|
2310 | return [ | |
2310 | f |
|
2311 | f | |
2311 | for f in self._cache.keys() |
|
2312 | for f in self._cache.keys() | |
2312 | if self._cache[f][b'exists'] and self._existsinparent(f) |
|
2313 | if self._cache[f][b'exists'] and self._existsinparent(f) | |
2313 | ] |
|
2314 | ] | |
2314 |
|
2315 | |||
2315 | def added(self): |
|
2316 | def added(self): | |
2316 | return [ |
|
2317 | return [ | |
2317 | f |
|
2318 | f | |
2318 | for f in self._cache.keys() |
|
2319 | for f in self._cache.keys() | |
2319 | if self._cache[f][b'exists'] and not self._existsinparent(f) |
|
2320 | if self._cache[f][b'exists'] and not self._existsinparent(f) | |
2320 | ] |
|
2321 | ] | |
2321 |
|
2322 | |||
2322 | def removed(self): |
|
2323 | def removed(self): | |
2323 | return [ |
|
2324 | return [ | |
2324 | f |
|
2325 | f | |
2325 | for f in self._cache.keys() |
|
2326 | for f in self._cache.keys() | |
2326 | if not self._cache[f][b'exists'] and self._existsinparent(f) |
|
2327 | if not self._cache[f][b'exists'] and self._existsinparent(f) | |
2327 | ] |
|
2328 | ] | |
2328 |
|
2329 | |||
2329 | def p1copies(self): |
|
2330 | def p1copies(self): | |
2330 | copies = {} |
|
2331 | copies = {} | |
2331 | narrowmatch = self._repo.narrowmatch() |
|
2332 | narrowmatch = self._repo.narrowmatch() | |
2332 | for f in self._cache.keys(): |
|
2333 | for f in self._cache.keys(): | |
2333 | if not narrowmatch(f): |
|
2334 | if not narrowmatch(f): | |
2334 | continue |
|
2335 | continue | |
2335 | copies.pop(f, None) # delete if it exists |
|
2336 | copies.pop(f, None) # delete if it exists | |
2336 | source = self._cache[f][b'copied'] |
|
2337 | source = self._cache[f][b'copied'] | |
2337 | if source: |
|
2338 | if source: | |
2338 | copies[f] = source |
|
2339 | copies[f] = source | |
2339 | return copies |
|
2340 | return copies | |
2340 |
|
2341 | |||
2341 | def p2copies(self): |
|
2342 | def p2copies(self): | |
2342 | copies = {} |
|
2343 | copies = {} | |
2343 | narrowmatch = self._repo.narrowmatch() |
|
2344 | narrowmatch = self._repo.narrowmatch() | |
2344 | for f in self._cache.keys(): |
|
2345 | for f in self._cache.keys(): | |
2345 | if not narrowmatch(f): |
|
2346 | if not narrowmatch(f): | |
2346 | continue |
|
2347 | continue | |
2347 | copies.pop(f, None) # delete if it exists |
|
2348 | copies.pop(f, None) # delete if it exists | |
2348 | source = self._cache[f][b'copied'] |
|
2349 | source = self._cache[f][b'copied'] | |
2349 | if source: |
|
2350 | if source: | |
2350 | copies[f] = source |
|
2351 | copies[f] = source | |
2351 | return copies |
|
2352 | return copies | |
2352 |
|
2353 | |||
2353 | def isinmemory(self): |
|
2354 | def isinmemory(self): | |
2354 | return True |
|
2355 | return True | |
2355 |
|
2356 | |||
2356 | def filedate(self, path): |
|
2357 | def filedate(self, path): | |
2357 | if self.isdirty(path): |
|
2358 | if self.isdirty(path): | |
2358 | return self._cache[path][b'date'] |
|
2359 | return self._cache[path][b'date'] | |
2359 | else: |
|
2360 | else: | |
2360 | return self._wrappedctx[path].date() |
|
2361 | return self._wrappedctx[path].date() | |
2361 |
|
2362 | |||
2362 | def markcopied(self, path, origin): |
|
2363 | def markcopied(self, path, origin): | |
2363 | self._markdirty( |
|
2364 | self._markdirty( | |
2364 | path, |
|
2365 | path, | |
2365 | exists=True, |
|
2366 | exists=True, | |
2366 | date=self.filedate(path), |
|
2367 | date=self.filedate(path), | |
2367 | flags=self.flags(path), |
|
2368 | flags=self.flags(path), | |
2368 | copied=origin, |
|
2369 | copied=origin, | |
2369 | ) |
|
2370 | ) | |
2370 |
|
2371 | |||
2371 | def copydata(self, path): |
|
2372 | def copydata(self, path): | |
2372 | if self.isdirty(path): |
|
2373 | if self.isdirty(path): | |
2373 | return self._cache[path][b'copied'] |
|
2374 | return self._cache[path][b'copied'] | |
2374 | else: |
|
2375 | else: | |
2375 | return None |
|
2376 | return None | |
2376 |
|
2377 | |||
2377 | def flags(self, path): |
|
2378 | def flags(self, path): | |
2378 | if self.isdirty(path): |
|
2379 | if self.isdirty(path): | |
2379 | if self._cache[path][b'exists']: |
|
2380 | if self._cache[path][b'exists']: | |
2380 | return self._cache[path][b'flags'] |
|
2381 | return self._cache[path][b'flags'] | |
2381 | else: |
|
2382 | else: | |
2382 | raise error.ProgrammingError( |
|
2383 | raise error.ProgrammingError( | |
2383 | b"No such file or directory: %s" % path |
|
2384 | b"No such file or directory: %s" % path | |
2384 | ) |
|
2385 | ) | |
2385 | else: |
|
2386 | else: | |
2386 | return self._wrappedctx[path].flags() |
|
2387 | return self._wrappedctx[path].flags() | |
2387 |
|
2388 | |||
2388 | def __contains__(self, key): |
|
2389 | def __contains__(self, key): | |
2389 | if key in self._cache: |
|
2390 | if key in self._cache: | |
2390 | return self._cache[key][b'exists'] |
|
2391 | return self._cache[key][b'exists'] | |
2391 | return key in self.p1() |
|
2392 | return key in self.p1() | |
2392 |
|
2393 | |||
2393 | def _existsinparent(self, path): |
|
2394 | def _existsinparent(self, path): | |
2394 | try: |
|
2395 | try: | |
2395 | # ``commitctx` raises a ``ManifestLookupError`` if a path does not |
|
2396 | # ``commitctx` raises a ``ManifestLookupError`` if a path does not | |
2396 | # exist, unlike ``workingctx``, which returns a ``workingfilectx`` |
|
2397 | # exist, unlike ``workingctx``, which returns a ``workingfilectx`` | |
2397 | # with an ``exists()`` function. |
|
2398 | # with an ``exists()`` function. | |
2398 | self._wrappedctx[path] |
|
2399 | self._wrappedctx[path] | |
2399 | return True |
|
2400 | return True | |
2400 | except error.ManifestLookupError: |
|
2401 | except error.ManifestLookupError: | |
2401 | return False |
|
2402 | return False | |
2402 |
|
2403 | |||
2403 | def _auditconflicts(self, path): |
|
2404 | def _auditconflicts(self, path): | |
2404 | """Replicates conflict checks done by wvfs.write(). |
|
2405 | """Replicates conflict checks done by wvfs.write(). | |
2405 |
|
2406 | |||
2406 | Since we never write to the filesystem and never call `applyupdates` in |
|
2407 | Since we never write to the filesystem and never call `applyupdates` in | |
2407 | IMM, we'll never check that a path is actually writable -- e.g., because |
|
2408 | IMM, we'll never check that a path is actually writable -- e.g., because | |
2408 | it adds `a/foo`, but `a` is actually a file in the other commit. |
|
2409 | it adds `a/foo`, but `a` is actually a file in the other commit. | |
2409 | """ |
|
2410 | """ | |
2410 |
|
2411 | |||
2411 | def fail(path, component): |
|
2412 | def fail(path, component): | |
2412 | # p1() is the base and we're receiving "writes" for p2()'s |
|
2413 | # p1() is the base and we're receiving "writes" for p2()'s | |
2413 | # files. |
|
2414 | # files. | |
2414 | if b'l' in self.p1()[component].flags(): |
|
2415 | if b'l' in self.p1()[component].flags(): | |
2415 | raise error.Abort( |
|
2416 | raise error.Abort( | |
2416 | b"error: %s conflicts with symlink %s " |
|
2417 | b"error: %s conflicts with symlink %s " | |
2417 | b"in %d." % (path, component, self.p1().rev()) |
|
2418 | b"in %d." % (path, component, self.p1().rev()) | |
2418 | ) |
|
2419 | ) | |
2419 | else: |
|
2420 | else: | |
2420 | raise error.Abort( |
|
2421 | raise error.Abort( | |
2421 | b"error: '%s' conflicts with file '%s' in " |
|
2422 | b"error: '%s' conflicts with file '%s' in " | |
2422 | b"%d." % (path, component, self.p1().rev()) |
|
2423 | b"%d." % (path, component, self.p1().rev()) | |
2423 | ) |
|
2424 | ) | |
2424 |
|
2425 | |||
2425 | # Test that each new directory to be created to write this path from p2 |
|
2426 | # Test that each new directory to be created to write this path from p2 | |
2426 | # is not a file in p1. |
|
2427 | # is not a file in p1. | |
2427 | components = path.split(b'/') |
|
2428 | components = path.split(b'/') | |
2428 | for i in range(len(components)): |
|
2429 | for i in range(len(components)): | |
2429 | component = b"/".join(components[0:i]) |
|
2430 | component = b"/".join(components[0:i]) | |
2430 | if component in self: |
|
2431 | if component in self: | |
2431 | fail(path, component) |
|
2432 | fail(path, component) | |
2432 |
|
2433 | |||
2433 | # Test the other direction -- that this path from p2 isn't a directory |
|
2434 | # Test the other direction -- that this path from p2 isn't a directory | |
2434 | # in p1 (test that p1 doesn't have any paths matching `path/*`). |
|
2435 | # in p1 (test that p1 doesn't have any paths matching `path/*`). | |
2435 | match = self.match([path], default=b'path') |
|
2436 | match = self.match([path], default=b'path') | |
2436 | mfiles = list(self.p1().manifest().walk(match)) |
|
2437 | mfiles = list(self.p1().manifest().walk(match)) | |
2437 | if len(mfiles) > 0: |
|
2438 | if len(mfiles) > 0: | |
2438 | if len(mfiles) == 1 and mfiles[0] == path: |
|
2439 | if len(mfiles) == 1 and mfiles[0] == path: | |
2439 | return |
|
2440 | return | |
2440 | # omit the files which are deleted in current IMM wctx |
|
2441 | # omit the files which are deleted in current IMM wctx | |
2441 | mfiles = [m for m in mfiles if m in self] |
|
2442 | mfiles = [m for m in mfiles if m in self] | |
2442 | if not mfiles: |
|
2443 | if not mfiles: | |
2443 | return |
|
2444 | return | |
2444 | raise error.Abort( |
|
2445 | raise error.Abort( | |
2445 | b"error: file '%s' cannot be written because " |
|
2446 | b"error: file '%s' cannot be written because " | |
2446 | b" '%s/' is a directory in %s (containing %d " |
|
2447 | b" '%s/' is a directory in %s (containing %d " | |
2447 | b"entries: %s)" |
|
2448 | b"entries: %s)" | |
2448 | % (path, path, self.p1(), len(mfiles), b', '.join(mfiles)) |
|
2449 | % (path, path, self.p1(), len(mfiles), b', '.join(mfiles)) | |
2449 | ) |
|
2450 | ) | |
2450 |
|
2451 | |||
2451 | def write(self, path, data, flags=b'', **kwargs): |
|
2452 | def write(self, path, data, flags=b'', **kwargs): | |
2452 | if data is None: |
|
2453 | if data is None: | |
2453 | raise error.ProgrammingError(b"data must be non-None") |
|
2454 | raise error.ProgrammingError(b"data must be non-None") | |
2454 | self._auditconflicts(path) |
|
2455 | self._auditconflicts(path) | |
2455 | self._markdirty( |
|
2456 | self._markdirty( | |
2456 | path, exists=True, data=data, date=dateutil.makedate(), flags=flags |
|
2457 | path, exists=True, data=data, date=dateutil.makedate(), flags=flags | |
2457 | ) |
|
2458 | ) | |
2458 |
|
2459 | |||
2459 | def setflags(self, path, l, x): |
|
2460 | def setflags(self, path, l, x): | |
2460 | flag = b'' |
|
2461 | flag = b'' | |
2461 | if l: |
|
2462 | if l: | |
2462 | flag = b'l' |
|
2463 | flag = b'l' | |
2463 | elif x: |
|
2464 | elif x: | |
2464 | flag = b'x' |
|
2465 | flag = b'x' | |
2465 | self._markdirty(path, exists=True, date=dateutil.makedate(), flags=flag) |
|
2466 | self._markdirty(path, exists=True, date=dateutil.makedate(), flags=flag) | |
2466 |
|
2467 | |||
2467 | def remove(self, path): |
|
2468 | def remove(self, path): | |
2468 | self._markdirty(path, exists=False) |
|
2469 | self._markdirty(path, exists=False) | |
2469 |
|
2470 | |||
2470 | def exists(self, path): |
|
2471 | def exists(self, path): | |
2471 | """exists behaves like `lexists`, but needs to follow symlinks and |
|
2472 | """exists behaves like `lexists`, but needs to follow symlinks and | |
2472 | return False if they are broken. |
|
2473 | return False if they are broken. | |
2473 | """ |
|
2474 | """ | |
2474 | if self.isdirty(path): |
|
2475 | if self.isdirty(path): | |
2475 | # If this path exists and is a symlink, "follow" it by calling |
|
2476 | # If this path exists and is a symlink, "follow" it by calling | |
2476 | # exists on the destination path. |
|
2477 | # exists on the destination path. | |
2477 | if ( |
|
2478 | if ( | |
2478 | self._cache[path][b'exists'] |
|
2479 | self._cache[path][b'exists'] | |
2479 | and b'l' in self._cache[path][b'flags'] |
|
2480 | and b'l' in self._cache[path][b'flags'] | |
2480 | ): |
|
2481 | ): | |
2481 | return self.exists(self._cache[path][b'data'].strip()) |
|
2482 | return self.exists(self._cache[path][b'data'].strip()) | |
2482 | else: |
|
2483 | else: | |
2483 | return self._cache[path][b'exists'] |
|
2484 | return self._cache[path][b'exists'] | |
2484 |
|
2485 | |||
2485 | return self._existsinparent(path) |
|
2486 | return self._existsinparent(path) | |
2486 |
|
2487 | |||
2487 | def lexists(self, path): |
|
2488 | def lexists(self, path): | |
2488 | """lexists returns True if the path exists""" |
|
2489 | """lexists returns True if the path exists""" | |
2489 | if self.isdirty(path): |
|
2490 | if self.isdirty(path): | |
2490 | return self._cache[path][b'exists'] |
|
2491 | return self._cache[path][b'exists'] | |
2491 |
|
2492 | |||
2492 | return self._existsinparent(path) |
|
2493 | return self._existsinparent(path) | |
2493 |
|
2494 | |||
2494 | def size(self, path): |
|
2495 | def size(self, path): | |
2495 | if self.isdirty(path): |
|
2496 | if self.isdirty(path): | |
2496 | if self._cache[path][b'exists']: |
|
2497 | if self._cache[path][b'exists']: | |
2497 | return len(self._cache[path][b'data']) |
|
2498 | return len(self._cache[path][b'data']) | |
2498 | else: |
|
2499 | else: | |
2499 | raise error.ProgrammingError( |
|
2500 | raise error.ProgrammingError( | |
2500 | b"No such file or directory: %s" % path |
|
2501 | b"No such file or directory: %s" % path | |
2501 | ) |
|
2502 | ) | |
2502 | return self._wrappedctx[path].size() |
|
2503 | return self._wrappedctx[path].size() | |
2503 |
|
2504 | |||
2504 | def tomemctx( |
|
2505 | def tomemctx( | |
2505 | self, |
|
2506 | self, | |
2506 | text, |
|
2507 | text, | |
2507 | branch=None, |
|
2508 | branch=None, | |
2508 | extra=None, |
|
2509 | extra=None, | |
2509 | date=None, |
|
2510 | date=None, | |
2510 | parents=None, |
|
2511 | parents=None, | |
2511 | user=None, |
|
2512 | user=None, | |
2512 | editor=None, |
|
2513 | editor=None, | |
2513 | ): |
|
2514 | ): | |
2514 | """Converts this ``overlayworkingctx`` into a ``memctx`` ready to be |
|
2515 | """Converts this ``overlayworkingctx`` into a ``memctx`` ready to be | |
2515 | committed. |
|
2516 | committed. | |
2516 |
|
2517 | |||
2517 | ``text`` is the commit message. |
|
2518 | ``text`` is the commit message. | |
2518 | ``parents`` (optional) are rev numbers. |
|
2519 | ``parents`` (optional) are rev numbers. | |
2519 | """ |
|
2520 | """ | |
2520 | # Default parents to the wrapped context if not passed. |
|
2521 | # Default parents to the wrapped context if not passed. | |
2521 | if parents is None: |
|
2522 | if parents is None: | |
2522 | parents = self.parents() |
|
2523 | parents = self.parents() | |
2523 | if len(parents) == 1: |
|
2524 | if len(parents) == 1: | |
2524 | parents = (parents[0], None) |
|
2525 | parents = (parents[0], None) | |
2525 |
|
2526 | |||
2526 | # ``parents`` is passed as rev numbers; convert to ``commitctxs``. |
|
2527 | # ``parents`` is passed as rev numbers; convert to ``commitctxs``. | |
2527 | if parents[1] is None: |
|
2528 | if parents[1] is None: | |
2528 | parents = (self._repo[parents[0]], None) |
|
2529 | parents = (self._repo[parents[0]], None) | |
2529 | else: |
|
2530 | else: | |
2530 | parents = (self._repo[parents[0]], self._repo[parents[1]]) |
|
2531 | parents = (self._repo[parents[0]], self._repo[parents[1]]) | |
2531 |
|
2532 | |||
2532 | files = self.files() |
|
2533 | files = self.files() | |
2533 |
|
2534 | |||
2534 | def getfile(repo, memctx, path): |
|
2535 | def getfile(repo, memctx, path): | |
2535 | if self._cache[path][b'exists']: |
|
2536 | if self._cache[path][b'exists']: | |
2536 | return memfilectx( |
|
2537 | return memfilectx( | |
2537 | repo, |
|
2538 | repo, | |
2538 | memctx, |
|
2539 | memctx, | |
2539 | path, |
|
2540 | path, | |
2540 | self._cache[path][b'data'], |
|
2541 | self._cache[path][b'data'], | |
2541 | b'l' in self._cache[path][b'flags'], |
|
2542 | b'l' in self._cache[path][b'flags'], | |
2542 | b'x' in self._cache[path][b'flags'], |
|
2543 | b'x' in self._cache[path][b'flags'], | |
2543 | self._cache[path][b'copied'], |
|
2544 | self._cache[path][b'copied'], | |
2544 | ) |
|
2545 | ) | |
2545 | else: |
|
2546 | else: | |
2546 | # Returning None, but including the path in `files`, is |
|
2547 | # Returning None, but including the path in `files`, is | |
2547 | # necessary for memctx to register a deletion. |
|
2548 | # necessary for memctx to register a deletion. | |
2548 | return None |
|
2549 | return None | |
2549 |
|
2550 | |||
2550 | if branch is None: |
|
2551 | if branch is None: | |
2551 | branch = self._wrappedctx.branch() |
|
2552 | branch = self._wrappedctx.branch() | |
2552 |
|
2553 | |||
2553 | return memctx( |
|
2554 | return memctx( | |
2554 | self._repo, |
|
2555 | self._repo, | |
2555 | parents, |
|
2556 | parents, | |
2556 | text, |
|
2557 | text, | |
2557 | files, |
|
2558 | files, | |
2558 | getfile, |
|
2559 | getfile, | |
2559 | date=date, |
|
2560 | date=date, | |
2560 | extra=extra, |
|
2561 | extra=extra, | |
2561 | user=user, |
|
2562 | user=user, | |
2562 | branch=branch, |
|
2563 | branch=branch, | |
2563 | editor=editor, |
|
2564 | editor=editor, | |
2564 | ) |
|
2565 | ) | |
2565 |
|
2566 | |||
2566 | def tomemctx_for_amend(self, precursor): |
|
2567 | def tomemctx_for_amend(self, precursor): | |
2567 | extra = precursor.extra().copy() |
|
2568 | extra = precursor.extra().copy() | |
2568 | extra[b'amend_source'] = precursor.hex() |
|
2569 | extra[b'amend_source'] = precursor.hex() | |
2569 | return self.tomemctx( |
|
2570 | return self.tomemctx( | |
2570 | text=precursor.description(), |
|
2571 | text=precursor.description(), | |
2571 | branch=precursor.branch(), |
|
2572 | branch=precursor.branch(), | |
2572 | extra=extra, |
|
2573 | extra=extra, | |
2573 | date=precursor.date(), |
|
2574 | date=precursor.date(), | |
2574 | user=precursor.user(), |
|
2575 | user=precursor.user(), | |
2575 | ) |
|
2576 | ) | |
2576 |
|
2577 | |||
2577 | def isdirty(self, path): |
|
2578 | def isdirty(self, path): | |
2578 | return path in self._cache |
|
2579 | return path in self._cache | |
2579 |
|
2580 | |||
2580 | def clean(self): |
|
2581 | def clean(self): | |
2581 | self._mergestate = None |
|
2582 | self._mergestate = None | |
2582 | self._cache = {} |
|
2583 | self._cache = {} | |
2583 |
|
2584 | |||
2584 | def _compact(self): |
|
2585 | def _compact(self): | |
2585 | """Removes keys from the cache that are actually clean, by comparing |
|
2586 | """Removes keys from the cache that are actually clean, by comparing | |
2586 | them with the underlying context. |
|
2587 | them with the underlying context. | |
2587 |
|
2588 | |||
2588 | This can occur during the merge process, e.g. by passing --tool :local |
|
2589 | This can occur during the merge process, e.g. by passing --tool :local | |
2589 | to resolve a conflict. |
|
2590 | to resolve a conflict. | |
2590 | """ |
|
2591 | """ | |
2591 | keys = [] |
|
2592 | keys = [] | |
2592 | # This won't be perfect, but can help performance significantly when |
|
2593 | # This won't be perfect, but can help performance significantly when | |
2593 | # using things like remotefilelog. |
|
2594 | # using things like remotefilelog. | |
2594 | scmutil.prefetchfiles( |
|
2595 | scmutil.prefetchfiles( | |
2595 | self.repo(), |
|
2596 | self.repo(), | |
2596 | [ |
|
2597 | [ | |
2597 | ( |
|
2598 | ( | |
2598 | self.p1().rev(), |
|
2599 | self.p1().rev(), | |
2599 | scmutil.matchfiles(self.repo(), self._cache.keys()), |
|
2600 | scmutil.matchfiles(self.repo(), self._cache.keys()), | |
2600 | ) |
|
2601 | ) | |
2601 | ], |
|
2602 | ], | |
2602 | ) |
|
2603 | ) | |
2603 |
|
2604 | |||
2604 | for path in self._cache.keys(): |
|
2605 | for path in self._cache.keys(): | |
2605 | cache = self._cache[path] |
|
2606 | cache = self._cache[path] | |
2606 | try: |
|
2607 | try: | |
2607 | underlying = self._wrappedctx[path] |
|
2608 | underlying = self._wrappedctx[path] | |
2608 | if ( |
|
2609 | if ( | |
2609 | underlying.data() == cache[b'data'] |
|
2610 | underlying.data() == cache[b'data'] | |
2610 | and underlying.flags() == cache[b'flags'] |
|
2611 | and underlying.flags() == cache[b'flags'] | |
2611 | ): |
|
2612 | ): | |
2612 | keys.append(path) |
|
2613 | keys.append(path) | |
2613 | except error.ManifestLookupError: |
|
2614 | except error.ManifestLookupError: | |
2614 | # Path not in the underlying manifest (created). |
|
2615 | # Path not in the underlying manifest (created). | |
2615 | continue |
|
2616 | continue | |
2616 |
|
2617 | |||
2617 | for path in keys: |
|
2618 | for path in keys: | |
2618 | del self._cache[path] |
|
2619 | del self._cache[path] | |
2619 | return keys |
|
2620 | return keys | |
2620 |
|
2621 | |||
2621 | def _markdirty( |
|
2622 | def _markdirty( | |
2622 | self, path, exists, data=None, date=None, flags=b'', copied=None |
|
2623 | self, path, exists, data=None, date=None, flags=b'', copied=None | |
2623 | ): |
|
2624 | ): | |
2624 | # data not provided, let's see if we already have some; if not, let's |
|
2625 | # data not provided, let's see if we already have some; if not, let's | |
2625 | # grab it from our underlying context, so that we always have data if |
|
2626 | # grab it from our underlying context, so that we always have data if | |
2626 | # the file is marked as existing. |
|
2627 | # the file is marked as existing. | |
2627 | if exists and data is None: |
|
2628 | if exists and data is None: | |
2628 | oldentry = self._cache.get(path) or {} |
|
2629 | oldentry = self._cache.get(path) or {} | |
2629 | data = oldentry.get(b'data') |
|
2630 | data = oldentry.get(b'data') | |
2630 | if data is None: |
|
2631 | if data is None: | |
2631 | data = self._wrappedctx[path].data() |
|
2632 | data = self._wrappedctx[path].data() | |
2632 |
|
2633 | |||
2633 | self._cache[path] = { |
|
2634 | self._cache[path] = { | |
2634 | b'exists': exists, |
|
2635 | b'exists': exists, | |
2635 | b'data': data, |
|
2636 | b'data': data, | |
2636 | b'date': date, |
|
2637 | b'date': date, | |
2637 | b'flags': flags, |
|
2638 | b'flags': flags, | |
2638 | b'copied': copied, |
|
2639 | b'copied': copied, | |
2639 | } |
|
2640 | } | |
2640 | util.clearcachedproperty(self, b'_manifest') |
|
2641 | util.clearcachedproperty(self, b'_manifest') | |
2641 |
|
2642 | |||
2642 | def filectx(self, path, filelog=None): |
|
2643 | def filectx(self, path, filelog=None): | |
2643 | return overlayworkingfilectx( |
|
2644 | return overlayworkingfilectx( | |
2644 | self._repo, path, parent=self, filelog=filelog |
|
2645 | self._repo, path, parent=self, filelog=filelog | |
2645 | ) |
|
2646 | ) | |
2646 |
|
2647 | |||
2647 | def mergestate(self, clean=False): |
|
2648 | def mergestate(self, clean=False): | |
2648 | if clean or self._mergestate is None: |
|
2649 | if clean or self._mergestate is None: | |
2649 | self._mergestate = mergestatemod.memmergestate(self._repo) |
|
2650 | self._mergestate = mergestatemod.memmergestate(self._repo) | |
2650 | return self._mergestate |
|
2651 | return self._mergestate | |
2651 |
|
2652 | |||
2652 |
|
2653 | |||
2653 | class overlayworkingfilectx(committablefilectx): |
|
2654 | class overlayworkingfilectx(committablefilectx): | |
2654 | """Wrap a ``workingfilectx`` but intercepts all writes into an in-memory |
|
2655 | """Wrap a ``workingfilectx`` but intercepts all writes into an in-memory | |
2655 | cache, which can be flushed through later by calling ``flush()``.""" |
|
2656 | cache, which can be flushed through later by calling ``flush()``.""" | |
2656 |
|
2657 | |||
2657 | def __init__(self, repo, path, filelog=None, parent=None): |
|
2658 | def __init__(self, repo, path, filelog=None, parent=None): | |
2658 | super(overlayworkingfilectx, self).__init__(repo, path, filelog, parent) |
|
2659 | super(overlayworkingfilectx, self).__init__(repo, path, filelog, parent) | |
2659 | self._repo = repo |
|
2660 | self._repo = repo | |
2660 | self._parent = parent |
|
2661 | self._parent = parent | |
2661 | self._path = path |
|
2662 | self._path = path | |
2662 |
|
2663 | |||
2663 | def cmp(self, fctx): |
|
2664 | def cmp(self, fctx): | |
2664 | return self.data() != fctx.data() |
|
2665 | return self.data() != fctx.data() | |
2665 |
|
2666 | |||
2666 | def changectx(self): |
|
2667 | def changectx(self): | |
2667 | return self._parent |
|
2668 | return self._parent | |
2668 |
|
2669 | |||
2669 | def data(self): |
|
2670 | def data(self): | |
2670 | return self._parent.data(self._path) |
|
2671 | return self._parent.data(self._path) | |
2671 |
|
2672 | |||
2672 | def date(self): |
|
2673 | def date(self): | |
2673 | return self._parent.filedate(self._path) |
|
2674 | return self._parent.filedate(self._path) | |
2674 |
|
2675 | |||
2675 | def exists(self): |
|
2676 | def exists(self): | |
2676 | return self.lexists() |
|
2677 | return self.lexists() | |
2677 |
|
2678 | |||
2678 | def lexists(self): |
|
2679 | def lexists(self): | |
2679 | return self._parent.exists(self._path) |
|
2680 | return self._parent.exists(self._path) | |
2680 |
|
2681 | |||
2681 | def copysource(self): |
|
2682 | def copysource(self): | |
2682 | return self._parent.copydata(self._path) |
|
2683 | return self._parent.copydata(self._path) | |
2683 |
|
2684 | |||
2684 | def size(self): |
|
2685 | def size(self): | |
2685 | return self._parent.size(self._path) |
|
2686 | return self._parent.size(self._path) | |
2686 |
|
2687 | |||
2687 | def markcopied(self, origin): |
|
2688 | def markcopied(self, origin): | |
2688 | self._parent.markcopied(self._path, origin) |
|
2689 | self._parent.markcopied(self._path, origin) | |
2689 |
|
2690 | |||
2690 | def audit(self): |
|
2691 | def audit(self): | |
2691 | pass |
|
2692 | pass | |
2692 |
|
2693 | |||
2693 | def flags(self): |
|
2694 | def flags(self): | |
2694 | return self._parent.flags(self._path) |
|
2695 | return self._parent.flags(self._path) | |
2695 |
|
2696 | |||
2696 | def setflags(self, islink, isexec): |
|
2697 | def setflags(self, islink, isexec): | |
2697 | return self._parent.setflags(self._path, islink, isexec) |
|
2698 | return self._parent.setflags(self._path, islink, isexec) | |
2698 |
|
2699 | |||
2699 | def write(self, data, flags, backgroundclose=False, **kwargs): |
|
2700 | def write(self, data, flags, backgroundclose=False, **kwargs): | |
2700 | return self._parent.write(self._path, data, flags, **kwargs) |
|
2701 | return self._parent.write(self._path, data, flags, **kwargs) | |
2701 |
|
2702 | |||
2702 | def remove(self, ignoremissing=False): |
|
2703 | def remove(self, ignoremissing=False): | |
2703 | return self._parent.remove(self._path) |
|
2704 | return self._parent.remove(self._path) | |
2704 |
|
2705 | |||
2705 | def clearunknown(self): |
|
2706 | def clearunknown(self): | |
2706 | pass |
|
2707 | pass | |
2707 |
|
2708 | |||
2708 |
|
2709 | |||
2709 | class workingcommitctx(workingctx): |
|
2710 | class workingcommitctx(workingctx): | |
2710 | """A workingcommitctx object makes access to data related to |
|
2711 | """A workingcommitctx object makes access to data related to | |
2711 | the revision being committed convenient. |
|
2712 | the revision being committed convenient. | |
2712 |
|
2713 | |||
2713 | This hides changes in the working directory, if they aren't |
|
2714 | This hides changes in the working directory, if they aren't | |
2714 | committed in this context. |
|
2715 | committed in this context. | |
2715 | """ |
|
2716 | """ | |
2716 |
|
2717 | |||
2717 | def __init__( |
|
2718 | def __init__( | |
2718 | self, repo, changes, text=b"", user=None, date=None, extra=None |
|
2719 | self, repo, changes, text=b"", user=None, date=None, extra=None | |
2719 | ): |
|
2720 | ): | |
2720 | super(workingcommitctx, self).__init__( |
|
2721 | super(workingcommitctx, self).__init__( | |
2721 | repo, text, user, date, extra, changes |
|
2722 | repo, text, user, date, extra, changes | |
2722 | ) |
|
2723 | ) | |
2723 |
|
2724 | |||
2724 | def _dirstatestatus(self, match, ignored=False, clean=False, unknown=False): |
|
2725 | def _dirstatestatus(self, match, ignored=False, clean=False, unknown=False): | |
2725 | """Return matched files only in ``self._status`` |
|
2726 | """Return matched files only in ``self._status`` | |
2726 |
|
2727 | |||
2727 | Uncommitted files appear "clean" via this context, even if |
|
2728 | Uncommitted files appear "clean" via this context, even if | |
2728 | they aren't actually so in the working directory. |
|
2729 | they aren't actually so in the working directory. | |
2729 | """ |
|
2730 | """ | |
2730 | if clean: |
|
2731 | if clean: | |
2731 | clean = [f for f in self._manifest if f not in self._changedset] |
|
2732 | clean = [f for f in self._manifest if f not in self._changedset] | |
2732 | else: |
|
2733 | else: | |
2733 | clean = [] |
|
2734 | clean = [] | |
2734 | return scmutil.status( |
|
2735 | return scmutil.status( | |
2735 | [f for f in self._status.modified if match(f)], |
|
2736 | [f for f in self._status.modified if match(f)], | |
2736 | [f for f in self._status.added if match(f)], |
|
2737 | [f for f in self._status.added if match(f)], | |
2737 | [f for f in self._status.removed if match(f)], |
|
2738 | [f for f in self._status.removed if match(f)], | |
2738 | [], |
|
2739 | [], | |
2739 | [], |
|
2740 | [], | |
2740 | [], |
|
2741 | [], | |
2741 | clean, |
|
2742 | clean, | |
2742 | ) |
|
2743 | ) | |
2743 |
|
2744 | |||
2744 | @propertycache |
|
2745 | @propertycache | |
2745 | def _changedset(self): |
|
2746 | def _changedset(self): | |
2746 | """Return the set of files changed in this context""" |
|
2747 | """Return the set of files changed in this context""" | |
2747 | changed = set(self._status.modified) |
|
2748 | changed = set(self._status.modified) | |
2748 | changed.update(self._status.added) |
|
2749 | changed.update(self._status.added) | |
2749 | changed.update(self._status.removed) |
|
2750 | changed.update(self._status.removed) | |
2750 | return changed |
|
2751 | return changed | |
2751 |
|
2752 | |||
2752 |
|
2753 | |||
2753 | def makecachingfilectxfn(func): |
|
2754 | def makecachingfilectxfn(func): | |
2754 | """Create a filectxfn that caches based on the path. |
|
2755 | """Create a filectxfn that caches based on the path. | |
2755 |
|
2756 | |||
2756 | We can't use util.cachefunc because it uses all arguments as the cache |
|
2757 | We can't use util.cachefunc because it uses all arguments as the cache | |
2757 | key and this creates a cycle since the arguments include the repo and |
|
2758 | key and this creates a cycle since the arguments include the repo and | |
2758 | memctx. |
|
2759 | memctx. | |
2759 | """ |
|
2760 | """ | |
2760 | cache = {} |
|
2761 | cache = {} | |
2761 |
|
2762 | |||
2762 | def getfilectx(repo, memctx, path): |
|
2763 | def getfilectx(repo, memctx, path): | |
2763 | if path not in cache: |
|
2764 | if path not in cache: | |
2764 | cache[path] = func(repo, memctx, path) |
|
2765 | cache[path] = func(repo, memctx, path) | |
2765 | return cache[path] |
|
2766 | return cache[path] | |
2766 |
|
2767 | |||
2767 | return getfilectx |
|
2768 | return getfilectx | |
2768 |
|
2769 | |||
2769 |
|
2770 | |||
2770 | def memfilefromctx(ctx): |
|
2771 | def memfilefromctx(ctx): | |
2771 | """Given a context return a memfilectx for ctx[path] |
|
2772 | """Given a context return a memfilectx for ctx[path] | |
2772 |
|
2773 | |||
2773 | This is a convenience method for building a memctx based on another |
|
2774 | This is a convenience method for building a memctx based on another | |
2774 | context. |
|
2775 | context. | |
2775 | """ |
|
2776 | """ | |
2776 |
|
2777 | |||
2777 | def getfilectx(repo, memctx, path): |
|
2778 | def getfilectx(repo, memctx, path): | |
2778 | fctx = ctx[path] |
|
2779 | fctx = ctx[path] | |
2779 | copysource = fctx.copysource() |
|
2780 | copysource = fctx.copysource() | |
2780 | return memfilectx( |
|
2781 | return memfilectx( | |
2781 | repo, |
|
2782 | repo, | |
2782 | memctx, |
|
2783 | memctx, | |
2783 | path, |
|
2784 | path, | |
2784 | fctx.data(), |
|
2785 | fctx.data(), | |
2785 | islink=fctx.islink(), |
|
2786 | islink=fctx.islink(), | |
2786 | isexec=fctx.isexec(), |
|
2787 | isexec=fctx.isexec(), | |
2787 | copysource=copysource, |
|
2788 | copysource=copysource, | |
2788 | ) |
|
2789 | ) | |
2789 |
|
2790 | |||
2790 | return getfilectx |
|
2791 | return getfilectx | |
2791 |
|
2792 | |||
2792 |
|
2793 | |||
2793 | def memfilefrompatch(patchstore): |
|
2794 | def memfilefrompatch(patchstore): | |
2794 | """Given a patch (e.g. patchstore object) return a memfilectx |
|
2795 | """Given a patch (e.g. patchstore object) return a memfilectx | |
2795 |
|
2796 | |||
2796 | This is a convenience method for building a memctx based on a patchstore. |
|
2797 | This is a convenience method for building a memctx based on a patchstore. | |
2797 | """ |
|
2798 | """ | |
2798 |
|
2799 | |||
2799 | def getfilectx(repo, memctx, path): |
|
2800 | def getfilectx(repo, memctx, path): | |
2800 | data, mode, copysource = patchstore.getfile(path) |
|
2801 | data, mode, copysource = patchstore.getfile(path) | |
2801 | if data is None: |
|
2802 | if data is None: | |
2802 | return None |
|
2803 | return None | |
2803 | islink, isexec = mode |
|
2804 | islink, isexec = mode | |
2804 | return memfilectx( |
|
2805 | return memfilectx( | |
2805 | repo, |
|
2806 | repo, | |
2806 | memctx, |
|
2807 | memctx, | |
2807 | path, |
|
2808 | path, | |
2808 | data, |
|
2809 | data, | |
2809 | islink=islink, |
|
2810 | islink=islink, | |
2810 | isexec=isexec, |
|
2811 | isexec=isexec, | |
2811 | copysource=copysource, |
|
2812 | copysource=copysource, | |
2812 | ) |
|
2813 | ) | |
2813 |
|
2814 | |||
2814 | return getfilectx |
|
2815 | return getfilectx | |
2815 |
|
2816 | |||
2816 |
|
2817 | |||
2817 | class memctx(committablectx): |
|
2818 | class memctx(committablectx): | |
2818 | """Use memctx to perform in-memory commits via localrepo.commitctx(). |
|
2819 | """Use memctx to perform in-memory commits via localrepo.commitctx(). | |
2819 |
|
2820 | |||
2820 | Revision information is supplied at initialization time while |
|
2821 | Revision information is supplied at initialization time while | |
2821 | related files data and is made available through a callback |
|
2822 | related files data and is made available through a callback | |
2822 | mechanism. 'repo' is the current localrepo, 'parents' is a |
|
2823 | mechanism. 'repo' is the current localrepo, 'parents' is a | |
2823 | sequence of two parent revisions identifiers (pass None for every |
|
2824 | sequence of two parent revisions identifiers (pass None for every | |
2824 | missing parent), 'text' is the commit message and 'files' lists |
|
2825 | missing parent), 'text' is the commit message and 'files' lists | |
2825 | names of files touched by the revision (normalized and relative to |
|
2826 | names of files touched by the revision (normalized and relative to | |
2826 | repository root). |
|
2827 | repository root). | |
2827 |
|
2828 | |||
2828 | filectxfn(repo, memctx, path) is a callable receiving the |
|
2829 | filectxfn(repo, memctx, path) is a callable receiving the | |
2829 | repository, the current memctx object and the normalized path of |
|
2830 | repository, the current memctx object and the normalized path of | |
2830 | requested file, relative to repository root. It is fired by the |
|
2831 | requested file, relative to repository root. It is fired by the | |
2831 | commit function for every file in 'files', but calls order is |
|
2832 | commit function for every file in 'files', but calls order is | |
2832 | undefined. If the file is available in the revision being |
|
2833 | undefined. If the file is available in the revision being | |
2833 | committed (updated or added), filectxfn returns a memfilectx |
|
2834 | committed (updated or added), filectxfn returns a memfilectx | |
2834 | object. If the file was removed, filectxfn return None for recent |
|
2835 | object. If the file was removed, filectxfn return None for recent | |
2835 | Mercurial. Moved files are represented by marking the source file |
|
2836 | Mercurial. Moved files are represented by marking the source file | |
2836 | removed and the new file added with copy information (see |
|
2837 | removed and the new file added with copy information (see | |
2837 | memfilectx). |
|
2838 | memfilectx). | |
2838 |
|
2839 | |||
2839 | user receives the committer name and defaults to current |
|
2840 | user receives the committer name and defaults to current | |
2840 | repository username, date is the commit date in any format |
|
2841 | repository username, date is the commit date in any format | |
2841 | supported by dateutil.parsedate() and defaults to current date, extra |
|
2842 | supported by dateutil.parsedate() and defaults to current date, extra | |
2842 | is a dictionary of metadata or is left empty. |
|
2843 | is a dictionary of metadata or is left empty. | |
2843 | """ |
|
2844 | """ | |
2844 |
|
2845 | |||
2845 | # Mercurial <= 3.1 expects the filectxfn to raise IOError for missing files. |
|
2846 | # Mercurial <= 3.1 expects the filectxfn to raise IOError for missing files. | |
2846 | # Extensions that need to retain compatibility across Mercurial 3.1 can use |
|
2847 | # Extensions that need to retain compatibility across Mercurial 3.1 can use | |
2847 | # this field to determine what to do in filectxfn. |
|
2848 | # this field to determine what to do in filectxfn. | |
2848 | _returnnoneformissingfiles = True |
|
2849 | _returnnoneformissingfiles = True | |
2849 |
|
2850 | |||
2850 | def __init__( |
|
2851 | def __init__( | |
2851 | self, |
|
2852 | self, | |
2852 | repo, |
|
2853 | repo, | |
2853 | parents, |
|
2854 | parents, | |
2854 | text, |
|
2855 | text, | |
2855 | files, |
|
2856 | files, | |
2856 | filectxfn, |
|
2857 | filectxfn, | |
2857 | user=None, |
|
2858 | user=None, | |
2858 | date=None, |
|
2859 | date=None, | |
2859 | extra=None, |
|
2860 | extra=None, | |
2860 | branch=None, |
|
2861 | branch=None, | |
2861 | editor=None, |
|
2862 | editor=None, | |
2862 | ): |
|
2863 | ): | |
2863 | super(memctx, self).__init__( |
|
2864 | super(memctx, self).__init__( | |
2864 | repo, text, user, date, extra, branch=branch |
|
2865 | repo, text, user, date, extra, branch=branch | |
2865 | ) |
|
2866 | ) | |
2866 | self._rev = None |
|
2867 | self._rev = None | |
2867 | self._node = None |
|
2868 | self._node = None | |
2868 | parents = [(p or self._repo.nodeconstants.nullid) for p in parents] |
|
2869 | parents = [(p or self._repo.nodeconstants.nullid) for p in parents] | |
2869 | p1, p2 = parents |
|
2870 | p1, p2 = parents | |
2870 | self._parents = [self._repo[p] for p in (p1, p2)] |
|
2871 | self._parents = [self._repo[p] for p in (p1, p2)] | |
2871 | files = sorted(set(files)) |
|
2872 | files = sorted(set(files)) | |
2872 | self._files = files |
|
2873 | self._files = files | |
2873 | self.substate = {} |
|
2874 | self.substate = {} | |
2874 |
|
2875 | |||
2875 | if isinstance(filectxfn, patch.filestore): |
|
2876 | if isinstance(filectxfn, patch.filestore): | |
2876 | filectxfn = memfilefrompatch(filectxfn) |
|
2877 | filectxfn = memfilefrompatch(filectxfn) | |
2877 | elif not callable(filectxfn): |
|
2878 | elif not callable(filectxfn): | |
2878 | # if store is not callable, wrap it in a function |
|
2879 | # if store is not callable, wrap it in a function | |
2879 | filectxfn = memfilefromctx(filectxfn) |
|
2880 | filectxfn = memfilefromctx(filectxfn) | |
2880 |
|
2881 | |||
2881 | # memoizing increases performance for e.g. vcs convert scenarios. |
|
2882 | # memoizing increases performance for e.g. vcs convert scenarios. | |
2882 | self._filectxfn = makecachingfilectxfn(filectxfn) |
|
2883 | self._filectxfn = makecachingfilectxfn(filectxfn) | |
2883 |
|
2884 | |||
2884 | if editor: |
|
2885 | if editor: | |
2885 | self._text = editor(self._repo, self, []) |
|
2886 | self._text = editor(self._repo, self, []) | |
2886 | self._repo.savecommitmessage(self._text) |
|
2887 | self._repo.savecommitmessage(self._text) | |
2887 |
|
2888 | |||
2888 | def filectx(self, path, filelog=None): |
|
2889 | def filectx(self, path, filelog=None): | |
2889 | """get a file context from the working directory |
|
2890 | """get a file context from the working directory | |
2890 |
|
2891 | |||
2891 | Returns None if file doesn't exist and should be removed.""" |
|
2892 | Returns None if file doesn't exist and should be removed.""" | |
2892 | return self._filectxfn(self._repo, self, path) |
|
2893 | return self._filectxfn(self._repo, self, path) | |
2893 |
|
2894 | |||
2894 | def commit(self): |
|
2895 | def commit(self): | |
2895 | """commit context to the repo""" |
|
2896 | """commit context to the repo""" | |
2896 | return self._repo.commitctx(self) |
|
2897 | return self._repo.commitctx(self) | |
2897 |
|
2898 | |||
2898 | @propertycache |
|
2899 | @propertycache | |
2899 | def _manifest(self): |
|
2900 | def _manifest(self): | |
2900 | """generate a manifest based on the return values of filectxfn""" |
|
2901 | """generate a manifest based on the return values of filectxfn""" | |
2901 |
|
2902 | |||
2902 | # keep this simple for now; just worry about p1 |
|
2903 | # keep this simple for now; just worry about p1 | |
2903 | pctx = self._parents[0] |
|
2904 | pctx = self._parents[0] | |
2904 | man = pctx.manifest().copy() |
|
2905 | man = pctx.manifest().copy() | |
2905 |
|
2906 | |||
2906 | for f in self._status.modified: |
|
2907 | for f in self._status.modified: | |
2907 | man[f] = self._repo.nodeconstants.modifiednodeid |
|
2908 | man[f] = self._repo.nodeconstants.modifiednodeid | |
2908 |
|
2909 | |||
2909 | for f in self._status.added: |
|
2910 | for f in self._status.added: | |
2910 | man[f] = self._repo.nodeconstants.addednodeid |
|
2911 | man[f] = self._repo.nodeconstants.addednodeid | |
2911 |
|
2912 | |||
2912 | for f in self._status.removed: |
|
2913 | for f in self._status.removed: | |
2913 | if f in man: |
|
2914 | if f in man: | |
2914 | del man[f] |
|
2915 | del man[f] | |
2915 |
|
2916 | |||
2916 | return man |
|
2917 | return man | |
2917 |
|
2918 | |||
2918 | @propertycache |
|
2919 | @propertycache | |
2919 | def _status(self): |
|
2920 | def _status(self): | |
2920 | """Calculate exact status from ``files`` specified at construction""" |
|
2921 | """Calculate exact status from ``files`` specified at construction""" | |
2921 | man1 = self.p1().manifest() |
|
2922 | man1 = self.p1().manifest() | |
2922 | p2 = self._parents[1] |
|
2923 | p2 = self._parents[1] | |
2923 | # "1 < len(self._parents)" can't be used for checking |
|
2924 | # "1 < len(self._parents)" can't be used for checking | |
2924 | # existence of the 2nd parent, because "memctx._parents" is |
|
2925 | # existence of the 2nd parent, because "memctx._parents" is | |
2925 | # explicitly initialized by the list, of which length is 2. |
|
2926 | # explicitly initialized by the list, of which length is 2. | |
2926 | if p2.rev() != nullrev: |
|
2927 | if p2.rev() != nullrev: | |
2927 | man2 = p2.manifest() |
|
2928 | man2 = p2.manifest() | |
2928 | managing = lambda f: f in man1 or f in man2 |
|
2929 | managing = lambda f: f in man1 or f in man2 | |
2929 | else: |
|
2930 | else: | |
2930 | managing = lambda f: f in man1 |
|
2931 | managing = lambda f: f in man1 | |
2931 |
|
2932 | |||
2932 | modified, added, removed = [], [], [] |
|
2933 | modified, added, removed = [], [], [] | |
2933 | for f in self._files: |
|
2934 | for f in self._files: | |
2934 | if not managing(f): |
|
2935 | if not managing(f): | |
2935 | added.append(f) |
|
2936 | added.append(f) | |
2936 | elif self[f]: |
|
2937 | elif self[f]: | |
2937 | modified.append(f) |
|
2938 | modified.append(f) | |
2938 | else: |
|
2939 | else: | |
2939 | removed.append(f) |
|
2940 | removed.append(f) | |
2940 |
|
2941 | |||
2941 | return scmutil.status(modified, added, removed, [], [], [], []) |
|
2942 | return scmutil.status(modified, added, removed, [], [], [], []) | |
2942 |
|
2943 | |||
2943 | def parents(self): |
|
2944 | def parents(self): | |
2944 | if self._parents[1].rev() == nullrev: |
|
2945 | if self._parents[1].rev() == nullrev: | |
2945 | return [self._parents[0]] |
|
2946 | return [self._parents[0]] | |
2946 | return self._parents |
|
2947 | return self._parents | |
2947 |
|
2948 | |||
2948 |
|
2949 | |||
2949 | class memfilectx(committablefilectx): |
|
2950 | class memfilectx(committablefilectx): | |
2950 | """memfilectx represents an in-memory file to commit. |
|
2951 | """memfilectx represents an in-memory file to commit. | |
2951 |
|
2952 | |||
2952 | See memctx and committablefilectx for more details. |
|
2953 | See memctx and committablefilectx for more details. | |
2953 | """ |
|
2954 | """ | |
2954 |
|
2955 | |||
2955 | def __init__( |
|
2956 | def __init__( | |
2956 | self, |
|
2957 | self, | |
2957 | repo, |
|
2958 | repo, | |
2958 | changectx, |
|
2959 | changectx, | |
2959 | path, |
|
2960 | path, | |
2960 | data, |
|
2961 | data, | |
2961 | islink=False, |
|
2962 | islink=False, | |
2962 | isexec=False, |
|
2963 | isexec=False, | |
2963 | copysource=None, |
|
2964 | copysource=None, | |
2964 | ): |
|
2965 | ): | |
2965 | """ |
|
2966 | """ | |
2966 | path is the normalized file path relative to repository root. |
|
2967 | path is the normalized file path relative to repository root. | |
2967 | data is the file content as a string. |
|
2968 | data is the file content as a string. | |
2968 | islink is True if the file is a symbolic link. |
|
2969 | islink is True if the file is a symbolic link. | |
2969 | isexec is True if the file is executable. |
|
2970 | isexec is True if the file is executable. | |
2970 | copied is the source file path if current file was copied in the |
|
2971 | copied is the source file path if current file was copied in the | |
2971 | revision being committed, or None.""" |
|
2972 | revision being committed, or None.""" | |
2972 | super(memfilectx, self).__init__(repo, path, None, changectx) |
|
2973 | super(memfilectx, self).__init__(repo, path, None, changectx) | |
2973 | self._data = data |
|
2974 | self._data = data | |
2974 | if islink: |
|
2975 | if islink: | |
2975 | self._flags = b'l' |
|
2976 | self._flags = b'l' | |
2976 | elif isexec: |
|
2977 | elif isexec: | |
2977 | self._flags = b'x' |
|
2978 | self._flags = b'x' | |
2978 | else: |
|
2979 | else: | |
2979 | self._flags = b'' |
|
2980 | self._flags = b'' | |
2980 | self._copysource = copysource |
|
2981 | self._copysource = copysource | |
2981 |
|
2982 | |||
2982 | def copysource(self): |
|
2983 | def copysource(self): | |
2983 | return self._copysource |
|
2984 | return self._copysource | |
2984 |
|
2985 | |||
2985 | def cmp(self, fctx): |
|
2986 | def cmp(self, fctx): | |
2986 | return self.data() != fctx.data() |
|
2987 | return self.data() != fctx.data() | |
2987 |
|
2988 | |||
2988 | def data(self): |
|
2989 | def data(self): | |
2989 | return self._data |
|
2990 | return self._data | |
2990 |
|
2991 | |||
2991 | def remove(self, ignoremissing=False): |
|
2992 | def remove(self, ignoremissing=False): | |
2992 | """wraps unlink for a repo's working directory""" |
|
2993 | """wraps unlink for a repo's working directory""" | |
2993 | # need to figure out what to do here |
|
2994 | # need to figure out what to do here | |
2994 | del self._changectx[self._path] |
|
2995 | del self._changectx[self._path] | |
2995 |
|
2996 | |||
2996 | def write(self, data, flags, **kwargs): |
|
2997 | def write(self, data, flags, **kwargs): | |
2997 | """wraps repo.wwrite""" |
|
2998 | """wraps repo.wwrite""" | |
2998 | self._data = data |
|
2999 | self._data = data | |
2999 |
|
3000 | |||
3000 |
|
3001 | |||
3001 | class metadataonlyctx(committablectx): |
|
3002 | class metadataonlyctx(committablectx): | |
3002 | """Like memctx but it's reusing the manifest of different commit. |
|
3003 | """Like memctx but it's reusing the manifest of different commit. | |
3003 | Intended to be used by lightweight operations that are creating |
|
3004 | Intended to be used by lightweight operations that are creating | |
3004 | metadata-only changes. |
|
3005 | metadata-only changes. | |
3005 |
|
3006 | |||
3006 | Revision information is supplied at initialization time. 'repo' is the |
|
3007 | Revision information is supplied at initialization time. 'repo' is the | |
3007 | current localrepo, 'ctx' is original revision which manifest we're reuisng |
|
3008 | current localrepo, 'ctx' is original revision which manifest we're reuisng | |
3008 | 'parents' is a sequence of two parent revisions identifiers (pass None for |
|
3009 | 'parents' is a sequence of two parent revisions identifiers (pass None for | |
3009 | every missing parent), 'text' is the commit. |
|
3010 | every missing parent), 'text' is the commit. | |
3010 |
|
3011 | |||
3011 | user receives the committer name and defaults to current repository |
|
3012 | user receives the committer name and defaults to current repository | |
3012 | username, date is the commit date in any format supported by |
|
3013 | username, date is the commit date in any format supported by | |
3013 | dateutil.parsedate() and defaults to current date, extra is a dictionary of |
|
3014 | dateutil.parsedate() and defaults to current date, extra is a dictionary of | |
3014 | metadata or is left empty. |
|
3015 | metadata or is left empty. | |
3015 | """ |
|
3016 | """ | |
3016 |
|
3017 | |||
3017 | def __init__( |
|
3018 | def __init__( | |
3018 | self, |
|
3019 | self, | |
3019 | repo, |
|
3020 | repo, | |
3020 | originalctx, |
|
3021 | originalctx, | |
3021 | parents=None, |
|
3022 | parents=None, | |
3022 | text=None, |
|
3023 | text=None, | |
3023 | user=None, |
|
3024 | user=None, | |
3024 | date=None, |
|
3025 | date=None, | |
3025 | extra=None, |
|
3026 | extra=None, | |
3026 | editor=None, |
|
3027 | editor=None, | |
3027 | ): |
|
3028 | ): | |
3028 | if text is None: |
|
3029 | if text is None: | |
3029 | text = originalctx.description() |
|
3030 | text = originalctx.description() | |
3030 | super(metadataonlyctx, self).__init__(repo, text, user, date, extra) |
|
3031 | super(metadataonlyctx, self).__init__(repo, text, user, date, extra) | |
3031 | self._rev = None |
|
3032 | self._rev = None | |
3032 | self._node = None |
|
3033 | self._node = None | |
3033 | self._originalctx = originalctx |
|
3034 | self._originalctx = originalctx | |
3034 | self._manifestnode = originalctx.manifestnode() |
|
3035 | self._manifestnode = originalctx.manifestnode() | |
3035 | if parents is None: |
|
3036 | if parents is None: | |
3036 | parents = originalctx.parents() |
|
3037 | parents = originalctx.parents() | |
3037 | else: |
|
3038 | else: | |
3038 | parents = [repo[p] for p in parents if p is not None] |
|
3039 | parents = [repo[p] for p in parents if p is not None] | |
3039 | parents = parents[:] |
|
3040 | parents = parents[:] | |
3040 | while len(parents) < 2: |
|
3041 | while len(parents) < 2: | |
3041 | parents.append(repo[nullrev]) |
|
3042 | parents.append(repo[nullrev]) | |
3042 | p1, p2 = self._parents = parents |
|
3043 | p1, p2 = self._parents = parents | |
3043 |
|
3044 | |||
3044 | # sanity check to ensure that the reused manifest parents are |
|
3045 | # sanity check to ensure that the reused manifest parents are | |
3045 | # manifests of our commit parents |
|
3046 | # manifests of our commit parents | |
3046 | mp1, mp2 = self.manifestctx().parents |
|
3047 | mp1, mp2 = self.manifestctx().parents | |
3047 | if p1 != self._repo.nodeconstants.nullid and p1.manifestnode() != mp1: |
|
3048 | if p1 != self._repo.nodeconstants.nullid and p1.manifestnode() != mp1: | |
3048 | raise RuntimeError( |
|
3049 | raise RuntimeError( | |
3049 | r"can't reuse the manifest: its p1 " |
|
3050 | r"can't reuse the manifest: its p1 " | |
3050 | r"doesn't match the new ctx p1" |
|
3051 | r"doesn't match the new ctx p1" | |
3051 | ) |
|
3052 | ) | |
3052 | if p2 != self._repo.nodeconstants.nullid and p2.manifestnode() != mp2: |
|
3053 | if p2 != self._repo.nodeconstants.nullid and p2.manifestnode() != mp2: | |
3053 | raise RuntimeError( |
|
3054 | raise RuntimeError( | |
3054 | r"can't reuse the manifest: " |
|
3055 | r"can't reuse the manifest: " | |
3055 | r"its p2 doesn't match the new ctx p2" |
|
3056 | r"its p2 doesn't match the new ctx p2" | |
3056 | ) |
|
3057 | ) | |
3057 |
|
3058 | |||
3058 | self._files = originalctx.files() |
|
3059 | self._files = originalctx.files() | |
3059 | self.substate = {} |
|
3060 | self.substate = {} | |
3060 |
|
3061 | |||
3061 | if editor: |
|
3062 | if editor: | |
3062 | self._text = editor(self._repo, self, []) |
|
3063 | self._text = editor(self._repo, self, []) | |
3063 | self._repo.savecommitmessage(self._text) |
|
3064 | self._repo.savecommitmessage(self._text) | |
3064 |
|
3065 | |||
3065 | def manifestnode(self): |
|
3066 | def manifestnode(self): | |
3066 | return self._manifestnode |
|
3067 | return self._manifestnode | |
3067 |
|
3068 | |||
3068 | @property |
|
3069 | @property | |
3069 | def _manifestctx(self): |
|
3070 | def _manifestctx(self): | |
3070 | return self._repo.manifestlog[self._manifestnode] |
|
3071 | return self._repo.manifestlog[self._manifestnode] | |
3071 |
|
3072 | |||
3072 | def filectx(self, path, filelog=None): |
|
3073 | def filectx(self, path, filelog=None): | |
3073 | return self._originalctx.filectx(path, filelog=filelog) |
|
3074 | return self._originalctx.filectx(path, filelog=filelog) | |
3074 |
|
3075 | |||
3075 | def commit(self): |
|
3076 | def commit(self): | |
3076 | """commit context to the repo""" |
|
3077 | """commit context to the repo""" | |
3077 | return self._repo.commitctx(self) |
|
3078 | return self._repo.commitctx(self) | |
3078 |
|
3079 | |||
3079 | @property |
|
3080 | @property | |
3080 | def _manifest(self): |
|
3081 | def _manifest(self): | |
3081 | return self._originalctx.manifest() |
|
3082 | return self._originalctx.manifest() | |
3082 |
|
3083 | |||
3083 | @propertycache |
|
3084 | @propertycache | |
3084 | def _status(self): |
|
3085 | def _status(self): | |
3085 | """Calculate exact status from ``files`` specified in the ``origctx`` |
|
3086 | """Calculate exact status from ``files`` specified in the ``origctx`` | |
3086 | and parents manifests. |
|
3087 | and parents manifests. | |
3087 | """ |
|
3088 | """ | |
3088 | man1 = self.p1().manifest() |
|
3089 | man1 = self.p1().manifest() | |
3089 | p2 = self._parents[1] |
|
3090 | p2 = self._parents[1] | |
3090 | # "1 < len(self._parents)" can't be used for checking |
|
3091 | # "1 < len(self._parents)" can't be used for checking | |
3091 | # existence of the 2nd parent, because "metadataonlyctx._parents" is |
|
3092 | # existence of the 2nd parent, because "metadataonlyctx._parents" is | |
3092 | # explicitly initialized by the list, of which length is 2. |
|
3093 | # explicitly initialized by the list, of which length is 2. | |
3093 | if p2.rev() != nullrev: |
|
3094 | if p2.rev() != nullrev: | |
3094 | man2 = p2.manifest() |
|
3095 | man2 = p2.manifest() | |
3095 | managing = lambda f: f in man1 or f in man2 |
|
3096 | managing = lambda f: f in man1 or f in man2 | |
3096 | else: |
|
3097 | else: | |
3097 | managing = lambda f: f in man1 |
|
3098 | managing = lambda f: f in man1 | |
3098 |
|
3099 | |||
3099 | modified, added, removed = [], [], [] |
|
3100 | modified, added, removed = [], [], [] | |
3100 | for f in self._files: |
|
3101 | for f in self._files: | |
3101 | if not managing(f): |
|
3102 | if not managing(f): | |
3102 | added.append(f) |
|
3103 | added.append(f) | |
3103 | elif f in self: |
|
3104 | elif f in self: | |
3104 | modified.append(f) |
|
3105 | modified.append(f) | |
3105 | else: |
|
3106 | else: | |
3106 | removed.append(f) |
|
3107 | removed.append(f) | |
3107 |
|
3108 | |||
3108 | return scmutil.status(modified, added, removed, [], [], [], []) |
|
3109 | return scmutil.status(modified, added, removed, [], [], [], []) | |
3109 |
|
3110 | |||
3110 |
|
3111 | |||
3111 | class arbitraryfilectx: |
|
3112 | class arbitraryfilectx: | |
3112 | """Allows you to use filectx-like functions on a file in an arbitrary |
|
3113 | """Allows you to use filectx-like functions on a file in an arbitrary | |
3113 | location on disk, possibly not in the working directory. |
|
3114 | location on disk, possibly not in the working directory. | |
3114 | """ |
|
3115 | """ | |
3115 |
|
3116 | |||
3116 | def __init__(self, path, repo=None): |
|
3117 | def __init__(self, path, repo=None): | |
3117 | # Repo is optional because contrib/simplemerge uses this class. |
|
3118 | # Repo is optional because contrib/simplemerge uses this class. | |
3118 | self._repo = repo |
|
3119 | self._repo = repo | |
3119 | self._path = path |
|
3120 | self._path = path | |
3120 |
|
3121 | |||
3121 | def cmp(self, fctx): |
|
3122 | def cmp(self, fctx): | |
3122 | # filecmp follows symlinks whereas `cmp` should not, so skip the fast |
|
3123 | # filecmp follows symlinks whereas `cmp` should not, so skip the fast | |
3123 | # path if either side is a symlink. |
|
3124 | # path if either side is a symlink. | |
3124 | symlinks = b'l' in self.flags() or b'l' in fctx.flags() |
|
3125 | symlinks = b'l' in self.flags() or b'l' in fctx.flags() | |
3125 | if not symlinks and isinstance(fctx, workingfilectx) and self._repo: |
|
3126 | if not symlinks and isinstance(fctx, workingfilectx) and self._repo: | |
3126 | # Add a fast-path for merge if both sides are disk-backed. |
|
3127 | # Add a fast-path for merge if both sides are disk-backed. | |
3127 | # Note that filecmp uses the opposite return values (True if same) |
|
3128 | # Note that filecmp uses the opposite return values (True if same) | |
3128 | # from our cmp functions (True if different). |
|
3129 | # from our cmp functions (True if different). | |
3129 | return not filecmp.cmp(self.path(), self._repo.wjoin(fctx.path())) |
|
3130 | return not filecmp.cmp(self.path(), self._repo.wjoin(fctx.path())) | |
3130 | return self.data() != fctx.data() |
|
3131 | return self.data() != fctx.data() | |
3131 |
|
3132 | |||
3132 | def path(self): |
|
3133 | def path(self): | |
3133 | return self._path |
|
3134 | return self._path | |
3134 |
|
3135 | |||
3135 | def flags(self): |
|
3136 | def flags(self): | |
3136 | return b'' |
|
3137 | return b'' | |
3137 |
|
3138 | |||
3138 | def data(self): |
|
3139 | def data(self): | |
3139 | return util.readfile(self._path) |
|
3140 | return util.readfile(self._path) | |
3140 |
|
3141 | |||
3141 | def decodeddata(self): |
|
3142 | def decodeddata(self): | |
3142 | return util.readfile(self._path) |
|
3143 | return util.readfile(self._path) | |
3143 |
|
3144 | |||
3144 | def remove(self): |
|
3145 | def remove(self): | |
3145 | util.unlink(self._path) |
|
3146 | util.unlink(self._path) | |
3146 |
|
3147 | |||
3147 | def write(self, data, flags, **kwargs): |
|
3148 | def write(self, data, flags, **kwargs): | |
3148 | assert not flags |
|
3149 | assert not flags | |
3149 | util.writefile(self._path, data) |
|
3150 | util.writefile(self._path, data) |
@@ -1,626 +1,634 b'' | |||||
1 | // status.rs |
|
1 | // status.rs | |
2 | // |
|
2 | // | |
3 | // Copyright 2020, Georges Racinet <georges.racinets@octobus.net> |
|
3 | // Copyright 2020, Georges Racinet <georges.racinets@octobus.net> | |
4 | // |
|
4 | // | |
5 | // This software may be used and distributed according to the terms of the |
|
5 | // This software may be used and distributed according to the terms of the | |
6 | // GNU General Public License version 2 or any later version. |
|
6 | // GNU General Public License version 2 or any later version. | |
7 |
|
7 | |||
8 | use crate::error::CommandError; |
|
8 | use crate::error::CommandError; | |
9 | use crate::ui::Ui; |
|
9 | use crate::ui::Ui; | |
10 | use crate::utils::path_utils::RelativizePaths; |
|
10 | use crate::utils::path_utils::RelativizePaths; | |
11 | use clap::{Arg, SubCommand}; |
|
11 | use clap::{Arg, SubCommand}; | |
12 | use format_bytes::format_bytes; |
|
12 | use format_bytes::format_bytes; | |
13 | use hg::config::Config; |
|
13 | use hg::config::Config; | |
14 | use hg::dirstate::has_exec_bit; |
|
14 | use hg::dirstate::has_exec_bit; | |
15 | use hg::dirstate::status::StatusPath; |
|
15 | use hg::dirstate::status::StatusPath; | |
16 | use hg::dirstate::TruncatedTimestamp; |
|
16 | use hg::dirstate::TruncatedTimestamp; | |
17 | use hg::errors::{HgError, IoResultExt}; |
|
17 | use hg::errors::{HgError, IoResultExt}; | |
18 | use hg::lock::LockError; |
|
18 | use hg::lock::LockError; | |
19 | use hg::manifest::Manifest; |
|
19 | use hg::manifest::Manifest; | |
20 | use hg::matchers::{AlwaysMatcher, IntersectionMatcher}; |
|
20 | use hg::matchers::{AlwaysMatcher, IntersectionMatcher}; | |
21 | use hg::repo::Repo; |
|
21 | use hg::repo::Repo; | |
|
22 | use hg::utils::debug::debug_wait_for_file; | |||
22 | use hg::utils::files::get_bytes_from_os_string; |
|
23 | use hg::utils::files::get_bytes_from_os_string; | |
23 | use hg::utils::files::get_bytes_from_path; |
|
24 | use hg::utils::files::get_bytes_from_path; | |
24 | use hg::utils::files::get_path_from_bytes; |
|
25 | use hg::utils::files::get_path_from_bytes; | |
25 | use hg::utils::hg_path::{hg_path_to_path_buf, HgPath}; |
|
26 | use hg::utils::hg_path::{hg_path_to_path_buf, HgPath}; | |
26 | use hg::DirstateStatus; |
|
27 | use hg::DirstateStatus; | |
27 | use hg::PatternFileWarning; |
|
28 | use hg::PatternFileWarning; | |
28 | use hg::StatusError; |
|
29 | use hg::StatusError; | |
29 | use hg::StatusOptions; |
|
30 | use hg::StatusOptions; | |
30 | use hg::{self, narrow, sparse}; |
|
31 | use hg::{self, narrow, sparse}; | |
31 | use log::info; |
|
32 | use log::info; | |
32 | use rayon::prelude::*; |
|
33 | use rayon::prelude::*; | |
33 | use std::io; |
|
34 | use std::io; | |
34 | use std::path::PathBuf; |
|
35 | use std::path::PathBuf; | |
35 |
|
36 | |||
36 | pub const HELP_TEXT: &str = " |
|
37 | pub const HELP_TEXT: &str = " | |
37 | Show changed files in the working directory |
|
38 | Show changed files in the working directory | |
38 |
|
39 | |||
39 | This is a pure Rust version of `hg status`. |
|
40 | This is a pure Rust version of `hg status`. | |
40 |
|
41 | |||
41 | Some options might be missing, check the list below. |
|
42 | Some options might be missing, check the list below. | |
42 | "; |
|
43 | "; | |
43 |
|
44 | |||
44 | pub fn args() -> clap::App<'static, 'static> { |
|
45 | pub fn args() -> clap::App<'static, 'static> { | |
45 | SubCommand::with_name("status") |
|
46 | SubCommand::with_name("status") | |
46 | .alias("st") |
|
47 | .alias("st") | |
47 | .about(HELP_TEXT) |
|
48 | .about(HELP_TEXT) | |
48 | .arg( |
|
49 | .arg( | |
49 | Arg::with_name("all") |
|
50 | Arg::with_name("all") | |
50 | .help("show status of all files") |
|
51 | .help("show status of all files") | |
51 | .short("-A") |
|
52 | .short("-A") | |
52 | .long("--all"), |
|
53 | .long("--all"), | |
53 | ) |
|
54 | ) | |
54 | .arg( |
|
55 | .arg( | |
55 | Arg::with_name("modified") |
|
56 | Arg::with_name("modified") | |
56 | .help("show only modified files") |
|
57 | .help("show only modified files") | |
57 | .short("-m") |
|
58 | .short("-m") | |
58 | .long("--modified"), |
|
59 | .long("--modified"), | |
59 | ) |
|
60 | ) | |
60 | .arg( |
|
61 | .arg( | |
61 | Arg::with_name("added") |
|
62 | Arg::with_name("added") | |
62 | .help("show only added files") |
|
63 | .help("show only added files") | |
63 | .short("-a") |
|
64 | .short("-a") | |
64 | .long("--added"), |
|
65 | .long("--added"), | |
65 | ) |
|
66 | ) | |
66 | .arg( |
|
67 | .arg( | |
67 | Arg::with_name("removed") |
|
68 | Arg::with_name("removed") | |
68 | .help("show only removed files") |
|
69 | .help("show only removed files") | |
69 | .short("-r") |
|
70 | .short("-r") | |
70 | .long("--removed"), |
|
71 | .long("--removed"), | |
71 | ) |
|
72 | ) | |
72 | .arg( |
|
73 | .arg( | |
73 | Arg::with_name("clean") |
|
74 | Arg::with_name("clean") | |
74 | .help("show only clean files") |
|
75 | .help("show only clean files") | |
75 | .short("-c") |
|
76 | .short("-c") | |
76 | .long("--clean"), |
|
77 | .long("--clean"), | |
77 | ) |
|
78 | ) | |
78 | .arg( |
|
79 | .arg( | |
79 | Arg::with_name("deleted") |
|
80 | Arg::with_name("deleted") | |
80 | .help("show only deleted files") |
|
81 | .help("show only deleted files") | |
81 | .short("-d") |
|
82 | .short("-d") | |
82 | .long("--deleted"), |
|
83 | .long("--deleted"), | |
83 | ) |
|
84 | ) | |
84 | .arg( |
|
85 | .arg( | |
85 | Arg::with_name("unknown") |
|
86 | Arg::with_name("unknown") | |
86 | .help("show only unknown (not tracked) files") |
|
87 | .help("show only unknown (not tracked) files") | |
87 | .short("-u") |
|
88 | .short("-u") | |
88 | .long("--unknown"), |
|
89 | .long("--unknown"), | |
89 | ) |
|
90 | ) | |
90 | .arg( |
|
91 | .arg( | |
91 | Arg::with_name("ignored") |
|
92 | Arg::with_name("ignored") | |
92 | .help("show only ignored files") |
|
93 | .help("show only ignored files") | |
93 | .short("-i") |
|
94 | .short("-i") | |
94 | .long("--ignored"), |
|
95 | .long("--ignored"), | |
95 | ) |
|
96 | ) | |
96 | .arg( |
|
97 | .arg( | |
97 | Arg::with_name("copies") |
|
98 | Arg::with_name("copies") | |
98 | .help("show source of copied files (DEFAULT: ui.statuscopies)") |
|
99 | .help("show source of copied files (DEFAULT: ui.statuscopies)") | |
99 | .short("-C") |
|
100 | .short("-C") | |
100 | .long("--copies"), |
|
101 | .long("--copies"), | |
101 | ) |
|
102 | ) | |
102 | .arg( |
|
103 | .arg( | |
103 | Arg::with_name("no-status") |
|
104 | Arg::with_name("no-status") | |
104 | .help("hide status prefix") |
|
105 | .help("hide status prefix") | |
105 | .short("-n") |
|
106 | .short("-n") | |
106 | .long("--no-status"), |
|
107 | .long("--no-status"), | |
107 | ) |
|
108 | ) | |
108 | .arg( |
|
109 | .arg( | |
109 | Arg::with_name("verbose") |
|
110 | Arg::with_name("verbose") | |
110 | .help("enable additional output") |
|
111 | .help("enable additional output") | |
111 | .short("-v") |
|
112 | .short("-v") | |
112 | .long("--verbose"), |
|
113 | .long("--verbose"), | |
113 | ) |
|
114 | ) | |
114 | } |
|
115 | } | |
115 |
|
116 | |||
116 | /// Pure data type allowing the caller to specify file states to display |
|
117 | /// Pure data type allowing the caller to specify file states to display | |
117 | #[derive(Copy, Clone, Debug)] |
|
118 | #[derive(Copy, Clone, Debug)] | |
118 | pub struct DisplayStates { |
|
119 | pub struct DisplayStates { | |
119 | pub modified: bool, |
|
120 | pub modified: bool, | |
120 | pub added: bool, |
|
121 | pub added: bool, | |
121 | pub removed: bool, |
|
122 | pub removed: bool, | |
122 | pub clean: bool, |
|
123 | pub clean: bool, | |
123 | pub deleted: bool, |
|
124 | pub deleted: bool, | |
124 | pub unknown: bool, |
|
125 | pub unknown: bool, | |
125 | pub ignored: bool, |
|
126 | pub ignored: bool, | |
126 | } |
|
127 | } | |
127 |
|
128 | |||
128 | pub const DEFAULT_DISPLAY_STATES: DisplayStates = DisplayStates { |
|
129 | pub const DEFAULT_DISPLAY_STATES: DisplayStates = DisplayStates { | |
129 | modified: true, |
|
130 | modified: true, | |
130 | added: true, |
|
131 | added: true, | |
131 | removed: true, |
|
132 | removed: true, | |
132 | clean: false, |
|
133 | clean: false, | |
133 | deleted: true, |
|
134 | deleted: true, | |
134 | unknown: true, |
|
135 | unknown: true, | |
135 | ignored: false, |
|
136 | ignored: false, | |
136 | }; |
|
137 | }; | |
137 |
|
138 | |||
138 | pub const ALL_DISPLAY_STATES: DisplayStates = DisplayStates { |
|
139 | pub const ALL_DISPLAY_STATES: DisplayStates = DisplayStates { | |
139 | modified: true, |
|
140 | modified: true, | |
140 | added: true, |
|
141 | added: true, | |
141 | removed: true, |
|
142 | removed: true, | |
142 | clean: true, |
|
143 | clean: true, | |
143 | deleted: true, |
|
144 | deleted: true, | |
144 | unknown: true, |
|
145 | unknown: true, | |
145 | ignored: true, |
|
146 | ignored: true, | |
146 | }; |
|
147 | }; | |
147 |
|
148 | |||
148 | impl DisplayStates { |
|
149 | impl DisplayStates { | |
149 | pub fn is_empty(&self) -> bool { |
|
150 | pub fn is_empty(&self) -> bool { | |
150 | !(self.modified |
|
151 | !(self.modified | |
151 | || self.added |
|
152 | || self.added | |
152 | || self.removed |
|
153 | || self.removed | |
153 | || self.clean |
|
154 | || self.clean | |
154 | || self.deleted |
|
155 | || self.deleted | |
155 | || self.unknown |
|
156 | || self.unknown | |
156 | || self.ignored) |
|
157 | || self.ignored) | |
157 | } |
|
158 | } | |
158 | } |
|
159 | } | |
159 |
|
160 | |||
160 | fn has_unfinished_merge(repo: &Repo) -> Result<bool, CommandError> { |
|
161 | fn has_unfinished_merge(repo: &Repo) -> Result<bool, CommandError> { | |
161 | return Ok(repo.dirstate_parents()?.is_merge()); |
|
162 | return Ok(repo.dirstate_parents()?.is_merge()); | |
162 | } |
|
163 | } | |
163 |
|
164 | |||
164 | fn has_unfinished_state(repo: &Repo) -> Result<bool, CommandError> { |
|
165 | fn has_unfinished_state(repo: &Repo) -> Result<bool, CommandError> { | |
165 | // These are all the known values for the [fname] argument of |
|
166 | // These are all the known values for the [fname] argument of | |
166 | // [addunfinished] function in [state.py] |
|
167 | // [addunfinished] function in [state.py] | |
167 | let known_state_files: &[&str] = &[ |
|
168 | let known_state_files: &[&str] = &[ | |
168 | "bisect.state", |
|
169 | "bisect.state", | |
169 | "graftstate", |
|
170 | "graftstate", | |
170 | "histedit-state", |
|
171 | "histedit-state", | |
171 | "rebasestate", |
|
172 | "rebasestate", | |
172 | "shelvedstate", |
|
173 | "shelvedstate", | |
173 | "transplant/journal", |
|
174 | "transplant/journal", | |
174 | "updatestate", |
|
175 | "updatestate", | |
175 | ]; |
|
176 | ]; | |
176 | if has_unfinished_merge(repo)? { |
|
177 | if has_unfinished_merge(repo)? { | |
177 | return Ok(true); |
|
178 | return Ok(true); | |
178 | }; |
|
179 | }; | |
179 | for f in known_state_files { |
|
180 | for f in known_state_files { | |
180 | if repo.hg_vfs().join(f).exists() { |
|
181 | if repo.hg_vfs().join(f).exists() { | |
181 | return Ok(true); |
|
182 | return Ok(true); | |
182 | } |
|
183 | } | |
183 | } |
|
184 | } | |
184 | return Ok(false); |
|
185 | return Ok(false); | |
185 | } |
|
186 | } | |
186 |
|
187 | |||
187 | pub fn run(invocation: &crate::CliInvocation) -> Result<(), CommandError> { |
|
188 | pub fn run(invocation: &crate::CliInvocation) -> Result<(), CommandError> { | |
188 | // TODO: lift these limitations |
|
189 | // TODO: lift these limitations | |
189 | if invocation |
|
190 | if invocation | |
190 | .config |
|
191 | .config | |
191 | .get(b"commands", b"status.terse") |
|
192 | .get(b"commands", b"status.terse") | |
192 | .is_some() |
|
193 | .is_some() | |
193 | { |
|
194 | { | |
194 | return Err(CommandError::unsupported( |
|
195 | return Err(CommandError::unsupported( | |
195 | "status.terse is not yet supported with rhg status", |
|
196 | "status.terse is not yet supported with rhg status", | |
196 | )); |
|
197 | )); | |
197 | } |
|
198 | } | |
198 |
|
199 | |||
199 | let ui = invocation.ui; |
|
200 | let ui = invocation.ui; | |
200 | let config = invocation.config; |
|
201 | let config = invocation.config; | |
201 | let args = invocation.subcommand_args; |
|
202 | let args = invocation.subcommand_args; | |
202 |
|
203 | |||
203 | let verbose = !args.is_present("print0") |
|
204 | let verbose = !args.is_present("print0") | |
204 | && (args.is_present("verbose") |
|
205 | && (args.is_present("verbose") | |
205 | || config.get_bool(b"ui", b"verbose")? |
|
206 | || config.get_bool(b"ui", b"verbose")? | |
206 | || config.get_bool(b"commands", b"status.verbose")?); |
|
207 | || config.get_bool(b"commands", b"status.verbose")?); | |
207 |
|
208 | |||
208 | let all = args.is_present("all"); |
|
209 | let all = args.is_present("all"); | |
209 | let display_states = if all { |
|
210 | let display_states = if all { | |
210 | // TODO when implementing `--quiet`: it excludes clean files |
|
211 | // TODO when implementing `--quiet`: it excludes clean files | |
211 | // from `--all` |
|
212 | // from `--all` | |
212 | ALL_DISPLAY_STATES |
|
213 | ALL_DISPLAY_STATES | |
213 | } else { |
|
214 | } else { | |
214 | let requested = DisplayStates { |
|
215 | let requested = DisplayStates { | |
215 | modified: args.is_present("modified"), |
|
216 | modified: args.is_present("modified"), | |
216 | added: args.is_present("added"), |
|
217 | added: args.is_present("added"), | |
217 | removed: args.is_present("removed"), |
|
218 | removed: args.is_present("removed"), | |
218 | clean: args.is_present("clean"), |
|
219 | clean: args.is_present("clean"), | |
219 | deleted: args.is_present("deleted"), |
|
220 | deleted: args.is_present("deleted"), | |
220 | unknown: args.is_present("unknown"), |
|
221 | unknown: args.is_present("unknown"), | |
221 | ignored: args.is_present("ignored"), |
|
222 | ignored: args.is_present("ignored"), | |
222 | }; |
|
223 | }; | |
223 | if requested.is_empty() { |
|
224 | if requested.is_empty() { | |
224 | DEFAULT_DISPLAY_STATES |
|
225 | DEFAULT_DISPLAY_STATES | |
225 | } else { |
|
226 | } else { | |
226 | requested |
|
227 | requested | |
227 | } |
|
228 | } | |
228 | }; |
|
229 | }; | |
229 | let no_status = args.is_present("no-status"); |
|
230 | let no_status = args.is_present("no-status"); | |
230 | let list_copies = all |
|
231 | let list_copies = all | |
231 | || args.is_present("copies") |
|
232 | || args.is_present("copies") | |
232 | || config.get_bool(b"ui", b"statuscopies")?; |
|
233 | || config.get_bool(b"ui", b"statuscopies")?; | |
233 |
|
234 | |||
234 | let repo = invocation.repo?; |
|
235 | let repo = invocation.repo?; | |
235 |
|
236 | |||
236 | if verbose { |
|
237 | if verbose { | |
237 | if has_unfinished_state(repo)? { |
|
238 | if has_unfinished_state(repo)? { | |
238 | return Err(CommandError::unsupported( |
|
239 | return Err(CommandError::unsupported( | |
239 | "verbose status output is not supported by rhg (and is needed because we're in an unfinished operation)", |
|
240 | "verbose status output is not supported by rhg (and is needed because we're in an unfinished operation)", | |
240 | )); |
|
241 | )); | |
241 | }; |
|
242 | }; | |
242 | } |
|
243 | } | |
243 |
|
244 | |||
244 | let mut dmap = repo.dirstate_map_mut()?; |
|
245 | let mut dmap = repo.dirstate_map_mut()?; | |
245 |
|
246 | |||
246 | let options = StatusOptions { |
|
247 | let options = StatusOptions { | |
247 | // we're currently supporting file systems with exec flags only |
|
248 | // we're currently supporting file systems with exec flags only | |
248 | // anyway |
|
249 | // anyway | |
249 | check_exec: true, |
|
250 | check_exec: true, | |
250 | list_clean: display_states.clean, |
|
251 | list_clean: display_states.clean, | |
251 | list_unknown: display_states.unknown, |
|
252 | list_unknown: display_states.unknown, | |
252 | list_ignored: display_states.ignored, |
|
253 | list_ignored: display_states.ignored, | |
253 | list_copies, |
|
254 | list_copies, | |
254 | collect_traversed_dirs: false, |
|
255 | collect_traversed_dirs: false, | |
255 | }; |
|
256 | }; | |
256 |
|
257 | |||
257 | type StatusResult<'a> = |
|
258 | type StatusResult<'a> = | |
258 | Result<(DirstateStatus<'a>, Vec<PatternFileWarning>), StatusError>; |
|
259 | Result<(DirstateStatus<'a>, Vec<PatternFileWarning>), StatusError>; | |
259 |
|
260 | |||
260 | let after_status = |res: StatusResult| -> Result<_, CommandError> { |
|
261 | let after_status = |res: StatusResult| -> Result<_, CommandError> { | |
261 | let (mut ds_status, pattern_warnings) = res?; |
|
262 | let (mut ds_status, pattern_warnings) = res?; | |
262 | for warning in pattern_warnings { |
|
263 | for warning in pattern_warnings { | |
263 | ui.write_stderr(&print_pattern_file_warning(&warning, &repo))?; |
|
264 | ui.write_stderr(&print_pattern_file_warning(&warning, &repo))?; | |
264 | } |
|
265 | } | |
265 |
|
266 | |||
266 | for (path, error) in ds_status.bad { |
|
267 | for (path, error) in ds_status.bad { | |
267 | let error = match error { |
|
268 | let error = match error { | |
268 | hg::BadMatch::OsError(code) => { |
|
269 | hg::BadMatch::OsError(code) => { | |
269 | std::io::Error::from_raw_os_error(code).to_string() |
|
270 | std::io::Error::from_raw_os_error(code).to_string() | |
270 | } |
|
271 | } | |
271 | hg::BadMatch::BadType(ty) => { |
|
272 | hg::BadMatch::BadType(ty) => { | |
272 | format!("unsupported file type (type is {})", ty) |
|
273 | format!("unsupported file type (type is {})", ty) | |
273 | } |
|
274 | } | |
274 | }; |
|
275 | }; | |
275 | ui.write_stderr(&format_bytes!( |
|
276 | ui.write_stderr(&format_bytes!( | |
276 | b"{}: {}\n", |
|
277 | b"{}: {}\n", | |
277 | path.as_bytes(), |
|
278 | path.as_bytes(), | |
278 | error.as_bytes() |
|
279 | error.as_bytes() | |
279 | ))? |
|
280 | ))? | |
280 | } |
|
281 | } | |
281 | if !ds_status.unsure.is_empty() { |
|
282 | if !ds_status.unsure.is_empty() { | |
282 | info!( |
|
283 | info!( | |
283 | "Files to be rechecked by retrieval from filelog: {:?}", |
|
284 | "Files to be rechecked by retrieval from filelog: {:?}", | |
284 | ds_status.unsure.iter().map(|s| &s.path).collect::<Vec<_>>() |
|
285 | ds_status.unsure.iter().map(|s| &s.path).collect::<Vec<_>>() | |
285 | ); |
|
286 | ); | |
286 | } |
|
287 | } | |
287 | let mut fixup = Vec::new(); |
|
288 | let mut fixup = Vec::new(); | |
288 | if !ds_status.unsure.is_empty() |
|
289 | if !ds_status.unsure.is_empty() | |
289 | && (display_states.modified || display_states.clean) |
|
290 | && (display_states.modified || display_states.clean) | |
290 | { |
|
291 | { | |
291 | let p1 = repo.dirstate_parents()?.p1; |
|
292 | let p1 = repo.dirstate_parents()?.p1; | |
292 | let manifest = repo.manifest_for_node(p1).map_err(|e| { |
|
293 | let manifest = repo.manifest_for_node(p1).map_err(|e| { | |
293 | CommandError::from((e, &*format!("{:x}", p1.short()))) |
|
294 | CommandError::from((e, &*format!("{:x}", p1.short()))) | |
294 | })?; |
|
295 | })?; | |
295 | let working_directory_vfs = repo.working_directory_vfs(); |
|
296 | let working_directory_vfs = repo.working_directory_vfs(); | |
296 | let store_vfs = repo.store_vfs(); |
|
297 | let store_vfs = repo.store_vfs(); | |
297 | let res: Vec<_> = ds_status |
|
298 | let res: Vec<_> = ds_status | |
298 | .unsure |
|
299 | .unsure | |
299 | .into_par_iter() |
|
300 | .into_par_iter() | |
300 | .map(|to_check| { |
|
301 | .map(|to_check| { | |
301 | unsure_is_modified( |
|
302 | unsure_is_modified( | |
302 | working_directory_vfs, |
|
303 | working_directory_vfs, | |
303 | store_vfs, |
|
304 | store_vfs, | |
304 | &manifest, |
|
305 | &manifest, | |
305 | &to_check.path, |
|
306 | &to_check.path, | |
306 | ) |
|
307 | ) | |
307 | .map(|modified| (to_check, modified)) |
|
308 | .map(|modified| (to_check, modified)) | |
308 | }) |
|
309 | }) | |
309 | .collect::<Result<_, _>>()?; |
|
310 | .collect::<Result<_, _>>()?; | |
310 | for (status_path, is_modified) in res.into_iter() { |
|
311 | for (status_path, is_modified) in res.into_iter() { | |
311 | if is_modified { |
|
312 | if is_modified { | |
312 | if display_states.modified { |
|
313 | if display_states.modified { | |
313 | ds_status.modified.push(status_path); |
|
314 | ds_status.modified.push(status_path); | |
314 | } |
|
315 | } | |
315 | } else { |
|
316 | } else { | |
316 | if display_states.clean { |
|
317 | if display_states.clean { | |
317 | ds_status.clean.push(status_path.clone()); |
|
318 | ds_status.clean.push(status_path.clone()); | |
318 | } |
|
319 | } | |
319 | fixup.push(status_path.path.into_owned()) |
|
320 | fixup.push(status_path.path.into_owned()) | |
320 | } |
|
321 | } | |
321 | } |
|
322 | } | |
322 | } |
|
323 | } | |
323 | let relative_paths = config |
|
324 | let relative_paths = config | |
324 | .get_option(b"commands", b"status.relative")? |
|
325 | .get_option(b"commands", b"status.relative")? | |
325 | .unwrap_or(config.get_bool(b"ui", b"relative-paths")?); |
|
326 | .unwrap_or(config.get_bool(b"ui", b"relative-paths")?); | |
326 | let output = DisplayStatusPaths { |
|
327 | let output = DisplayStatusPaths { | |
327 | ui, |
|
328 | ui, | |
328 | no_status, |
|
329 | no_status, | |
329 | relativize: if relative_paths { |
|
330 | relativize: if relative_paths { | |
330 | Some(RelativizePaths::new(repo)?) |
|
331 | Some(RelativizePaths::new(repo)?) | |
331 | } else { |
|
332 | } else { | |
332 | None |
|
333 | None | |
333 | }, |
|
334 | }, | |
334 | }; |
|
335 | }; | |
335 | if display_states.modified { |
|
336 | if display_states.modified { | |
336 | output.display(b"M ", "status.modified", ds_status.modified)?; |
|
337 | output.display(b"M ", "status.modified", ds_status.modified)?; | |
337 | } |
|
338 | } | |
338 | if display_states.added { |
|
339 | if display_states.added { | |
339 | output.display(b"A ", "status.added", ds_status.added)?; |
|
340 | output.display(b"A ", "status.added", ds_status.added)?; | |
340 | } |
|
341 | } | |
341 | if display_states.removed { |
|
342 | if display_states.removed { | |
342 | output.display(b"R ", "status.removed", ds_status.removed)?; |
|
343 | output.display(b"R ", "status.removed", ds_status.removed)?; | |
343 | } |
|
344 | } | |
344 | if display_states.deleted { |
|
345 | if display_states.deleted { | |
345 | output.display(b"! ", "status.deleted", ds_status.deleted)?; |
|
346 | output.display(b"! ", "status.deleted", ds_status.deleted)?; | |
346 | } |
|
347 | } | |
347 | if display_states.unknown { |
|
348 | if display_states.unknown { | |
348 | output.display(b"? ", "status.unknown", ds_status.unknown)?; |
|
349 | output.display(b"? ", "status.unknown", ds_status.unknown)?; | |
349 | } |
|
350 | } | |
350 | if display_states.ignored { |
|
351 | if display_states.ignored { | |
351 | output.display(b"I ", "status.ignored", ds_status.ignored)?; |
|
352 | output.display(b"I ", "status.ignored", ds_status.ignored)?; | |
352 | } |
|
353 | } | |
353 | if display_states.clean { |
|
354 | if display_states.clean { | |
354 | output.display(b"C ", "status.clean", ds_status.clean)?; |
|
355 | output.display(b"C ", "status.clean", ds_status.clean)?; | |
355 | } |
|
356 | } | |
356 |
|
357 | |||
357 | let dirstate_write_needed = ds_status.dirty; |
|
358 | let dirstate_write_needed = ds_status.dirty; | |
358 | let filesystem_time_at_status_start = |
|
359 | let filesystem_time_at_status_start = | |
359 | ds_status.filesystem_time_at_status_start; |
|
360 | ds_status.filesystem_time_at_status_start; | |
360 |
|
361 | |||
361 | Ok(( |
|
362 | Ok(( | |
362 | fixup, |
|
363 | fixup, | |
363 | dirstate_write_needed, |
|
364 | dirstate_write_needed, | |
364 | filesystem_time_at_status_start, |
|
365 | filesystem_time_at_status_start, | |
365 | )) |
|
366 | )) | |
366 | }; |
|
367 | }; | |
367 | let (narrow_matcher, narrow_warnings) = narrow::matcher(repo)?; |
|
368 | let (narrow_matcher, narrow_warnings) = narrow::matcher(repo)?; | |
368 | let (sparse_matcher, sparse_warnings) = sparse::matcher(repo)?; |
|
369 | let (sparse_matcher, sparse_warnings) = sparse::matcher(repo)?; | |
369 | let matcher = match (repo.has_narrow(), repo.has_sparse()) { |
|
370 | let matcher = match (repo.has_narrow(), repo.has_sparse()) { | |
370 | (true, true) => { |
|
371 | (true, true) => { | |
371 | Box::new(IntersectionMatcher::new(narrow_matcher, sparse_matcher)) |
|
372 | Box::new(IntersectionMatcher::new(narrow_matcher, sparse_matcher)) | |
372 | } |
|
373 | } | |
373 | (true, false) => narrow_matcher, |
|
374 | (true, false) => narrow_matcher, | |
374 | (false, true) => sparse_matcher, |
|
375 | (false, true) => sparse_matcher, | |
375 | (false, false) => Box::new(AlwaysMatcher), |
|
376 | (false, false) => Box::new(AlwaysMatcher), | |
376 | }; |
|
377 | }; | |
377 |
|
378 | |||
378 | for warning in narrow_warnings.into_iter().chain(sparse_warnings) { |
|
379 | for warning in narrow_warnings.into_iter().chain(sparse_warnings) { | |
379 | match &warning { |
|
380 | match &warning { | |
380 | sparse::SparseWarning::RootWarning { context, line } => { |
|
381 | sparse::SparseWarning::RootWarning { context, line } => { | |
381 | let msg = format_bytes!( |
|
382 | let msg = format_bytes!( | |
382 | b"warning: {} profile cannot use paths \" |
|
383 | b"warning: {} profile cannot use paths \" | |
383 | starting with /, ignoring {}\n", |
|
384 | starting with /, ignoring {}\n", | |
384 | context, |
|
385 | context, | |
385 | line |
|
386 | line | |
386 | ); |
|
387 | ); | |
387 | ui.write_stderr(&msg)?; |
|
388 | ui.write_stderr(&msg)?; | |
388 | } |
|
389 | } | |
389 | sparse::SparseWarning::ProfileNotFound { profile, rev } => { |
|
390 | sparse::SparseWarning::ProfileNotFound { profile, rev } => { | |
390 | let msg = format_bytes!( |
|
391 | let msg = format_bytes!( | |
391 | b"warning: sparse profile '{}' not found \" |
|
392 | b"warning: sparse profile '{}' not found \" | |
392 | in rev {} - ignoring it\n", |
|
393 | in rev {} - ignoring it\n", | |
393 | profile, |
|
394 | profile, | |
394 | rev |
|
395 | rev | |
395 | ); |
|
396 | ); | |
396 | ui.write_stderr(&msg)?; |
|
397 | ui.write_stderr(&msg)?; | |
397 | } |
|
398 | } | |
398 | sparse::SparseWarning::Pattern(e) => { |
|
399 | sparse::SparseWarning::Pattern(e) => { | |
399 | ui.write_stderr(&print_pattern_file_warning(e, &repo))?; |
|
400 | ui.write_stderr(&print_pattern_file_warning(e, &repo))?; | |
400 | } |
|
401 | } | |
401 | } |
|
402 | } | |
402 | } |
|
403 | } | |
403 | let (fixup, mut dirstate_write_needed, filesystem_time_at_status_start) = |
|
404 | let (fixup, mut dirstate_write_needed, filesystem_time_at_status_start) = | |
404 | dmap.with_status( |
|
405 | dmap.with_status( | |
405 | matcher.as_ref(), |
|
406 | matcher.as_ref(), | |
406 | repo.working_directory_path().to_owned(), |
|
407 | repo.working_directory_path().to_owned(), | |
407 | ignore_files(repo, config), |
|
408 | ignore_files(repo, config), | |
408 | options, |
|
409 | options, | |
409 | after_status, |
|
410 | after_status, | |
410 | )?; |
|
411 | )?; | |
411 |
|
412 | |||
|
413 | // Development config option to test write races | |||
|
414 | if let Err(e) = | |||
|
415 | debug_wait_for_file(&config, "status.pre-dirstate-write-file") | |||
|
416 | { | |||
|
417 | ui.write_stderr(e.as_bytes()).ok(); | |||
|
418 | } | |||
|
419 | ||||
412 | if (fixup.is_empty() || filesystem_time_at_status_start.is_none()) |
|
420 | if (fixup.is_empty() || filesystem_time_at_status_start.is_none()) | |
413 | && !dirstate_write_needed |
|
421 | && !dirstate_write_needed | |
414 | { |
|
422 | { | |
415 | // Nothing to update |
|
423 | // Nothing to update | |
416 | return Ok(()); |
|
424 | return Ok(()); | |
417 | } |
|
425 | } | |
418 |
|
426 | |||
419 | // Update the dirstate on disk if we can |
|
427 | // Update the dirstate on disk if we can | |
420 | let with_lock_result = |
|
428 | let with_lock_result = | |
421 | repo.try_with_wlock_no_wait(|| -> Result<(), CommandError> { |
|
429 | repo.try_with_wlock_no_wait(|| -> Result<(), CommandError> { | |
422 | if let Some(mtime_boundary) = filesystem_time_at_status_start { |
|
430 | if let Some(mtime_boundary) = filesystem_time_at_status_start { | |
423 | for hg_path in fixup { |
|
431 | for hg_path in fixup { | |
424 | use std::os::unix::fs::MetadataExt; |
|
432 | use std::os::unix::fs::MetadataExt; | |
425 | let fs_path = hg_path_to_path_buf(&hg_path) |
|
433 | let fs_path = hg_path_to_path_buf(&hg_path) | |
426 | .expect("HgPath conversion"); |
|
434 | .expect("HgPath conversion"); | |
427 | // Specifically do not reuse `fs_metadata` from |
|
435 | // Specifically do not reuse `fs_metadata` from | |
428 | // `unsure_is_clean` which was needed before reading |
|
436 | // `unsure_is_clean` which was needed before reading | |
429 | // contents. Here we access metadata again after reading |
|
437 | // contents. Here we access metadata again after reading | |
430 | // content, in case it changed in the meantime. |
|
438 | // content, in case it changed in the meantime. | |
431 | let fs_metadata = repo |
|
439 | let fs_metadata = repo | |
432 | .working_directory_vfs() |
|
440 | .working_directory_vfs() | |
433 | .symlink_metadata(&fs_path)?; |
|
441 | .symlink_metadata(&fs_path)?; | |
434 | if let Some(mtime) = |
|
442 | if let Some(mtime) = | |
435 | TruncatedTimestamp::for_reliable_mtime_of( |
|
443 | TruncatedTimestamp::for_reliable_mtime_of( | |
436 | &fs_metadata, |
|
444 | &fs_metadata, | |
437 | &mtime_boundary, |
|
445 | &mtime_boundary, | |
438 | ) |
|
446 | ) | |
439 | .when_reading_file(&fs_path)? |
|
447 | .when_reading_file(&fs_path)? | |
440 | { |
|
448 | { | |
441 | let mode = fs_metadata.mode(); |
|
449 | let mode = fs_metadata.mode(); | |
442 | let size = fs_metadata.len(); |
|
450 | let size = fs_metadata.len(); | |
443 | dmap.set_clean(&hg_path, mode, size as u32, mtime)?; |
|
451 | dmap.set_clean(&hg_path, mode, size as u32, mtime)?; | |
444 | dirstate_write_needed = true |
|
452 | dirstate_write_needed = true | |
445 | } |
|
453 | } | |
446 | } |
|
454 | } | |
447 | } |
|
455 | } | |
448 | drop(dmap); // Avoid "already mutably borrowed" RefCell panics |
|
456 | drop(dmap); // Avoid "already mutably borrowed" RefCell panics | |
449 | if dirstate_write_needed { |
|
457 | if dirstate_write_needed { | |
450 | repo.write_dirstate()? |
|
458 | repo.write_dirstate()? | |
451 | } |
|
459 | } | |
452 | Ok(()) |
|
460 | Ok(()) | |
453 | }); |
|
461 | }); | |
454 | match with_lock_result { |
|
462 | match with_lock_result { | |
455 | Ok(closure_result) => closure_result?, |
|
463 | Ok(closure_result) => closure_result?, | |
456 | Err(LockError::AlreadyHeld) => { |
|
464 | Err(LockError::AlreadyHeld) => { | |
457 | // Not updating the dirstate is not ideal but not critical: |
|
465 | // Not updating the dirstate is not ideal but not critical: | |
458 | // don’t keep our caller waiting until some other Mercurial |
|
466 | // don’t keep our caller waiting until some other Mercurial | |
459 | // process releases the lock. |
|
467 | // process releases the lock. | |
460 | log::info!("not writing dirstate from `status`: lock is held") |
|
468 | log::info!("not writing dirstate from `status`: lock is held") | |
461 | } |
|
469 | } | |
462 | Err(LockError::Other(HgError::IoError { error, .. })) |
|
470 | Err(LockError::Other(HgError::IoError { error, .. })) | |
463 | if error.kind() == io::ErrorKind::PermissionDenied => |
|
471 | if error.kind() == io::ErrorKind::PermissionDenied => | |
464 | { |
|
472 | { | |
465 | // `hg status` on a read-only repository is fine |
|
473 | // `hg status` on a read-only repository is fine | |
466 | } |
|
474 | } | |
467 | Err(LockError::Other(error)) => { |
|
475 | Err(LockError::Other(error)) => { | |
468 | // Report other I/O errors |
|
476 | // Report other I/O errors | |
469 | Err(error)? |
|
477 | Err(error)? | |
470 | } |
|
478 | } | |
471 | } |
|
479 | } | |
472 | Ok(()) |
|
480 | Ok(()) | |
473 | } |
|
481 | } | |
474 |
|
482 | |||
475 | fn ignore_files(repo: &Repo, config: &Config) -> Vec<PathBuf> { |
|
483 | fn ignore_files(repo: &Repo, config: &Config) -> Vec<PathBuf> { | |
476 | let mut ignore_files = Vec::new(); |
|
484 | let mut ignore_files = Vec::new(); | |
477 | let repo_ignore = repo.working_directory_vfs().join(".hgignore"); |
|
485 | let repo_ignore = repo.working_directory_vfs().join(".hgignore"); | |
478 | if repo_ignore.exists() { |
|
486 | if repo_ignore.exists() { | |
479 | ignore_files.push(repo_ignore) |
|
487 | ignore_files.push(repo_ignore) | |
480 | } |
|
488 | } | |
481 | for (key, value) in config.iter_section(b"ui") { |
|
489 | for (key, value) in config.iter_section(b"ui") { | |
482 | if key == b"ignore" || key.starts_with(b"ignore.") { |
|
490 | if key == b"ignore" || key.starts_with(b"ignore.") { | |
483 | let path = get_path_from_bytes(value); |
|
491 | let path = get_path_from_bytes(value); | |
484 | // TODO: expand "~/" and environment variable here, like Python |
|
492 | // TODO: expand "~/" and environment variable here, like Python | |
485 | // does with `os.path.expanduser` and `os.path.expandvars` |
|
493 | // does with `os.path.expanduser` and `os.path.expandvars` | |
486 |
|
494 | |||
487 | let joined = repo.working_directory_path().join(path); |
|
495 | let joined = repo.working_directory_path().join(path); | |
488 | ignore_files.push(joined); |
|
496 | ignore_files.push(joined); | |
489 | } |
|
497 | } | |
490 | } |
|
498 | } | |
491 | ignore_files |
|
499 | ignore_files | |
492 | } |
|
500 | } | |
493 |
|
501 | |||
494 | struct DisplayStatusPaths<'a> { |
|
502 | struct DisplayStatusPaths<'a> { | |
495 | ui: &'a Ui, |
|
503 | ui: &'a Ui, | |
496 | no_status: bool, |
|
504 | no_status: bool, | |
497 | relativize: Option<RelativizePaths>, |
|
505 | relativize: Option<RelativizePaths>, | |
498 | } |
|
506 | } | |
499 |
|
507 | |||
500 | impl DisplayStatusPaths<'_> { |
|
508 | impl DisplayStatusPaths<'_> { | |
501 | // Probably more elegant to use a Deref or Borrow trait rather than |
|
509 | // Probably more elegant to use a Deref or Borrow trait rather than | |
502 | // harcode HgPathBuf, but probably not really useful at this point |
|
510 | // harcode HgPathBuf, but probably not really useful at this point | |
503 | fn display( |
|
511 | fn display( | |
504 | &self, |
|
512 | &self, | |
505 | status_prefix: &[u8], |
|
513 | status_prefix: &[u8], | |
506 | label: &'static str, |
|
514 | label: &'static str, | |
507 | mut paths: Vec<StatusPath<'_>>, |
|
515 | mut paths: Vec<StatusPath<'_>>, | |
508 | ) -> Result<(), CommandError> { |
|
516 | ) -> Result<(), CommandError> { | |
509 | paths.sort_unstable(); |
|
517 | paths.sort_unstable(); | |
510 | // TODO: get the stdout lock once for the whole loop |
|
518 | // TODO: get the stdout lock once for the whole loop | |
511 | // instead of in each write |
|
519 | // instead of in each write | |
512 | for StatusPath { path, copy_source } in paths { |
|
520 | for StatusPath { path, copy_source } in paths { | |
513 | let relative; |
|
521 | let relative; | |
514 | let path = if let Some(relativize) = &self.relativize { |
|
522 | let path = if let Some(relativize) = &self.relativize { | |
515 | relative = relativize.relativize(&path); |
|
523 | relative = relativize.relativize(&path); | |
516 | &*relative |
|
524 | &*relative | |
517 | } else { |
|
525 | } else { | |
518 | path.as_bytes() |
|
526 | path.as_bytes() | |
519 | }; |
|
527 | }; | |
520 | // TODO: Add a way to use `write_bytes!` instead of `format_bytes!` |
|
528 | // TODO: Add a way to use `write_bytes!` instead of `format_bytes!` | |
521 | // in order to stream to stdout instead of allocating an |
|
529 | // in order to stream to stdout instead of allocating an | |
522 | // itermediate `Vec<u8>`. |
|
530 | // itermediate `Vec<u8>`. | |
523 | if !self.no_status { |
|
531 | if !self.no_status { | |
524 | self.ui.write_stdout_labelled(status_prefix, label)? |
|
532 | self.ui.write_stdout_labelled(status_prefix, label)? | |
525 | } |
|
533 | } | |
526 | self.ui |
|
534 | self.ui | |
527 | .write_stdout_labelled(&format_bytes!(b"{}\n", path), label)?; |
|
535 | .write_stdout_labelled(&format_bytes!(b"{}\n", path), label)?; | |
528 | if let Some(source) = copy_source { |
|
536 | if let Some(source) = copy_source { | |
529 | let label = "status.copied"; |
|
537 | let label = "status.copied"; | |
530 | self.ui.write_stdout_labelled( |
|
538 | self.ui.write_stdout_labelled( | |
531 | &format_bytes!(b" {}\n", source.as_bytes()), |
|
539 | &format_bytes!(b" {}\n", source.as_bytes()), | |
532 | label, |
|
540 | label, | |
533 | )? |
|
541 | )? | |
534 | } |
|
542 | } | |
535 | } |
|
543 | } | |
536 | Ok(()) |
|
544 | Ok(()) | |
537 | } |
|
545 | } | |
538 | } |
|
546 | } | |
539 |
|
547 | |||
540 | /// Check if a file is modified by comparing actual repo store and file system. |
|
548 | /// Check if a file is modified by comparing actual repo store and file system. | |
541 | /// |
|
549 | /// | |
542 | /// This meant to be used for those that the dirstate cannot resolve, due |
|
550 | /// This meant to be used for those that the dirstate cannot resolve, due | |
543 | /// to time resolution limits. |
|
551 | /// to time resolution limits. | |
544 | fn unsure_is_modified( |
|
552 | fn unsure_is_modified( | |
545 | working_directory_vfs: hg::vfs::Vfs, |
|
553 | working_directory_vfs: hg::vfs::Vfs, | |
546 | store_vfs: hg::vfs::Vfs, |
|
554 | store_vfs: hg::vfs::Vfs, | |
547 | manifest: &Manifest, |
|
555 | manifest: &Manifest, | |
548 | hg_path: &HgPath, |
|
556 | hg_path: &HgPath, | |
549 | ) -> Result<bool, HgError> { |
|
557 | ) -> Result<bool, HgError> { | |
550 | let vfs = working_directory_vfs; |
|
558 | let vfs = working_directory_vfs; | |
551 | let fs_path = hg_path_to_path_buf(hg_path).expect("HgPath conversion"); |
|
559 | let fs_path = hg_path_to_path_buf(hg_path).expect("HgPath conversion"); | |
552 | let fs_metadata = vfs.symlink_metadata(&fs_path)?; |
|
560 | let fs_metadata = vfs.symlink_metadata(&fs_path)?; | |
553 | let is_symlink = fs_metadata.file_type().is_symlink(); |
|
561 | let is_symlink = fs_metadata.file_type().is_symlink(); | |
554 | // TODO: Also account for `FALLBACK_SYMLINK` and `FALLBACK_EXEC` from the |
|
562 | // TODO: Also account for `FALLBACK_SYMLINK` and `FALLBACK_EXEC` from the | |
555 | // dirstate |
|
563 | // dirstate | |
556 | let fs_flags = if is_symlink { |
|
564 | let fs_flags = if is_symlink { | |
557 | Some(b'l') |
|
565 | Some(b'l') | |
558 | } else if has_exec_bit(&fs_metadata) { |
|
566 | } else if has_exec_bit(&fs_metadata) { | |
559 | Some(b'x') |
|
567 | Some(b'x') | |
560 | } else { |
|
568 | } else { | |
561 | None |
|
569 | None | |
562 | }; |
|
570 | }; | |
563 |
|
571 | |||
564 | let entry = manifest |
|
572 | let entry = manifest | |
565 | .find_by_path(hg_path)? |
|
573 | .find_by_path(hg_path)? | |
566 | .expect("ambgious file not in p1"); |
|
574 | .expect("ambgious file not in p1"); | |
567 | if entry.flags != fs_flags { |
|
575 | if entry.flags != fs_flags { | |
568 | return Ok(true); |
|
576 | return Ok(true); | |
569 | } |
|
577 | } | |
570 | let filelog = hg::filelog::Filelog::open_vfs(&store_vfs, hg_path)?; |
|
578 | let filelog = hg::filelog::Filelog::open_vfs(&store_vfs, hg_path)?; | |
571 | let fs_len = fs_metadata.len(); |
|
579 | let fs_len = fs_metadata.len(); | |
572 | let file_node = entry.node_id()?; |
|
580 | let file_node = entry.node_id()?; | |
573 | let filelog_entry = filelog.entry_for_node(file_node).map_err(|_| { |
|
581 | let filelog_entry = filelog.entry_for_node(file_node).map_err(|_| { | |
574 | HgError::corrupted(format!( |
|
582 | HgError::corrupted(format!( | |
575 | "filelog missing node {:?} from manifest", |
|
583 | "filelog missing node {:?} from manifest", | |
576 | file_node |
|
584 | file_node | |
577 | )) |
|
585 | )) | |
578 | })?; |
|
586 | })?; | |
579 | if filelog_entry.file_data_len_not_equal_to(fs_len) { |
|
587 | if filelog_entry.file_data_len_not_equal_to(fs_len) { | |
580 | // No need to read file contents: |
|
588 | // No need to read file contents: | |
581 | // it cannot be equal if it has a different length. |
|
589 | // it cannot be equal if it has a different length. | |
582 | return Ok(true); |
|
590 | return Ok(true); | |
583 | } |
|
591 | } | |
584 |
|
592 | |||
585 | let p1_filelog_data = filelog_entry.data()?; |
|
593 | let p1_filelog_data = filelog_entry.data()?; | |
586 | let p1_contents = p1_filelog_data.file_data()?; |
|
594 | let p1_contents = p1_filelog_data.file_data()?; | |
587 | if p1_contents.len() as u64 != fs_len { |
|
595 | if p1_contents.len() as u64 != fs_len { | |
588 | // No need to read file contents: |
|
596 | // No need to read file contents: | |
589 | // it cannot be equal if it has a different length. |
|
597 | // it cannot be equal if it has a different length. | |
590 | return Ok(true); |
|
598 | return Ok(true); | |
591 | } |
|
599 | } | |
592 |
|
600 | |||
593 | let fs_contents = if is_symlink { |
|
601 | let fs_contents = if is_symlink { | |
594 | get_bytes_from_os_string(vfs.read_link(fs_path)?.into_os_string()) |
|
602 | get_bytes_from_os_string(vfs.read_link(fs_path)?.into_os_string()) | |
595 | } else { |
|
603 | } else { | |
596 | vfs.read(fs_path)? |
|
604 | vfs.read(fs_path)? | |
597 | }; |
|
605 | }; | |
598 | Ok(p1_contents != &*fs_contents) |
|
606 | Ok(p1_contents != &*fs_contents) | |
599 | } |
|
607 | } | |
600 |
|
608 | |||
601 | fn print_pattern_file_warning( |
|
609 | fn print_pattern_file_warning( | |
602 | warning: &PatternFileWarning, |
|
610 | warning: &PatternFileWarning, | |
603 | repo: &Repo, |
|
611 | repo: &Repo, | |
604 | ) -> Vec<u8> { |
|
612 | ) -> Vec<u8> { | |
605 | match warning { |
|
613 | match warning { | |
606 | PatternFileWarning::InvalidSyntax(path, syntax) => format_bytes!( |
|
614 | PatternFileWarning::InvalidSyntax(path, syntax) => format_bytes!( | |
607 | b"{}: ignoring invalid syntax '{}'\n", |
|
615 | b"{}: ignoring invalid syntax '{}'\n", | |
608 | get_bytes_from_path(path), |
|
616 | get_bytes_from_path(path), | |
609 | &*syntax |
|
617 | &*syntax | |
610 | ), |
|
618 | ), | |
611 | PatternFileWarning::NoSuchFile(path) => { |
|
619 | PatternFileWarning::NoSuchFile(path) => { | |
612 | let path = if let Ok(relative) = |
|
620 | let path = if let Ok(relative) = | |
613 | path.strip_prefix(repo.working_directory_path()) |
|
621 | path.strip_prefix(repo.working_directory_path()) | |
614 | { |
|
622 | { | |
615 | relative |
|
623 | relative | |
616 | } else { |
|
624 | } else { | |
617 | &*path |
|
625 | &*path | |
618 | }; |
|
626 | }; | |
619 | format_bytes!( |
|
627 | format_bytes!( | |
620 | b"skipping unreadable pattern file '{}': \ |
|
628 | b"skipping unreadable pattern file '{}': \ | |
621 | No such file or directory\n", |
|
629 | No such file or directory\n", | |
622 | get_bytes_from_path(path), |
|
630 | get_bytes_from_path(path), | |
623 | ) |
|
631 | ) | |
624 | } |
|
632 | } | |
625 | } |
|
633 | } | |
626 | } |
|
634 | } |
General Comments 0
You need to be logged in to leave comments.
Login now