Show More
@@ -1,2189 +1,2216 | |||||
1 | # localrepo.py - read/write repository class for mercurial |
|
1 | # localrepo.py - read/write repository class for mercurial | |
2 | # |
|
2 | # | |
3 | # Copyright 2005-2007 Matt Mackall <mpm@selenic.com> |
|
3 | # Copyright 2005-2007 Matt Mackall <mpm@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 | from node import bin, hex, nullid, nullrev, short |
|
8 | from node import bin, hex, nullid, nullrev, short | |
9 | from i18n import _ |
|
9 | from i18n import _ | |
10 | import repo, changegroup, subrepo |
|
10 | import repo, changegroup, subrepo | |
11 | import changelog, dirstate, filelog, manifest, context |
|
11 | import changelog, dirstate, filelog, manifest, context | |
12 | import lock, transaction, store, encoding |
|
12 | import lock, transaction, store, encoding | |
13 | import util, extensions, hook, error |
|
13 | import util, extensions, hook, error | |
14 | import match as match_ |
|
14 | import match as match_ | |
15 | import merge as merge_ |
|
15 | import merge as merge_ | |
16 | import tags as tags_ |
|
16 | import tags as tags_ | |
17 | from lock import release |
|
17 | from lock import release | |
18 | import weakref, stat, errno, os, time, inspect |
|
18 | import weakref, stat, errno, os, time, inspect | |
19 | propertycache = util.propertycache |
|
19 | propertycache = util.propertycache | |
20 |
|
20 | |||
21 | class localrepository(repo.repository): |
|
21 | class localrepository(repo.repository): | |
22 | capabilities = set(('lookup', 'changegroupsubset', 'branchmap')) |
|
22 | capabilities = set(('lookup', 'changegroupsubset', 'branchmap')) | |
23 | supported = set('revlogv1 store fncache shared'.split()) |
|
23 | supported = set('revlogv1 store fncache shared'.split()) | |
24 |
|
24 | |||
25 | def __init__(self, baseui, path=None, create=0): |
|
25 | def __init__(self, baseui, path=None, create=0): | |
26 | repo.repository.__init__(self) |
|
26 | repo.repository.__init__(self) | |
27 | self.root = os.path.realpath(path) |
|
27 | self.root = os.path.realpath(path) | |
28 | self.path = os.path.join(self.root, ".hg") |
|
28 | self.path = os.path.join(self.root, ".hg") | |
29 | self.origroot = path |
|
29 | self.origroot = path | |
30 | self.opener = util.opener(self.path) |
|
30 | self.opener = util.opener(self.path) | |
31 | self.wopener = util.opener(self.root) |
|
31 | self.wopener = util.opener(self.root) | |
32 | self.baseui = baseui |
|
32 | self.baseui = baseui | |
33 | self.ui = baseui.copy() |
|
33 | self.ui = baseui.copy() | |
34 |
|
34 | |||
35 | try: |
|
35 | try: | |
36 | self.ui.readconfig(self.join("hgrc"), self.root) |
|
36 | self.ui.readconfig(self.join("hgrc"), self.root) | |
37 | extensions.loadall(self.ui) |
|
37 | extensions.loadall(self.ui) | |
38 | except IOError: |
|
38 | except IOError: | |
39 | pass |
|
39 | pass | |
40 |
|
40 | |||
41 | if not os.path.isdir(self.path): |
|
41 | if not os.path.isdir(self.path): | |
42 | if create: |
|
42 | if create: | |
43 | if not os.path.exists(path): |
|
43 | if not os.path.exists(path): | |
44 | os.mkdir(path) |
|
44 | os.mkdir(path) | |
45 | os.mkdir(self.path) |
|
45 | os.mkdir(self.path) | |
46 | requirements = ["revlogv1"] |
|
46 | requirements = ["revlogv1"] | |
47 | if self.ui.configbool('format', 'usestore', True): |
|
47 | if self.ui.configbool('format', 'usestore', True): | |
48 | os.mkdir(os.path.join(self.path, "store")) |
|
48 | os.mkdir(os.path.join(self.path, "store")) | |
49 | requirements.append("store") |
|
49 | requirements.append("store") | |
50 | if self.ui.configbool('format', 'usefncache', True): |
|
50 | if self.ui.configbool('format', 'usefncache', True): | |
51 | requirements.append("fncache") |
|
51 | requirements.append("fncache") | |
52 | # create an invalid changelog |
|
52 | # create an invalid changelog | |
53 | self.opener("00changelog.i", "a").write( |
|
53 | self.opener("00changelog.i", "a").write( | |
54 | '\0\0\0\2' # represents revlogv2 |
|
54 | '\0\0\0\2' # represents revlogv2 | |
55 | ' dummy changelog to prevent using the old repo layout' |
|
55 | ' dummy changelog to prevent using the old repo layout' | |
56 | ) |
|
56 | ) | |
57 | reqfile = self.opener("requires", "w") |
|
57 | reqfile = self.opener("requires", "w") | |
58 | for r in requirements: |
|
58 | for r in requirements: | |
59 | reqfile.write("%s\n" % r) |
|
59 | reqfile.write("%s\n" % r) | |
60 | reqfile.close() |
|
60 | reqfile.close() | |
61 | else: |
|
61 | else: | |
62 | raise error.RepoError(_("repository %s not found") % path) |
|
62 | raise error.RepoError(_("repository %s not found") % path) | |
63 | elif create: |
|
63 | elif create: | |
64 | raise error.RepoError(_("repository %s already exists") % path) |
|
64 | raise error.RepoError(_("repository %s already exists") % path) | |
65 | else: |
|
65 | else: | |
66 | # find requirements |
|
66 | # find requirements | |
67 | requirements = set() |
|
67 | requirements = set() | |
68 | try: |
|
68 | try: | |
69 | requirements = set(self.opener("requires").read().splitlines()) |
|
69 | requirements = set(self.opener("requires").read().splitlines()) | |
70 | except IOError, inst: |
|
70 | except IOError, inst: | |
71 | if inst.errno != errno.ENOENT: |
|
71 | if inst.errno != errno.ENOENT: | |
72 | raise |
|
72 | raise | |
73 | for r in requirements - self.supported: |
|
73 | for r in requirements - self.supported: | |
74 | raise error.RepoError(_("requirement '%s' not supported") % r) |
|
74 | raise error.RepoError(_("requirement '%s' not supported") % r) | |
75 |
|
75 | |||
76 | self.sharedpath = self.path |
|
76 | self.sharedpath = self.path | |
77 | try: |
|
77 | try: | |
78 | s = os.path.realpath(self.opener("sharedpath").read()) |
|
78 | s = os.path.realpath(self.opener("sharedpath").read()) | |
79 | if not os.path.exists(s): |
|
79 | if not os.path.exists(s): | |
80 | raise error.RepoError( |
|
80 | raise error.RepoError( | |
81 | _('.hg/sharedpath points to nonexistent directory %s') % s) |
|
81 | _('.hg/sharedpath points to nonexistent directory %s') % s) | |
82 | self.sharedpath = s |
|
82 | self.sharedpath = s | |
83 | except IOError, inst: |
|
83 | except IOError, inst: | |
84 | if inst.errno != errno.ENOENT: |
|
84 | if inst.errno != errno.ENOENT: | |
85 | raise |
|
85 | raise | |
86 |
|
86 | |||
87 | self.store = store.store(requirements, self.sharedpath, util.opener) |
|
87 | self.store = store.store(requirements, self.sharedpath, util.opener) | |
88 | self.spath = self.store.path |
|
88 | self.spath = self.store.path | |
89 | self.sopener = self.store.opener |
|
89 | self.sopener = self.store.opener | |
90 | self.sjoin = self.store.join |
|
90 | self.sjoin = self.store.join | |
91 | self.opener.createmode = self.store.createmode |
|
91 | self.opener.createmode = self.store.createmode | |
92 | self.sopener.options = {} |
|
92 | self.sopener.options = {} | |
93 |
|
93 | |||
94 | # These two define the set of tags for this repository. _tags |
|
94 | # These two define the set of tags for this repository. _tags | |
95 | # maps tag name to node; _tagtypes maps tag name to 'global' or |
|
95 | # maps tag name to node; _tagtypes maps tag name to 'global' or | |
96 | # 'local'. (Global tags are defined by .hgtags across all |
|
96 | # 'local'. (Global tags are defined by .hgtags across all | |
97 | # heads, and local tags are defined in .hg/localtags.) They |
|
97 | # heads, and local tags are defined in .hg/localtags.) They | |
98 | # constitute the in-memory cache of tags. |
|
98 | # constitute the in-memory cache of tags. | |
99 | self._tags = None |
|
99 | self._tags = None | |
100 | self._tagtypes = None |
|
100 | self._tagtypes = None | |
101 |
|
101 | |||
102 | self._branchcache = None # in UTF-8 |
|
102 | self._branchcache = None # in UTF-8 | |
103 | self._branchcachetip = None |
|
103 | self._branchcachetip = None | |
104 | self.nodetagscache = None |
|
104 | self.nodetagscache = None | |
105 | self.filterpats = {} |
|
105 | self.filterpats = {} | |
106 | self._datafilters = {} |
|
106 | self._datafilters = {} | |
107 | self._transref = self._lockref = self._wlockref = None |
|
107 | self._transref = self._lockref = self._wlockref = None | |
108 |
|
108 | |||
109 | @propertycache |
|
109 | @propertycache | |
110 | def changelog(self): |
|
110 | def changelog(self): | |
111 | c = changelog.changelog(self.sopener) |
|
111 | c = changelog.changelog(self.sopener) | |
112 | if 'HG_PENDING' in os.environ: |
|
112 | if 'HG_PENDING' in os.environ: | |
113 | p = os.environ['HG_PENDING'] |
|
113 | p = os.environ['HG_PENDING'] | |
114 | if p.startswith(self.root): |
|
114 | if p.startswith(self.root): | |
115 | c.readpending('00changelog.i.a') |
|
115 | c.readpending('00changelog.i.a') | |
116 | self.sopener.options['defversion'] = c.version |
|
116 | self.sopener.options['defversion'] = c.version | |
117 | return c |
|
117 | return c | |
118 |
|
118 | |||
119 | @propertycache |
|
119 | @propertycache | |
120 | def manifest(self): |
|
120 | def manifest(self): | |
121 | return manifest.manifest(self.sopener) |
|
121 | return manifest.manifest(self.sopener) | |
122 |
|
122 | |||
123 | @propertycache |
|
123 | @propertycache | |
124 | def dirstate(self): |
|
124 | def dirstate(self): | |
125 | return dirstate.dirstate(self.opener, self.ui, self.root) |
|
125 | return dirstate.dirstate(self.opener, self.ui, self.root) | |
126 |
|
126 | |||
127 | def __getitem__(self, changeid): |
|
127 | def __getitem__(self, changeid): | |
128 | if changeid is None: |
|
128 | if changeid is None: | |
129 | return context.workingctx(self) |
|
129 | return context.workingctx(self) | |
130 | return context.changectx(self, changeid) |
|
130 | return context.changectx(self, changeid) | |
131 |
|
131 | |||
132 | def __contains__(self, changeid): |
|
132 | def __contains__(self, changeid): | |
133 | try: |
|
133 | try: | |
134 | return bool(self.lookup(changeid)) |
|
134 | return bool(self.lookup(changeid)) | |
135 | except error.RepoLookupError: |
|
135 | except error.RepoLookupError: | |
136 | return False |
|
136 | return False | |
137 |
|
137 | |||
138 | def __nonzero__(self): |
|
138 | def __nonzero__(self): | |
139 | return True |
|
139 | return True | |
140 |
|
140 | |||
141 | def __len__(self): |
|
141 | def __len__(self): | |
142 | return len(self.changelog) |
|
142 | return len(self.changelog) | |
143 |
|
143 | |||
144 | def __iter__(self): |
|
144 | def __iter__(self): | |
145 | for i in xrange(len(self)): |
|
145 | for i in xrange(len(self)): | |
146 | yield i |
|
146 | yield i | |
147 |
|
147 | |||
148 | def url(self): |
|
148 | def url(self): | |
149 | return 'file:' + self.root |
|
149 | return 'file:' + self.root | |
150 |
|
150 | |||
151 | def hook(self, name, throw=False, **args): |
|
151 | def hook(self, name, throw=False, **args): | |
152 | return hook.hook(self.ui, self, name, throw, **args) |
|
152 | return hook.hook(self.ui, self, name, throw, **args) | |
153 |
|
153 | |||
154 | tag_disallowed = ':\r\n' |
|
154 | tag_disallowed = ':\r\n' | |
155 |
|
155 | |||
156 | def _tag(self, names, node, message, local, user, date, extra={}): |
|
156 | def _tag(self, names, node, message, local, user, date, extra={}): | |
157 | if isinstance(names, str): |
|
157 | if isinstance(names, str): | |
158 | allchars = names |
|
158 | allchars = names | |
159 | names = (names,) |
|
159 | names = (names,) | |
160 | else: |
|
160 | else: | |
161 | allchars = ''.join(names) |
|
161 | allchars = ''.join(names) | |
162 | for c in self.tag_disallowed: |
|
162 | for c in self.tag_disallowed: | |
163 | if c in allchars: |
|
163 | if c in allchars: | |
164 | raise util.Abort(_('%r cannot be used in a tag name') % c) |
|
164 | raise util.Abort(_('%r cannot be used in a tag name') % c) | |
165 |
|
165 | |||
166 | for name in names: |
|
166 | for name in names: | |
167 | self.hook('pretag', throw=True, node=hex(node), tag=name, |
|
167 | self.hook('pretag', throw=True, node=hex(node), tag=name, | |
168 | local=local) |
|
168 | local=local) | |
169 |
|
169 | |||
170 | def writetags(fp, names, munge, prevtags): |
|
170 | def writetags(fp, names, munge, prevtags): | |
171 | fp.seek(0, 2) |
|
171 | fp.seek(0, 2) | |
172 | if prevtags and prevtags[-1] != '\n': |
|
172 | if prevtags and prevtags[-1] != '\n': | |
173 | fp.write('\n') |
|
173 | fp.write('\n') | |
174 | for name in names: |
|
174 | for name in names: | |
175 | m = munge and munge(name) or name |
|
175 | m = munge and munge(name) or name | |
176 | if self._tagtypes and name in self._tagtypes: |
|
176 | if self._tagtypes and name in self._tagtypes: | |
177 | old = self._tags.get(name, nullid) |
|
177 | old = self._tags.get(name, nullid) | |
178 | fp.write('%s %s\n' % (hex(old), m)) |
|
178 | fp.write('%s %s\n' % (hex(old), m)) | |
179 | fp.write('%s %s\n' % (hex(node), m)) |
|
179 | fp.write('%s %s\n' % (hex(node), m)) | |
180 | fp.close() |
|
180 | fp.close() | |
181 |
|
181 | |||
182 | prevtags = '' |
|
182 | prevtags = '' | |
183 | if local: |
|
183 | if local: | |
184 | try: |
|
184 | try: | |
185 | fp = self.opener('localtags', 'r+') |
|
185 | fp = self.opener('localtags', 'r+') | |
186 | except IOError: |
|
186 | except IOError: | |
187 | fp = self.opener('localtags', 'a') |
|
187 | fp = self.opener('localtags', 'a') | |
188 | else: |
|
188 | else: | |
189 | prevtags = fp.read() |
|
189 | prevtags = fp.read() | |
190 |
|
190 | |||
191 | # local tags are stored in the current charset |
|
191 | # local tags are stored in the current charset | |
192 | writetags(fp, names, None, prevtags) |
|
192 | writetags(fp, names, None, prevtags) | |
193 | for name in names: |
|
193 | for name in names: | |
194 | self.hook('tag', node=hex(node), tag=name, local=local) |
|
194 | self.hook('tag', node=hex(node), tag=name, local=local) | |
195 | return |
|
195 | return | |
196 |
|
196 | |||
197 | try: |
|
197 | try: | |
198 | fp = self.wfile('.hgtags', 'rb+') |
|
198 | fp = self.wfile('.hgtags', 'rb+') | |
199 | except IOError: |
|
199 | except IOError: | |
200 | fp = self.wfile('.hgtags', 'ab') |
|
200 | fp = self.wfile('.hgtags', 'ab') | |
201 | else: |
|
201 | else: | |
202 | prevtags = fp.read() |
|
202 | prevtags = fp.read() | |
203 |
|
203 | |||
204 | # committed tags are stored in UTF-8 |
|
204 | # committed tags are stored in UTF-8 | |
205 | writetags(fp, names, encoding.fromlocal, prevtags) |
|
205 | writetags(fp, names, encoding.fromlocal, prevtags) | |
206 |
|
206 | |||
207 | if '.hgtags' not in self.dirstate: |
|
207 | if '.hgtags' not in self.dirstate: | |
208 | self.add(['.hgtags']) |
|
208 | self.add(['.hgtags']) | |
209 |
|
209 | |||
210 | m = match_.exact(self.root, '', ['.hgtags']) |
|
210 | m = match_.exact(self.root, '', ['.hgtags']) | |
211 | tagnode = self.commit(message, user, date, extra=extra, match=m) |
|
211 | tagnode = self.commit(message, user, date, extra=extra, match=m) | |
212 |
|
212 | |||
213 | for name in names: |
|
213 | for name in names: | |
214 | self.hook('tag', node=hex(node), tag=name, local=local) |
|
214 | self.hook('tag', node=hex(node), tag=name, local=local) | |
215 |
|
215 | |||
216 | return tagnode |
|
216 | return tagnode | |
217 |
|
217 | |||
218 | def tag(self, names, node, message, local, user, date): |
|
218 | def tag(self, names, node, message, local, user, date): | |
219 | '''tag a revision with one or more symbolic names. |
|
219 | '''tag a revision with one or more symbolic names. | |
220 |
|
220 | |||
221 | names is a list of strings or, when adding a single tag, names may be a |
|
221 | names is a list of strings or, when adding a single tag, names may be a | |
222 | string. |
|
222 | string. | |
223 |
|
223 | |||
224 | if local is True, the tags are stored in a per-repository file. |
|
224 | if local is True, the tags are stored in a per-repository file. | |
225 | otherwise, they are stored in the .hgtags file, and a new |
|
225 | otherwise, they are stored in the .hgtags file, and a new | |
226 | changeset is committed with the change. |
|
226 | changeset is committed with the change. | |
227 |
|
227 | |||
228 | keyword arguments: |
|
228 | keyword arguments: | |
229 |
|
229 | |||
230 | local: whether to store tags in non-version-controlled file |
|
230 | local: whether to store tags in non-version-controlled file | |
231 | (default False) |
|
231 | (default False) | |
232 |
|
232 | |||
233 | message: commit message to use if committing |
|
233 | message: commit message to use if committing | |
234 |
|
234 | |||
235 | user: name of user to use if committing |
|
235 | user: name of user to use if committing | |
236 |
|
236 | |||
237 | date: date tuple to use if committing''' |
|
237 | date: date tuple to use if committing''' | |
238 |
|
238 | |||
239 | for x in self.status()[:5]: |
|
239 | for x in self.status()[:5]: | |
240 | if '.hgtags' in x: |
|
240 | if '.hgtags' in x: | |
241 | raise util.Abort(_('working copy of .hgtags is changed ' |
|
241 | raise util.Abort(_('working copy of .hgtags is changed ' | |
242 | '(please commit .hgtags manually)')) |
|
242 | '(please commit .hgtags manually)')) | |
243 |
|
243 | |||
244 | self.tags() # instantiate the cache |
|
244 | self.tags() # instantiate the cache | |
245 | self._tag(names, node, message, local, user, date) |
|
245 | self._tag(names, node, message, local, user, date) | |
246 |
|
246 | |||
247 | def tags(self): |
|
247 | def tags(self): | |
248 | '''return a mapping of tag to node''' |
|
248 | '''return a mapping of tag to node''' | |
249 | if self._tags is None: |
|
249 | if self._tags is None: | |
250 | (self._tags, self._tagtypes) = self._findtags() |
|
250 | (self._tags, self._tagtypes) = self._findtags() | |
251 |
|
251 | |||
252 | return self._tags |
|
252 | return self._tags | |
253 |
|
253 | |||
254 | def _findtags(self): |
|
254 | def _findtags(self): | |
255 | '''Do the hard work of finding tags. Return a pair of dicts |
|
255 | '''Do the hard work of finding tags. Return a pair of dicts | |
256 | (tags, tagtypes) where tags maps tag name to node, and tagtypes |
|
256 | (tags, tagtypes) where tags maps tag name to node, and tagtypes | |
257 | maps tag name to a string like \'global\' or \'local\'. |
|
257 | maps tag name to a string like \'global\' or \'local\'. | |
258 | Subclasses or extensions are free to add their own tags, but |
|
258 | Subclasses or extensions are free to add their own tags, but | |
259 | should be aware that the returned dicts will be retained for the |
|
259 | should be aware that the returned dicts will be retained for the | |
260 | duration of the localrepo object.''' |
|
260 | duration of the localrepo object.''' | |
261 |
|
261 | |||
262 | # XXX what tagtype should subclasses/extensions use? Currently |
|
262 | # XXX what tagtype should subclasses/extensions use? Currently | |
263 | # mq and bookmarks add tags, but do not set the tagtype at all. |
|
263 | # mq and bookmarks add tags, but do not set the tagtype at all. | |
264 | # Should each extension invent its own tag type? Should there |
|
264 | # Should each extension invent its own tag type? Should there | |
265 | # be one tagtype for all such "virtual" tags? Or is the status |
|
265 | # be one tagtype for all such "virtual" tags? Or is the status | |
266 | # quo fine? |
|
266 | # quo fine? | |
267 |
|
267 | |||
268 | alltags = {} # map tag name to (node, hist) |
|
268 | alltags = {} # map tag name to (node, hist) | |
269 | tagtypes = {} |
|
269 | tagtypes = {} | |
270 |
|
270 | |||
271 | tags_.findglobaltags(self.ui, self, alltags, tagtypes) |
|
271 | tags_.findglobaltags(self.ui, self, alltags, tagtypes) | |
272 | tags_.readlocaltags(self.ui, self, alltags, tagtypes) |
|
272 | tags_.readlocaltags(self.ui, self, alltags, tagtypes) | |
273 |
|
273 | |||
274 | # Build the return dicts. Have to re-encode tag names because |
|
274 | # Build the return dicts. Have to re-encode tag names because | |
275 | # the tags module always uses UTF-8 (in order not to lose info |
|
275 | # the tags module always uses UTF-8 (in order not to lose info | |
276 | # writing to the cache), but the rest of Mercurial wants them in |
|
276 | # writing to the cache), but the rest of Mercurial wants them in | |
277 | # local encoding. |
|
277 | # local encoding. | |
278 | tags = {} |
|
278 | tags = {} | |
279 | for (name, (node, hist)) in alltags.iteritems(): |
|
279 | for (name, (node, hist)) in alltags.iteritems(): | |
280 | if node != nullid: |
|
280 | if node != nullid: | |
281 | tags[encoding.tolocal(name)] = node |
|
281 | tags[encoding.tolocal(name)] = node | |
282 | tags['tip'] = self.changelog.tip() |
|
282 | tags['tip'] = self.changelog.tip() | |
283 | tagtypes = dict([(encoding.tolocal(name), value) |
|
283 | tagtypes = dict([(encoding.tolocal(name), value) | |
284 | for (name, value) in tagtypes.iteritems()]) |
|
284 | for (name, value) in tagtypes.iteritems()]) | |
285 | return (tags, tagtypes) |
|
285 | return (tags, tagtypes) | |
286 |
|
286 | |||
287 | def tagtype(self, tagname): |
|
287 | def tagtype(self, tagname): | |
288 | ''' |
|
288 | ''' | |
289 | return the type of the given tag. result can be: |
|
289 | return the type of the given tag. result can be: | |
290 |
|
290 | |||
291 | 'local' : a local tag |
|
291 | 'local' : a local tag | |
292 | 'global' : a global tag |
|
292 | 'global' : a global tag | |
293 | None : tag does not exist |
|
293 | None : tag does not exist | |
294 | ''' |
|
294 | ''' | |
295 |
|
295 | |||
296 | self.tags() |
|
296 | self.tags() | |
297 |
|
297 | |||
298 | return self._tagtypes.get(tagname) |
|
298 | return self._tagtypes.get(tagname) | |
299 |
|
299 | |||
300 | def tagslist(self): |
|
300 | def tagslist(self): | |
301 | '''return a list of tags ordered by revision''' |
|
301 | '''return a list of tags ordered by revision''' | |
302 | l = [] |
|
302 | l = [] | |
303 | for t, n in self.tags().iteritems(): |
|
303 | for t, n in self.tags().iteritems(): | |
304 | try: |
|
304 | try: | |
305 | r = self.changelog.rev(n) |
|
305 | r = self.changelog.rev(n) | |
306 | except: |
|
306 | except: | |
307 | r = -2 # sort to the beginning of the list if unknown |
|
307 | r = -2 # sort to the beginning of the list if unknown | |
308 | l.append((r, t, n)) |
|
308 | l.append((r, t, n)) | |
309 | return [(t, n) for r, t, n in sorted(l)] |
|
309 | return [(t, n) for r, t, n in sorted(l)] | |
310 |
|
310 | |||
311 | def nodetags(self, node): |
|
311 | def nodetags(self, node): | |
312 | '''return the tags associated with a node''' |
|
312 | '''return the tags associated with a node''' | |
313 | if not self.nodetagscache: |
|
313 | if not self.nodetagscache: | |
314 | self.nodetagscache = {} |
|
314 | self.nodetagscache = {} | |
315 | for t, n in self.tags().iteritems(): |
|
315 | for t, n in self.tags().iteritems(): | |
316 | self.nodetagscache.setdefault(n, []).append(t) |
|
316 | self.nodetagscache.setdefault(n, []).append(t) | |
317 | return self.nodetagscache.get(node, []) |
|
317 | return self.nodetagscache.get(node, []) | |
318 |
|
318 | |||
319 | def _branchtags(self, partial, lrev): |
|
319 | def _branchtags(self, partial, lrev): | |
320 | # TODO: rename this function? |
|
320 | # TODO: rename this function? | |
321 | tiprev = len(self) - 1 |
|
321 | tiprev = len(self) - 1 | |
322 | if lrev != tiprev: |
|
322 | if lrev != tiprev: | |
323 | self._updatebranchcache(partial, lrev + 1, tiprev + 1) |
|
323 | self._updatebranchcache(partial, lrev + 1, tiprev + 1) | |
324 | self._writebranchcache(partial, self.changelog.tip(), tiprev) |
|
324 | self._writebranchcache(partial, self.changelog.tip(), tiprev) | |
325 |
|
325 | |||
326 | return partial |
|
326 | return partial | |
327 |
|
327 | |||
328 | def branchmap(self): |
|
328 | def branchmap(self): | |
329 | '''returns a dictionary {branch: [branchheads]}''' |
|
329 | '''returns a dictionary {branch: [branchheads]}''' | |
330 | tip = self.changelog.tip() |
|
330 | tip = self.changelog.tip() | |
331 | if self._branchcache is not None and self._branchcachetip == tip: |
|
331 | if self._branchcache is not None and self._branchcachetip == tip: | |
332 | return self._branchcache |
|
332 | return self._branchcache | |
333 |
|
333 | |||
334 | oldtip = self._branchcachetip |
|
334 | oldtip = self._branchcachetip | |
335 | self._branchcachetip = tip |
|
335 | self._branchcachetip = tip | |
336 | if oldtip is None or oldtip not in self.changelog.nodemap: |
|
336 | if oldtip is None or oldtip not in self.changelog.nodemap: | |
337 | partial, last, lrev = self._readbranchcache() |
|
337 | partial, last, lrev = self._readbranchcache() | |
338 | else: |
|
338 | else: | |
339 | lrev = self.changelog.rev(oldtip) |
|
339 | lrev = self.changelog.rev(oldtip) | |
340 | partial = self._branchcache |
|
340 | partial = self._branchcache | |
341 |
|
341 | |||
342 | self._branchtags(partial, lrev) |
|
342 | self._branchtags(partial, lrev) | |
343 | # this private cache holds all heads (not just tips) |
|
343 | # this private cache holds all heads (not just tips) | |
344 | self._branchcache = partial |
|
344 | self._branchcache = partial | |
345 |
|
345 | |||
346 | return self._branchcache |
|
346 | return self._branchcache | |
347 |
|
347 | |||
348 | def branchtags(self): |
|
348 | def branchtags(self): | |
349 | '''return a dict where branch names map to the tipmost head of |
|
349 | '''return a dict where branch names map to the tipmost head of | |
350 | the branch, open heads come before closed''' |
|
350 | the branch, open heads come before closed''' | |
351 | bt = {} |
|
351 | bt = {} | |
352 | for bn, heads in self.branchmap().iteritems(): |
|
352 | for bn, heads in self.branchmap().iteritems(): | |
353 | tip = heads[-1] |
|
353 | tip = heads[-1] | |
354 | for h in reversed(heads): |
|
354 | for h in reversed(heads): | |
355 | if 'close' not in self.changelog.read(h)[5]: |
|
355 | if 'close' not in self.changelog.read(h)[5]: | |
356 | tip = h |
|
356 | tip = h | |
357 | break |
|
357 | break | |
358 | bt[bn] = tip |
|
358 | bt[bn] = tip | |
359 | return bt |
|
359 | return bt | |
360 |
|
360 | |||
361 |
|
361 | |||
362 | def _readbranchcache(self): |
|
362 | def _readbranchcache(self): | |
363 | partial = {} |
|
363 | partial = {} | |
364 | try: |
|
364 | try: | |
365 | f = self.opener("branchheads.cache") |
|
365 | f = self.opener("branchheads.cache") | |
366 | lines = f.read().split('\n') |
|
366 | lines = f.read().split('\n') | |
367 | f.close() |
|
367 | f.close() | |
368 | except (IOError, OSError): |
|
368 | except (IOError, OSError): | |
369 | return {}, nullid, nullrev |
|
369 | return {}, nullid, nullrev | |
370 |
|
370 | |||
371 | try: |
|
371 | try: | |
372 | last, lrev = lines.pop(0).split(" ", 1) |
|
372 | last, lrev = lines.pop(0).split(" ", 1) | |
373 | last, lrev = bin(last), int(lrev) |
|
373 | last, lrev = bin(last), int(lrev) | |
374 | if lrev >= len(self) or self[lrev].node() != last: |
|
374 | if lrev >= len(self) or self[lrev].node() != last: | |
375 | # invalidate the cache |
|
375 | # invalidate the cache | |
376 | raise ValueError('invalidating branch cache (tip differs)') |
|
376 | raise ValueError('invalidating branch cache (tip differs)') | |
377 | for l in lines: |
|
377 | for l in lines: | |
378 | if not l: |
|
378 | if not l: | |
379 | continue |
|
379 | continue | |
380 | node, label = l.split(" ", 1) |
|
380 | node, label = l.split(" ", 1) | |
381 | partial.setdefault(label.strip(), []).append(bin(node)) |
|
381 | partial.setdefault(label.strip(), []).append(bin(node)) | |
382 | except KeyboardInterrupt: |
|
382 | except KeyboardInterrupt: | |
383 | raise |
|
383 | raise | |
384 | except Exception, inst: |
|
384 | except Exception, inst: | |
385 | if self.ui.debugflag: |
|
385 | if self.ui.debugflag: | |
386 | self.ui.warn(str(inst), '\n') |
|
386 | self.ui.warn(str(inst), '\n') | |
387 | partial, last, lrev = {}, nullid, nullrev |
|
387 | partial, last, lrev = {}, nullid, nullrev | |
388 | return partial, last, lrev |
|
388 | return partial, last, lrev | |
389 |
|
389 | |||
390 | def _writebranchcache(self, branches, tip, tiprev): |
|
390 | def _writebranchcache(self, branches, tip, tiprev): | |
391 | try: |
|
391 | try: | |
392 | f = self.opener("branchheads.cache", "w", atomictemp=True) |
|
392 | f = self.opener("branchheads.cache", "w", atomictemp=True) | |
393 | f.write("%s %s\n" % (hex(tip), tiprev)) |
|
393 | f.write("%s %s\n" % (hex(tip), tiprev)) | |
394 | for label, nodes in branches.iteritems(): |
|
394 | for label, nodes in branches.iteritems(): | |
395 | for node in nodes: |
|
395 | for node in nodes: | |
396 | f.write("%s %s\n" % (hex(node), label)) |
|
396 | f.write("%s %s\n" % (hex(node), label)) | |
397 | f.rename() |
|
397 | f.rename() | |
398 | except (IOError, OSError): |
|
398 | except (IOError, OSError): | |
399 | pass |
|
399 | pass | |
400 |
|
400 | |||
401 | def _updatebranchcache(self, partial, start, end): |
|
401 | def _updatebranchcache(self, partial, start, end): | |
402 | # collect new branch entries |
|
402 | # collect new branch entries | |
403 | newbranches = {} |
|
403 | newbranches = {} | |
404 | for r in xrange(start, end): |
|
404 | for r in xrange(start, end): | |
405 | c = self[r] |
|
405 | c = self[r] | |
406 | newbranches.setdefault(c.branch(), []).append(c.node()) |
|
406 | newbranches.setdefault(c.branch(), []).append(c.node()) | |
407 | # if older branchheads are reachable from new ones, they aren't |
|
407 | # if older branchheads are reachable from new ones, they aren't | |
408 | # really branchheads. Note checking parents is insufficient: |
|
408 | # really branchheads. Note checking parents is insufficient: | |
409 | # 1 (branch a) -> 2 (branch b) -> 3 (branch a) |
|
409 | # 1 (branch a) -> 2 (branch b) -> 3 (branch a) | |
410 | for branch, newnodes in newbranches.iteritems(): |
|
410 | for branch, newnodes in newbranches.iteritems(): | |
411 | bheads = partial.setdefault(branch, []) |
|
411 | bheads = partial.setdefault(branch, []) | |
412 | bheads.extend(newnodes) |
|
412 | bheads.extend(newnodes) | |
413 | if len(bheads) < 2: |
|
413 | if len(bheads) < 2: | |
414 | continue |
|
414 | continue | |
415 | newbheads = [] |
|
415 | newbheads = [] | |
416 | # starting from tip means fewer passes over reachable |
|
416 | # starting from tip means fewer passes over reachable | |
417 | while newnodes: |
|
417 | while newnodes: | |
418 | latest = newnodes.pop() |
|
418 | latest = newnodes.pop() | |
419 | if latest not in bheads: |
|
419 | if latest not in bheads: | |
420 | continue |
|
420 | continue | |
421 | minbhrev = self[min([self[bh].rev() for bh in bheads])].node() |
|
421 | minbhrev = self[min([self[bh].rev() for bh in bheads])].node() | |
422 | reachable = self.changelog.reachable(latest, minbhrev) |
|
422 | reachable = self.changelog.reachable(latest, minbhrev) | |
423 | bheads = [b for b in bheads if b not in reachable] |
|
423 | bheads = [b for b in bheads if b not in reachable] | |
424 | newbheads.insert(0, latest) |
|
424 | newbheads.insert(0, latest) | |
425 | bheads.extend(newbheads) |
|
425 | bheads.extend(newbheads) | |
426 | partial[branch] = bheads |
|
426 | partial[branch] = bheads | |
427 |
|
427 | |||
428 | def lookup(self, key): |
|
428 | def lookup(self, key): | |
429 | if isinstance(key, int): |
|
429 | if isinstance(key, int): | |
430 | return self.changelog.node(key) |
|
430 | return self.changelog.node(key) | |
431 | elif key == '.': |
|
431 | elif key == '.': | |
432 | return self.dirstate.parents()[0] |
|
432 | return self.dirstate.parents()[0] | |
433 | elif key == 'null': |
|
433 | elif key == 'null': | |
434 | return nullid |
|
434 | return nullid | |
435 | elif key == 'tip': |
|
435 | elif key == 'tip': | |
436 | return self.changelog.tip() |
|
436 | return self.changelog.tip() | |
437 | n = self.changelog._match(key) |
|
437 | n = self.changelog._match(key) | |
438 | if n: |
|
438 | if n: | |
439 | return n |
|
439 | return n | |
440 | if key in self.tags(): |
|
440 | if key in self.tags(): | |
441 | return self.tags()[key] |
|
441 | return self.tags()[key] | |
442 | if key in self.branchtags(): |
|
442 | if key in self.branchtags(): | |
443 | return self.branchtags()[key] |
|
443 | return self.branchtags()[key] | |
444 | n = self.changelog._partialmatch(key) |
|
444 | n = self.changelog._partialmatch(key) | |
445 | if n: |
|
445 | if n: | |
446 | return n |
|
446 | return n | |
447 |
|
447 | |||
448 | # can't find key, check if it might have come from damaged dirstate |
|
448 | # can't find key, check if it might have come from damaged dirstate | |
449 | if key in self.dirstate.parents(): |
|
449 | if key in self.dirstate.parents(): | |
450 | raise error.Abort(_("working directory has unknown parent '%s'!") |
|
450 | raise error.Abort(_("working directory has unknown parent '%s'!") | |
451 | % short(key)) |
|
451 | % short(key)) | |
452 | try: |
|
452 | try: | |
453 | if len(key) == 20: |
|
453 | if len(key) == 20: | |
454 | key = hex(key) |
|
454 | key = hex(key) | |
455 | except: |
|
455 | except: | |
456 | pass |
|
456 | pass | |
457 | raise error.RepoLookupError(_("unknown revision '%s'") % key) |
|
457 | raise error.RepoLookupError(_("unknown revision '%s'") % key) | |
458 |
|
458 | |||
459 | def local(self): |
|
459 | def local(self): | |
460 | return True |
|
460 | return True | |
461 |
|
461 | |||
462 | def join(self, f): |
|
462 | def join(self, f): | |
463 | return os.path.join(self.path, f) |
|
463 | return os.path.join(self.path, f) | |
464 |
|
464 | |||
465 | def wjoin(self, f): |
|
465 | def wjoin(self, f): | |
466 | return os.path.join(self.root, f) |
|
466 | return os.path.join(self.root, f) | |
467 |
|
467 | |||
468 | def rjoin(self, f): |
|
468 | def rjoin(self, f): | |
469 | return os.path.join(self.root, util.pconvert(f)) |
|
469 | return os.path.join(self.root, util.pconvert(f)) | |
470 |
|
470 | |||
471 | def file(self, f): |
|
471 | def file(self, f): | |
472 | if f[0] == '/': |
|
472 | if f[0] == '/': | |
473 | f = f[1:] |
|
473 | f = f[1:] | |
474 | return filelog.filelog(self.sopener, f) |
|
474 | return filelog.filelog(self.sopener, f) | |
475 |
|
475 | |||
476 | def changectx(self, changeid): |
|
476 | def changectx(self, changeid): | |
477 | return self[changeid] |
|
477 | return self[changeid] | |
478 |
|
478 | |||
479 | def parents(self, changeid=None): |
|
479 | def parents(self, changeid=None): | |
480 | '''get list of changectxs for parents of changeid''' |
|
480 | '''get list of changectxs for parents of changeid''' | |
481 | return self[changeid].parents() |
|
481 | return self[changeid].parents() | |
482 |
|
482 | |||
483 | def filectx(self, path, changeid=None, fileid=None): |
|
483 | def filectx(self, path, changeid=None, fileid=None): | |
484 | """changeid can be a changeset revision, node, or tag. |
|
484 | """changeid can be a changeset revision, node, or tag. | |
485 | fileid can be a file revision or node.""" |
|
485 | fileid can be a file revision or node.""" | |
486 | return context.filectx(self, path, changeid, fileid) |
|
486 | return context.filectx(self, path, changeid, fileid) | |
487 |
|
487 | |||
488 | def getcwd(self): |
|
488 | def getcwd(self): | |
489 | return self.dirstate.getcwd() |
|
489 | return self.dirstate.getcwd() | |
490 |
|
490 | |||
491 | def pathto(self, f, cwd=None): |
|
491 | def pathto(self, f, cwd=None): | |
492 | return self.dirstate.pathto(f, cwd) |
|
492 | return self.dirstate.pathto(f, cwd) | |
493 |
|
493 | |||
494 | def wfile(self, f, mode='r'): |
|
494 | def wfile(self, f, mode='r'): | |
495 | return self.wopener(f, mode) |
|
495 | return self.wopener(f, mode) | |
496 |
|
496 | |||
497 | def _link(self, f): |
|
497 | def _link(self, f): | |
498 | return os.path.islink(self.wjoin(f)) |
|
498 | return os.path.islink(self.wjoin(f)) | |
499 |
|
499 | |||
500 | def _filter(self, filter, filename, data): |
|
500 | def _filter(self, filter, filename, data): | |
501 | if filter not in self.filterpats: |
|
501 | if filter not in self.filterpats: | |
502 | l = [] |
|
502 | l = [] | |
503 | for pat, cmd in self.ui.configitems(filter): |
|
503 | for pat, cmd in self.ui.configitems(filter): | |
504 | if cmd == '!': |
|
504 | if cmd == '!': | |
505 | continue |
|
505 | continue | |
506 | mf = match_.match(self.root, '', [pat]) |
|
506 | mf = match_.match(self.root, '', [pat]) | |
507 | fn = None |
|
507 | fn = None | |
508 | params = cmd |
|
508 | params = cmd | |
509 | for name, filterfn in self._datafilters.iteritems(): |
|
509 | for name, filterfn in self._datafilters.iteritems(): | |
510 | if cmd.startswith(name): |
|
510 | if cmd.startswith(name): | |
511 | fn = filterfn |
|
511 | fn = filterfn | |
512 | params = cmd[len(name):].lstrip() |
|
512 | params = cmd[len(name):].lstrip() | |
513 | break |
|
513 | break | |
514 | if not fn: |
|
514 | if not fn: | |
515 | fn = lambda s, c, **kwargs: util.filter(s, c) |
|
515 | fn = lambda s, c, **kwargs: util.filter(s, c) | |
516 | # Wrap old filters not supporting keyword arguments |
|
516 | # Wrap old filters not supporting keyword arguments | |
517 | if not inspect.getargspec(fn)[2]: |
|
517 | if not inspect.getargspec(fn)[2]: | |
518 | oldfn = fn |
|
518 | oldfn = fn | |
519 | fn = lambda s, c, **kwargs: oldfn(s, c) |
|
519 | fn = lambda s, c, **kwargs: oldfn(s, c) | |
520 | l.append((mf, fn, params)) |
|
520 | l.append((mf, fn, params)) | |
521 | self.filterpats[filter] = l |
|
521 | self.filterpats[filter] = l | |
522 |
|
522 | |||
523 | for mf, fn, cmd in self.filterpats[filter]: |
|
523 | for mf, fn, cmd in self.filterpats[filter]: | |
524 | if mf(filename): |
|
524 | if mf(filename): | |
525 | self.ui.debug("filtering %s through %s\n" % (filename, cmd)) |
|
525 | self.ui.debug("filtering %s through %s\n" % (filename, cmd)) | |
526 | data = fn(data, cmd, ui=self.ui, repo=self, filename=filename) |
|
526 | data = fn(data, cmd, ui=self.ui, repo=self, filename=filename) | |
527 | break |
|
527 | break | |
528 |
|
528 | |||
529 | return data |
|
529 | return data | |
530 |
|
530 | |||
531 | def adddatafilter(self, name, filter): |
|
531 | def adddatafilter(self, name, filter): | |
532 | self._datafilters[name] = filter |
|
532 | self._datafilters[name] = filter | |
533 |
|
533 | |||
534 | def wread(self, filename): |
|
534 | def wread(self, filename): | |
535 | if self._link(filename): |
|
535 | if self._link(filename): | |
536 | data = os.readlink(self.wjoin(filename)) |
|
536 | data = os.readlink(self.wjoin(filename)) | |
537 | else: |
|
537 | else: | |
538 | data = self.wopener(filename, 'r').read() |
|
538 | data = self.wopener(filename, 'r').read() | |
539 | return self._filter("encode", filename, data) |
|
539 | return self._filter("encode", filename, data) | |
540 |
|
540 | |||
541 | def wwrite(self, filename, data, flags): |
|
541 | def wwrite(self, filename, data, flags): | |
542 | data = self._filter("decode", filename, data) |
|
542 | data = self._filter("decode", filename, data) | |
543 | try: |
|
543 | try: | |
544 | os.unlink(self.wjoin(filename)) |
|
544 | os.unlink(self.wjoin(filename)) | |
545 | except OSError: |
|
545 | except OSError: | |
546 | pass |
|
546 | pass | |
547 | if 'l' in flags: |
|
547 | if 'l' in flags: | |
548 | self.wopener.symlink(data, filename) |
|
548 | self.wopener.symlink(data, filename) | |
549 | else: |
|
549 | else: | |
550 | self.wopener(filename, 'w').write(data) |
|
550 | self.wopener(filename, 'w').write(data) | |
551 | if 'x' in flags: |
|
551 | if 'x' in flags: | |
552 | util.set_flags(self.wjoin(filename), False, True) |
|
552 | util.set_flags(self.wjoin(filename), False, True) | |
553 |
|
553 | |||
554 | def wwritedata(self, filename, data): |
|
554 | def wwritedata(self, filename, data): | |
555 | return self._filter("decode", filename, data) |
|
555 | return self._filter("decode", filename, data) | |
556 |
|
556 | |||
557 | def transaction(self): |
|
557 | def transaction(self): | |
558 | tr = self._transref and self._transref() or None |
|
558 | tr = self._transref and self._transref() or None | |
559 | if tr and tr.running(): |
|
559 | if tr and tr.running(): | |
560 | return tr.nest() |
|
560 | return tr.nest() | |
561 |
|
561 | |||
562 | # abort here if the journal already exists |
|
562 | # abort here if the journal already exists | |
563 | if os.path.exists(self.sjoin("journal")): |
|
563 | if os.path.exists(self.sjoin("journal")): | |
564 | raise error.RepoError( |
|
564 | raise error.RepoError( | |
565 | _("abandoned transaction found - run hg recover")) |
|
565 | _("abandoned transaction found - run hg recover")) | |
566 |
|
566 | |||
567 | # save dirstate for rollback |
|
567 | # save dirstate for rollback | |
568 | try: |
|
568 | try: | |
569 | ds = self.opener("dirstate").read() |
|
569 | ds = self.opener("dirstate").read() | |
570 | except IOError: |
|
570 | except IOError: | |
571 | ds = "" |
|
571 | ds = "" | |
572 | self.opener("journal.dirstate", "w").write(ds) |
|
572 | self.opener("journal.dirstate", "w").write(ds) | |
573 | self.opener("journal.branch", "w").write(self.dirstate.branch()) |
|
573 | self.opener("journal.branch", "w").write(self.dirstate.branch()) | |
574 |
|
574 | |||
575 | renames = [(self.sjoin("journal"), self.sjoin("undo")), |
|
575 | renames = [(self.sjoin("journal"), self.sjoin("undo")), | |
576 | (self.join("journal.dirstate"), self.join("undo.dirstate")), |
|
576 | (self.join("journal.dirstate"), self.join("undo.dirstate")), | |
577 | (self.join("journal.branch"), self.join("undo.branch"))] |
|
577 | (self.join("journal.branch"), self.join("undo.branch"))] | |
578 | tr = transaction.transaction(self.ui.warn, self.sopener, |
|
578 | tr = transaction.transaction(self.ui.warn, self.sopener, | |
579 | self.sjoin("journal"), |
|
579 | self.sjoin("journal"), | |
580 | aftertrans(renames), |
|
580 | aftertrans(renames), | |
581 | self.store.createmode) |
|
581 | self.store.createmode) | |
582 | self._transref = weakref.ref(tr) |
|
582 | self._transref = weakref.ref(tr) | |
583 | return tr |
|
583 | return tr | |
584 |
|
584 | |||
585 | def recover(self): |
|
585 | def recover(self): | |
586 | lock = self.lock() |
|
586 | lock = self.lock() | |
587 | try: |
|
587 | try: | |
588 | if os.path.exists(self.sjoin("journal")): |
|
588 | if os.path.exists(self.sjoin("journal")): | |
589 | self.ui.status(_("rolling back interrupted transaction\n")) |
|
589 | self.ui.status(_("rolling back interrupted transaction\n")) | |
590 | transaction.rollback(self.sopener, self.sjoin("journal"), |
|
590 | transaction.rollback(self.sopener, self.sjoin("journal"), | |
591 | self.ui.warn) |
|
591 | self.ui.warn) | |
592 | self.invalidate() |
|
592 | self.invalidate() | |
593 | return True |
|
593 | return True | |
594 | else: |
|
594 | else: | |
595 | self.ui.warn(_("no interrupted transaction available\n")) |
|
595 | self.ui.warn(_("no interrupted transaction available\n")) | |
596 | return False |
|
596 | return False | |
597 | finally: |
|
597 | finally: | |
598 | lock.release() |
|
598 | lock.release() | |
599 |
|
599 | |||
600 | def rollback(self): |
|
600 | def rollback(self): | |
601 | wlock = lock = None |
|
601 | wlock = lock = None | |
602 | try: |
|
602 | try: | |
603 | wlock = self.wlock() |
|
603 | wlock = self.wlock() | |
604 | lock = self.lock() |
|
604 | lock = self.lock() | |
605 | if os.path.exists(self.sjoin("undo")): |
|
605 | if os.path.exists(self.sjoin("undo")): | |
606 | self.ui.status(_("rolling back last transaction\n")) |
|
606 | self.ui.status(_("rolling back last transaction\n")) | |
607 | transaction.rollback(self.sopener, self.sjoin("undo"), |
|
607 | transaction.rollback(self.sopener, self.sjoin("undo"), | |
608 | self.ui.warn) |
|
608 | self.ui.warn) | |
609 | util.rename(self.join("undo.dirstate"), self.join("dirstate")) |
|
609 | util.rename(self.join("undo.dirstate"), self.join("dirstate")) | |
610 | try: |
|
610 | try: | |
611 | branch = self.opener("undo.branch").read() |
|
611 | branch = self.opener("undo.branch").read() | |
612 | self.dirstate.setbranch(branch) |
|
612 | self.dirstate.setbranch(branch) | |
613 | except IOError: |
|
613 | except IOError: | |
614 | self.ui.warn(_("Named branch could not be reset, " |
|
614 | self.ui.warn(_("Named branch could not be reset, " | |
615 | "current branch still is: %s\n") |
|
615 | "current branch still is: %s\n") | |
616 | % encoding.tolocal(self.dirstate.branch())) |
|
616 | % encoding.tolocal(self.dirstate.branch())) | |
617 | self.invalidate() |
|
617 | self.invalidate() | |
618 | self.dirstate.invalidate() |
|
618 | self.dirstate.invalidate() | |
619 | self.destroyed() |
|
619 | self.destroyed() | |
620 | else: |
|
620 | else: | |
621 | self.ui.warn(_("no rollback information available\n")) |
|
621 | self.ui.warn(_("no rollback information available\n")) | |
622 | finally: |
|
622 | finally: | |
623 | release(lock, wlock) |
|
623 | release(lock, wlock) | |
624 |
|
624 | |||
625 | def invalidate(self): |
|
625 | def invalidate(self): | |
626 | for a in "changelog manifest".split(): |
|
626 | for a in "changelog manifest".split(): | |
627 | if a in self.__dict__: |
|
627 | if a in self.__dict__: | |
628 | delattr(self, a) |
|
628 | delattr(self, a) | |
629 | self._tags = None |
|
629 | self._tags = None | |
630 | self._tagtypes = None |
|
630 | self._tagtypes = None | |
631 | self.nodetagscache = None |
|
631 | self.nodetagscache = None | |
632 | self._branchcache = None # in UTF-8 |
|
632 | self._branchcache = None # in UTF-8 | |
633 | self._branchcachetip = None |
|
633 | self._branchcachetip = None | |
634 |
|
634 | |||
635 | def _lock(self, lockname, wait, releasefn, acquirefn, desc): |
|
635 | def _lock(self, lockname, wait, releasefn, acquirefn, desc): | |
636 | try: |
|
636 | try: | |
637 | l = lock.lock(lockname, 0, releasefn, desc=desc) |
|
637 | l = lock.lock(lockname, 0, releasefn, desc=desc) | |
638 | except error.LockHeld, inst: |
|
638 | except error.LockHeld, inst: | |
639 | if not wait: |
|
639 | if not wait: | |
640 | raise |
|
640 | raise | |
641 | self.ui.warn(_("waiting for lock on %s held by %r\n") % |
|
641 | self.ui.warn(_("waiting for lock on %s held by %r\n") % | |
642 | (desc, inst.locker)) |
|
642 | (desc, inst.locker)) | |
643 | # default to 600 seconds timeout |
|
643 | # default to 600 seconds timeout | |
644 | l = lock.lock(lockname, int(self.ui.config("ui", "timeout", "600")), |
|
644 | l = lock.lock(lockname, int(self.ui.config("ui", "timeout", "600")), | |
645 | releasefn, desc=desc) |
|
645 | releasefn, desc=desc) | |
646 | if acquirefn: |
|
646 | if acquirefn: | |
647 | acquirefn() |
|
647 | acquirefn() | |
648 | return l |
|
648 | return l | |
649 |
|
649 | |||
650 | def lock(self, wait=True): |
|
650 | def lock(self, wait=True): | |
651 | '''Lock the repository store (.hg/store) and return a weak reference |
|
651 | '''Lock the repository store (.hg/store) and return a weak reference | |
652 | to the lock. Use this before modifying the store (e.g. committing or |
|
652 | to the lock. Use this before modifying the store (e.g. committing or | |
653 | stripping). If you are opening a transaction, get a lock as well.)''' |
|
653 | stripping). If you are opening a transaction, get a lock as well.)''' | |
654 | l = self._lockref and self._lockref() |
|
654 | l = self._lockref and self._lockref() | |
655 | if l is not None and l.held: |
|
655 | if l is not None and l.held: | |
656 | l.lock() |
|
656 | l.lock() | |
657 | return l |
|
657 | return l | |
658 |
|
658 | |||
659 | l = self._lock(self.sjoin("lock"), wait, None, self.invalidate, |
|
659 | l = self._lock(self.sjoin("lock"), wait, None, self.invalidate, | |
660 | _('repository %s') % self.origroot) |
|
660 | _('repository %s') % self.origroot) | |
661 | self._lockref = weakref.ref(l) |
|
661 | self._lockref = weakref.ref(l) | |
662 | return l |
|
662 | return l | |
663 |
|
663 | |||
664 | def wlock(self, wait=True): |
|
664 | def wlock(self, wait=True): | |
665 | '''Lock the non-store parts of the repository (everything under |
|
665 | '''Lock the non-store parts of the repository (everything under | |
666 | .hg except .hg/store) and return a weak reference to the lock. |
|
666 | .hg except .hg/store) and return a weak reference to the lock. | |
667 | Use this before modifying files in .hg.''' |
|
667 | Use this before modifying files in .hg.''' | |
668 | l = self._wlockref and self._wlockref() |
|
668 | l = self._wlockref and self._wlockref() | |
669 | if l is not None and l.held: |
|
669 | if l is not None and l.held: | |
670 | l.lock() |
|
670 | l.lock() | |
671 | return l |
|
671 | return l | |
672 |
|
672 | |||
673 | l = self._lock(self.join("wlock"), wait, self.dirstate.write, |
|
673 | l = self._lock(self.join("wlock"), wait, self.dirstate.write, | |
674 | self.dirstate.invalidate, _('working directory of %s') % |
|
674 | self.dirstate.invalidate, _('working directory of %s') % | |
675 | self.origroot) |
|
675 | self.origroot) | |
676 | self._wlockref = weakref.ref(l) |
|
676 | self._wlockref = weakref.ref(l) | |
677 | return l |
|
677 | return l | |
678 |
|
678 | |||
679 | def _filecommit(self, fctx, manifest1, manifest2, linkrev, tr, changelist): |
|
679 | def _filecommit(self, fctx, manifest1, manifest2, linkrev, tr, changelist): | |
680 | """ |
|
680 | """ | |
681 | commit an individual file as part of a larger transaction |
|
681 | commit an individual file as part of a larger transaction | |
682 | """ |
|
682 | """ | |
683 |
|
683 | |||
684 | fname = fctx.path() |
|
684 | fname = fctx.path() | |
685 | text = fctx.data() |
|
685 | text = fctx.data() | |
686 | flog = self.file(fname) |
|
686 | flog = self.file(fname) | |
687 | fparent1 = manifest1.get(fname, nullid) |
|
687 | fparent1 = manifest1.get(fname, nullid) | |
688 | fparent2 = fparent2o = manifest2.get(fname, nullid) |
|
688 | fparent2 = fparent2o = manifest2.get(fname, nullid) | |
689 |
|
689 | |||
690 | meta = {} |
|
690 | meta = {} | |
691 | copy = fctx.renamed() |
|
691 | copy = fctx.renamed() | |
692 | if copy and copy[0] != fname: |
|
692 | if copy and copy[0] != fname: | |
693 | # Mark the new revision of this file as a copy of another |
|
693 | # Mark the new revision of this file as a copy of another | |
694 | # file. This copy data will effectively act as a parent |
|
694 | # file. This copy data will effectively act as a parent | |
695 | # of this new revision. If this is a merge, the first |
|
695 | # of this new revision. If this is a merge, the first | |
696 | # parent will be the nullid (meaning "look up the copy data") |
|
696 | # parent will be the nullid (meaning "look up the copy data") | |
697 | # and the second one will be the other parent. For example: |
|
697 | # and the second one will be the other parent. For example: | |
698 | # |
|
698 | # | |
699 | # 0 --- 1 --- 3 rev1 changes file foo |
|
699 | # 0 --- 1 --- 3 rev1 changes file foo | |
700 | # \ / rev2 renames foo to bar and changes it |
|
700 | # \ / rev2 renames foo to bar and changes it | |
701 | # \- 2 -/ rev3 should have bar with all changes and |
|
701 | # \- 2 -/ rev3 should have bar with all changes and | |
702 | # should record that bar descends from |
|
702 | # should record that bar descends from | |
703 | # bar in rev2 and foo in rev1 |
|
703 | # bar in rev2 and foo in rev1 | |
704 | # |
|
704 | # | |
705 | # this allows this merge to succeed: |
|
705 | # this allows this merge to succeed: | |
706 | # |
|
706 | # | |
707 | # 0 --- 1 --- 3 rev4 reverts the content change from rev2 |
|
707 | # 0 --- 1 --- 3 rev4 reverts the content change from rev2 | |
708 | # \ / merging rev3 and rev4 should use bar@rev2 |
|
708 | # \ / merging rev3 and rev4 should use bar@rev2 | |
709 | # \- 2 --- 4 as the merge base |
|
709 | # \- 2 --- 4 as the merge base | |
710 | # |
|
710 | # | |
711 |
|
711 | |||
712 | cfname = copy[0] |
|
712 | cfname = copy[0] | |
713 | crev = manifest1.get(cfname) |
|
713 | crev = manifest1.get(cfname) | |
714 | newfparent = fparent2 |
|
714 | newfparent = fparent2 | |
715 |
|
715 | |||
716 | if manifest2: # branch merge |
|
716 | if manifest2: # branch merge | |
717 | if fparent2 == nullid or crev is None: # copied on remote side |
|
717 | if fparent2 == nullid or crev is None: # copied on remote side | |
718 | if cfname in manifest2: |
|
718 | if cfname in manifest2: | |
719 | crev = manifest2[cfname] |
|
719 | crev = manifest2[cfname] | |
720 | newfparent = fparent1 |
|
720 | newfparent = fparent1 | |
721 |
|
721 | |||
722 | # find source in nearest ancestor if we've lost track |
|
722 | # find source in nearest ancestor if we've lost track | |
723 | if not crev: |
|
723 | if not crev: | |
724 | self.ui.debug(" %s: searching for copy revision for %s\n" % |
|
724 | self.ui.debug(" %s: searching for copy revision for %s\n" % | |
725 | (fname, cfname)) |
|
725 | (fname, cfname)) | |
726 | for ancestor in self['.'].ancestors(): |
|
726 | for ancestor in self['.'].ancestors(): | |
727 | if cfname in ancestor: |
|
727 | if cfname in ancestor: | |
728 | crev = ancestor[cfname].filenode() |
|
728 | crev = ancestor[cfname].filenode() | |
729 | break |
|
729 | break | |
730 |
|
730 | |||
731 | self.ui.debug(" %s: copy %s:%s\n" % (fname, cfname, hex(crev))) |
|
731 | self.ui.debug(" %s: copy %s:%s\n" % (fname, cfname, hex(crev))) | |
732 | meta["copy"] = cfname |
|
732 | meta["copy"] = cfname | |
733 | meta["copyrev"] = hex(crev) |
|
733 | meta["copyrev"] = hex(crev) | |
734 | fparent1, fparent2 = nullid, newfparent |
|
734 | fparent1, fparent2 = nullid, newfparent | |
735 | elif fparent2 != nullid: |
|
735 | elif fparent2 != nullid: | |
736 | # is one parent an ancestor of the other? |
|
736 | # is one parent an ancestor of the other? | |
737 | fparentancestor = flog.ancestor(fparent1, fparent2) |
|
737 | fparentancestor = flog.ancestor(fparent1, fparent2) | |
738 | if fparentancestor == fparent1: |
|
738 | if fparentancestor == fparent1: | |
739 | fparent1, fparent2 = fparent2, nullid |
|
739 | fparent1, fparent2 = fparent2, nullid | |
740 | elif fparentancestor == fparent2: |
|
740 | elif fparentancestor == fparent2: | |
741 | fparent2 = nullid |
|
741 | fparent2 = nullid | |
742 |
|
742 | |||
743 | # is the file changed? |
|
743 | # is the file changed? | |
744 | if fparent2 != nullid or flog.cmp(fparent1, text) or meta: |
|
744 | if fparent2 != nullid or flog.cmp(fparent1, text) or meta: | |
745 | changelist.append(fname) |
|
745 | changelist.append(fname) | |
746 | return flog.add(text, meta, tr, linkrev, fparent1, fparent2) |
|
746 | return flog.add(text, meta, tr, linkrev, fparent1, fparent2) | |
747 |
|
747 | |||
748 | # are just the flags changed during merge? |
|
748 | # are just the flags changed during merge? | |
749 | if fparent1 != fparent2o and manifest1.flags(fname) != fctx.flags(): |
|
749 | if fparent1 != fparent2o and manifest1.flags(fname) != fctx.flags(): | |
750 | changelist.append(fname) |
|
750 | changelist.append(fname) | |
751 |
|
751 | |||
752 | return fparent1 |
|
752 | return fparent1 | |
753 |
|
753 | |||
754 | def commit(self, text="", user=None, date=None, match=None, force=False, |
|
754 | def commit(self, text="", user=None, date=None, match=None, force=False, | |
755 | editor=False, extra={}): |
|
755 | editor=False, extra={}): | |
756 | """Add a new revision to current repository. |
|
756 | """Add a new revision to current repository. | |
757 |
|
757 | |||
758 | Revision information is gathered from the working directory, |
|
758 | Revision information is gathered from the working directory, | |
759 | match can be used to filter the committed files. If editor is |
|
759 | match can be used to filter the committed files. If editor is | |
760 | supplied, it is called to get a commit message. |
|
760 | supplied, it is called to get a commit message. | |
761 | """ |
|
761 | """ | |
762 |
|
762 | |||
763 | def fail(f, msg): |
|
763 | def fail(f, msg): | |
764 | raise util.Abort('%s: %s' % (f, msg)) |
|
764 | raise util.Abort('%s: %s' % (f, msg)) | |
765 |
|
765 | |||
766 | if not match: |
|
766 | if not match: | |
767 | match = match_.always(self.root, '') |
|
767 | match = match_.always(self.root, '') | |
768 |
|
768 | |||
769 | if not force: |
|
769 | if not force: | |
770 | vdirs = [] |
|
770 | vdirs = [] | |
771 | match.dir = vdirs.append |
|
771 | match.dir = vdirs.append | |
772 | match.bad = fail |
|
772 | match.bad = fail | |
773 |
|
773 | |||
774 | wlock = self.wlock() |
|
774 | wlock = self.wlock() | |
775 | try: |
|
775 | try: | |
776 | p1, p2 = self.dirstate.parents() |
|
776 | p1, p2 = self.dirstate.parents() | |
777 | wctx = self[None] |
|
777 | wctx = self[None] | |
778 |
|
778 | |||
779 | if (not force and p2 != nullid and match and |
|
779 | if (not force and p2 != nullid and match and | |
780 | (match.files() or match.anypats())): |
|
780 | (match.files() or match.anypats())): | |
781 | raise util.Abort(_('cannot partially commit a merge ' |
|
781 | raise util.Abort(_('cannot partially commit a merge ' | |
782 | '(do not specify files or patterns)')) |
|
782 | '(do not specify files or patterns)')) | |
783 |
|
783 | |||
784 | changes = self.status(match=match, clean=force) |
|
784 | changes = self.status(match=match, clean=force) | |
785 | if force: |
|
785 | if force: | |
786 | changes[0].extend(changes[6]) # mq may commit unchanged files |
|
786 | changes[0].extend(changes[6]) # mq may commit unchanged files | |
787 |
|
787 | |||
788 | # check subrepos |
|
788 | # check subrepos | |
789 | subs = [] |
|
789 | subs = [] | |
790 | for s in wctx.substate: |
|
790 | for s in wctx.substate: | |
791 | if match(s) and wctx.sub(s).dirty(): |
|
791 | if match(s) and wctx.sub(s).dirty(): | |
792 | subs.append(s) |
|
792 | subs.append(s) | |
793 | if subs and '.hgsubstate' not in changes[0]: |
|
793 | if subs and '.hgsubstate' not in changes[0]: | |
794 | changes[0].insert(0, '.hgsubstate') |
|
794 | changes[0].insert(0, '.hgsubstate') | |
795 |
|
795 | |||
796 | # make sure all explicit patterns are matched |
|
796 | # make sure all explicit patterns are matched | |
797 | if not force and match.files(): |
|
797 | if not force and match.files(): | |
798 | matched = set(changes[0] + changes[1] + changes[2]) |
|
798 | matched = set(changes[0] + changes[1] + changes[2]) | |
799 |
|
799 | |||
800 | for f in match.files(): |
|
800 | for f in match.files(): | |
801 | if f == '.' or f in matched or f in wctx.substate: |
|
801 | if f == '.' or f in matched or f in wctx.substate: | |
802 | continue |
|
802 | continue | |
803 | if f in changes[3]: # missing |
|
803 | if f in changes[3]: # missing | |
804 | fail(f, _('file not found!')) |
|
804 | fail(f, _('file not found!')) | |
805 | if f in vdirs: # visited directory |
|
805 | if f in vdirs: # visited directory | |
806 | d = f + '/' |
|
806 | d = f + '/' | |
807 | for mf in matched: |
|
807 | for mf in matched: | |
808 | if mf.startswith(d): |
|
808 | if mf.startswith(d): | |
809 | break |
|
809 | break | |
810 | else: |
|
810 | else: | |
811 | fail(f, _("no match under directory!")) |
|
811 | fail(f, _("no match under directory!")) | |
812 | elif f not in self.dirstate: |
|
812 | elif f not in self.dirstate: | |
813 | fail(f, _("file not tracked!")) |
|
813 | fail(f, _("file not tracked!")) | |
814 |
|
814 | |||
815 | if (not force and not extra.get("close") and p2 == nullid |
|
815 | if (not force and not extra.get("close") and p2 == nullid | |
816 | and not (changes[0] or changes[1] or changes[2]) |
|
816 | and not (changes[0] or changes[1] or changes[2]) | |
817 | and self[None].branch() == self['.'].branch()): |
|
817 | and self[None].branch() == self['.'].branch()): | |
818 | return None |
|
818 | return None | |
819 |
|
819 | |||
820 | ms = merge_.mergestate(self) |
|
820 | ms = merge_.mergestate(self) | |
821 | for f in changes[0]: |
|
821 | for f in changes[0]: | |
822 | if f in ms and ms[f] == 'u': |
|
822 | if f in ms and ms[f] == 'u': | |
823 | raise util.Abort(_("unresolved merge conflicts " |
|
823 | raise util.Abort(_("unresolved merge conflicts " | |
824 | "(see hg resolve)")) |
|
824 | "(see hg resolve)")) | |
825 |
|
825 | |||
826 | cctx = context.workingctx(self, (p1, p2), text, user, date, |
|
826 | cctx = context.workingctx(self, (p1, p2), text, user, date, | |
827 | extra, changes) |
|
827 | extra, changes) | |
828 | if editor: |
|
828 | if editor: | |
829 | cctx._text = editor(self, cctx, subs) |
|
829 | cctx._text = editor(self, cctx, subs) | |
830 | edited = (text != cctx._text) |
|
830 | edited = (text != cctx._text) | |
831 |
|
831 | |||
832 | # commit subs |
|
832 | # commit subs | |
833 | if subs: |
|
833 | if subs: | |
834 | state = wctx.substate.copy() |
|
834 | state = wctx.substate.copy() | |
835 | for s in subs: |
|
835 | for s in subs: | |
836 | self.ui.status(_('committing subrepository %s\n') % s) |
|
836 | self.ui.status(_('committing subrepository %s\n') % s) | |
837 | sr = wctx.sub(s).commit(cctx._text, user, date) |
|
837 | sr = wctx.sub(s).commit(cctx._text, user, date) | |
838 | state[s] = (state[s][0], sr) |
|
838 | state[s] = (state[s][0], sr) | |
839 | subrepo.writestate(self, state) |
|
839 | subrepo.writestate(self, state) | |
840 |
|
840 | |||
841 | # Save commit message in case this transaction gets rolled back |
|
841 | # Save commit message in case this transaction gets rolled back | |
842 | # (e.g. by a pretxncommit hook). Leave the content alone on |
|
842 | # (e.g. by a pretxncommit hook). Leave the content alone on | |
843 | # the assumption that the user will use the same editor again. |
|
843 | # the assumption that the user will use the same editor again. | |
844 | msgfile = self.opener('last-message.txt', 'wb') |
|
844 | msgfile = self.opener('last-message.txt', 'wb') | |
845 | msgfile.write(cctx._text) |
|
845 | msgfile.write(cctx._text) | |
846 | msgfile.close() |
|
846 | msgfile.close() | |
847 |
|
847 | |||
848 | try: |
|
848 | try: | |
849 | ret = self.commitctx(cctx, True) |
|
849 | ret = self.commitctx(cctx, True) | |
850 | except: |
|
850 | except: | |
851 | if edited: |
|
851 | if edited: | |
852 | msgfn = self.pathto(msgfile.name[len(self.root)+1:]) |
|
852 | msgfn = self.pathto(msgfile.name[len(self.root)+1:]) | |
853 | self.ui.write( |
|
853 | self.ui.write( | |
854 | _('note: commit message saved in %s\n') % msgfn) |
|
854 | _('note: commit message saved in %s\n') % msgfn) | |
855 | raise |
|
855 | raise | |
856 |
|
856 | |||
857 | # update dirstate and mergestate |
|
857 | # update dirstate and mergestate | |
858 | for f in changes[0] + changes[1]: |
|
858 | for f in changes[0] + changes[1]: | |
859 | self.dirstate.normal(f) |
|
859 | self.dirstate.normal(f) | |
860 | for f in changes[2]: |
|
860 | for f in changes[2]: | |
861 | self.dirstate.forget(f) |
|
861 | self.dirstate.forget(f) | |
862 | self.dirstate.setparents(ret) |
|
862 | self.dirstate.setparents(ret) | |
863 | ms.reset() |
|
863 | ms.reset() | |
864 |
|
864 | |||
865 | return ret |
|
865 | return ret | |
866 |
|
866 | |||
867 | finally: |
|
867 | finally: | |
868 | wlock.release() |
|
868 | wlock.release() | |
869 |
|
869 | |||
870 | def commitctx(self, ctx, error=False): |
|
870 | def commitctx(self, ctx, error=False): | |
871 | """Add a new revision to current repository. |
|
871 | """Add a new revision to current repository. | |
872 |
|
872 | |||
873 | Revision information is passed via the context argument. |
|
873 | Revision information is passed via the context argument. | |
874 | """ |
|
874 | """ | |
875 |
|
875 | |||
876 | tr = lock = None |
|
876 | tr = lock = None | |
877 | removed = ctx.removed() |
|
877 | removed = ctx.removed() | |
878 | p1, p2 = ctx.p1(), ctx.p2() |
|
878 | p1, p2 = ctx.p1(), ctx.p2() | |
879 | m1 = p1.manifest().copy() |
|
879 | m1 = p1.manifest().copy() | |
880 | m2 = p2.manifest() |
|
880 | m2 = p2.manifest() | |
881 | user = ctx.user() |
|
881 | user = ctx.user() | |
882 |
|
882 | |||
883 | xp1, xp2 = p1.hex(), p2 and p2.hex() or '' |
|
883 | xp1, xp2 = p1.hex(), p2 and p2.hex() or '' | |
884 | self.hook("precommit", throw=True, parent1=xp1, parent2=xp2) |
|
884 | self.hook("precommit", throw=True, parent1=xp1, parent2=xp2) | |
885 |
|
885 | |||
886 | lock = self.lock() |
|
886 | lock = self.lock() | |
887 | try: |
|
887 | try: | |
888 | tr = self.transaction() |
|
888 | tr = self.transaction() | |
889 | trp = weakref.proxy(tr) |
|
889 | trp = weakref.proxy(tr) | |
890 |
|
890 | |||
891 | # check in files |
|
891 | # check in files | |
892 | new = {} |
|
892 | new = {} | |
893 | changed = [] |
|
893 | changed = [] | |
894 | linkrev = len(self) |
|
894 | linkrev = len(self) | |
895 | for f in sorted(ctx.modified() + ctx.added()): |
|
895 | for f in sorted(ctx.modified() + ctx.added()): | |
896 | self.ui.note(f + "\n") |
|
896 | self.ui.note(f + "\n") | |
897 | try: |
|
897 | try: | |
898 | fctx = ctx[f] |
|
898 | fctx = ctx[f] | |
899 | new[f] = self._filecommit(fctx, m1, m2, linkrev, trp, |
|
899 | new[f] = self._filecommit(fctx, m1, m2, linkrev, trp, | |
900 | changed) |
|
900 | changed) | |
901 | m1.set(f, fctx.flags()) |
|
901 | m1.set(f, fctx.flags()) | |
902 | except OSError, inst: |
|
902 | except OSError, inst: | |
903 | self.ui.warn(_("trouble committing %s!\n") % f) |
|
903 | self.ui.warn(_("trouble committing %s!\n") % f) | |
904 | raise |
|
904 | raise | |
905 | except IOError, inst: |
|
905 | except IOError, inst: | |
906 | errcode = getattr(inst, 'errno', errno.ENOENT) |
|
906 | errcode = getattr(inst, 'errno', errno.ENOENT) | |
907 | if error or errcode and errcode != errno.ENOENT: |
|
907 | if error or errcode and errcode != errno.ENOENT: | |
908 | self.ui.warn(_("trouble committing %s!\n") % f) |
|
908 | self.ui.warn(_("trouble committing %s!\n") % f) | |
909 | raise |
|
909 | raise | |
910 | else: |
|
910 | else: | |
911 | removed.append(f) |
|
911 | removed.append(f) | |
912 |
|
912 | |||
913 | # update manifest |
|
913 | # update manifest | |
914 | m1.update(new) |
|
914 | m1.update(new) | |
915 | removed = [f for f in sorted(removed) if f in m1 or f in m2] |
|
915 | removed = [f for f in sorted(removed) if f in m1 or f in m2] | |
916 | drop = [f for f in removed if f in m1] |
|
916 | drop = [f for f in removed if f in m1] | |
917 | for f in drop: |
|
917 | for f in drop: | |
918 | del m1[f] |
|
918 | del m1[f] | |
919 | mn = self.manifest.add(m1, trp, linkrev, p1.manifestnode(), |
|
919 | mn = self.manifest.add(m1, trp, linkrev, p1.manifestnode(), | |
920 | p2.manifestnode(), (new, drop)) |
|
920 | p2.manifestnode(), (new, drop)) | |
921 |
|
921 | |||
922 | # update changelog |
|
922 | # update changelog | |
923 | self.changelog.delayupdate() |
|
923 | self.changelog.delayupdate() | |
924 | n = self.changelog.add(mn, changed + removed, ctx.description(), |
|
924 | n = self.changelog.add(mn, changed + removed, ctx.description(), | |
925 | trp, p1.node(), p2.node(), |
|
925 | trp, p1.node(), p2.node(), | |
926 | user, ctx.date(), ctx.extra().copy()) |
|
926 | user, ctx.date(), ctx.extra().copy()) | |
927 | p = lambda: self.changelog.writepending() and self.root or "" |
|
927 | p = lambda: self.changelog.writepending() and self.root or "" | |
928 | self.hook('pretxncommit', throw=True, node=hex(n), parent1=xp1, |
|
928 | self.hook('pretxncommit', throw=True, node=hex(n), parent1=xp1, | |
929 | parent2=xp2, pending=p) |
|
929 | parent2=xp2, pending=p) | |
930 | self.changelog.finalize(trp) |
|
930 | self.changelog.finalize(trp) | |
931 | tr.close() |
|
931 | tr.close() | |
932 |
|
932 | |||
933 | if self._branchcache: |
|
933 | if self._branchcache: | |
934 | self.branchtags() |
|
934 | self.branchtags() | |
935 |
|
935 | |||
936 | self.hook("commit", node=hex(n), parent1=xp1, parent2=xp2) |
|
936 | self.hook("commit", node=hex(n), parent1=xp1, parent2=xp2) | |
937 | return n |
|
937 | return n | |
938 | finally: |
|
938 | finally: | |
939 | del tr |
|
939 | del tr | |
940 | lock.release() |
|
940 | lock.release() | |
941 |
|
941 | |||
942 | def destroyed(self): |
|
942 | def destroyed(self): | |
943 | '''Inform the repository that nodes have been destroyed. |
|
943 | '''Inform the repository that nodes have been destroyed. | |
944 | Intended for use by strip and rollback, so there's a common |
|
944 | Intended for use by strip and rollback, so there's a common | |
945 | place for anything that has to be done after destroying history.''' |
|
945 | place for anything that has to be done after destroying history.''' | |
946 | # XXX it might be nice if we could take the list of destroyed |
|
946 | # XXX it might be nice if we could take the list of destroyed | |
947 | # nodes, but I don't see an easy way for rollback() to do that |
|
947 | # nodes, but I don't see an easy way for rollback() to do that | |
948 |
|
948 | |||
949 | # Ensure the persistent tag cache is updated. Doing it now |
|
949 | # Ensure the persistent tag cache is updated. Doing it now | |
950 | # means that the tag cache only has to worry about destroyed |
|
950 | # means that the tag cache only has to worry about destroyed | |
951 | # heads immediately after a strip/rollback. That in turn |
|
951 | # heads immediately after a strip/rollback. That in turn | |
952 | # guarantees that "cachetip == currenttip" (comparing both rev |
|
952 | # guarantees that "cachetip == currenttip" (comparing both rev | |
953 | # and node) always means no nodes have been added or destroyed. |
|
953 | # and node) always means no nodes have been added or destroyed. | |
954 |
|
954 | |||
955 | # XXX this is suboptimal when qrefresh'ing: we strip the current |
|
955 | # XXX this is suboptimal when qrefresh'ing: we strip the current | |
956 | # head, refresh the tag cache, then immediately add a new head. |
|
956 | # head, refresh the tag cache, then immediately add a new head. | |
957 | # But I think doing it this way is necessary for the "instant |
|
957 | # But I think doing it this way is necessary for the "instant | |
958 | # tag cache retrieval" case to work. |
|
958 | # tag cache retrieval" case to work. | |
959 | tags_.findglobaltags(self.ui, self, {}, {}) |
|
959 | tags_.findglobaltags(self.ui, self, {}, {}) | |
960 |
|
960 | |||
961 | def walk(self, match, node=None): |
|
961 | def walk(self, match, node=None): | |
962 | ''' |
|
962 | ''' | |
963 | walk recursively through the directory tree or a given |
|
963 | walk recursively through the directory tree or a given | |
964 | changeset, finding all files matched by the match |
|
964 | changeset, finding all files matched by the match | |
965 | function |
|
965 | function | |
966 | ''' |
|
966 | ''' | |
967 | return self[node].walk(match) |
|
967 | return self[node].walk(match) | |
968 |
|
968 | |||
969 | def status(self, node1='.', node2=None, match=None, |
|
969 | def status(self, node1='.', node2=None, match=None, | |
970 | ignored=False, clean=False, unknown=False): |
|
970 | ignored=False, clean=False, unknown=False): | |
971 | """return status of files between two nodes or node and working directory |
|
971 | """return status of files between two nodes or node and working directory | |
972 |
|
972 | |||
973 | If node1 is None, use the first dirstate parent instead. |
|
973 | If node1 is None, use the first dirstate parent instead. | |
974 | If node2 is None, compare node1 with working directory. |
|
974 | If node2 is None, compare node1 with working directory. | |
975 | """ |
|
975 | """ | |
976 |
|
976 | |||
977 | def mfmatches(ctx): |
|
977 | def mfmatches(ctx): | |
978 | mf = ctx.manifest().copy() |
|
978 | mf = ctx.manifest().copy() | |
979 | for fn in mf.keys(): |
|
979 | for fn in mf.keys(): | |
980 | if not match(fn): |
|
980 | if not match(fn): | |
981 | del mf[fn] |
|
981 | del mf[fn] | |
982 | return mf |
|
982 | return mf | |
983 |
|
983 | |||
984 | if isinstance(node1, context.changectx): |
|
984 | if isinstance(node1, context.changectx): | |
985 | ctx1 = node1 |
|
985 | ctx1 = node1 | |
986 | else: |
|
986 | else: | |
987 | ctx1 = self[node1] |
|
987 | ctx1 = self[node1] | |
988 | if isinstance(node2, context.changectx): |
|
988 | if isinstance(node2, context.changectx): | |
989 | ctx2 = node2 |
|
989 | ctx2 = node2 | |
990 | else: |
|
990 | else: | |
991 | ctx2 = self[node2] |
|
991 | ctx2 = self[node2] | |
992 |
|
992 | |||
993 | working = ctx2.rev() is None |
|
993 | working = ctx2.rev() is None | |
994 | parentworking = working and ctx1 == self['.'] |
|
994 | parentworking = working and ctx1 == self['.'] | |
995 | match = match or match_.always(self.root, self.getcwd()) |
|
995 | match = match or match_.always(self.root, self.getcwd()) | |
996 | listignored, listclean, listunknown = ignored, clean, unknown |
|
996 | listignored, listclean, listunknown = ignored, clean, unknown | |
997 |
|
997 | |||
998 | # load earliest manifest first for caching reasons |
|
998 | # load earliest manifest first for caching reasons | |
999 | if not working and ctx2.rev() < ctx1.rev(): |
|
999 | if not working and ctx2.rev() < ctx1.rev(): | |
1000 | ctx2.manifest() |
|
1000 | ctx2.manifest() | |
1001 |
|
1001 | |||
1002 | if not parentworking: |
|
1002 | if not parentworking: | |
1003 | def bad(f, msg): |
|
1003 | def bad(f, msg): | |
1004 | if f not in ctx1: |
|
1004 | if f not in ctx1: | |
1005 | self.ui.warn('%s: %s\n' % (self.dirstate.pathto(f), msg)) |
|
1005 | self.ui.warn('%s: %s\n' % (self.dirstate.pathto(f), msg)) | |
1006 | match.bad = bad |
|
1006 | match.bad = bad | |
1007 |
|
1007 | |||
1008 | if working: # we need to scan the working dir |
|
1008 | if working: # we need to scan the working dir | |
1009 | subrepos = ctx1.substate.keys() |
|
1009 | subrepos = ctx1.substate.keys() | |
1010 | s = self.dirstate.status(match, subrepos, listignored, |
|
1010 | s = self.dirstate.status(match, subrepos, listignored, | |
1011 | listclean, listunknown) |
|
1011 | listclean, listunknown) | |
1012 | cmp, modified, added, removed, deleted, unknown, ignored, clean = s |
|
1012 | cmp, modified, added, removed, deleted, unknown, ignored, clean = s | |
1013 |
|
1013 | |||
1014 | # check for any possibly clean files |
|
1014 | # check for any possibly clean files | |
1015 | if parentworking and cmp: |
|
1015 | if parentworking and cmp: | |
1016 | fixup = [] |
|
1016 | fixup = [] | |
1017 | # do a full compare of any files that might have changed |
|
1017 | # do a full compare of any files that might have changed | |
1018 | for f in sorted(cmp): |
|
1018 | for f in sorted(cmp): | |
1019 | if (f not in ctx1 or ctx2.flags(f) != ctx1.flags(f) |
|
1019 | if (f not in ctx1 or ctx2.flags(f) != ctx1.flags(f) | |
1020 | or ctx1[f].cmp(ctx2[f].data())): |
|
1020 | or ctx1[f].cmp(ctx2[f].data())): | |
1021 | modified.append(f) |
|
1021 | modified.append(f) | |
1022 | else: |
|
1022 | else: | |
1023 | fixup.append(f) |
|
1023 | fixup.append(f) | |
1024 |
|
1024 | |||
1025 | if listclean: |
|
1025 | if listclean: | |
1026 | clean += fixup |
|
1026 | clean += fixup | |
1027 |
|
1027 | |||
1028 | # update dirstate for files that are actually clean |
|
1028 | # update dirstate for files that are actually clean | |
1029 | if fixup: |
|
1029 | if fixup: | |
1030 | try: |
|
1030 | try: | |
1031 | # updating the dirstate is optional |
|
1031 | # updating the dirstate is optional | |
1032 | # so we don't wait on the lock |
|
1032 | # so we don't wait on the lock | |
1033 | wlock = self.wlock(False) |
|
1033 | wlock = self.wlock(False) | |
1034 | try: |
|
1034 | try: | |
1035 | for f in fixup: |
|
1035 | for f in fixup: | |
1036 | self.dirstate.normal(f) |
|
1036 | self.dirstate.normal(f) | |
1037 | finally: |
|
1037 | finally: | |
1038 | wlock.release() |
|
1038 | wlock.release() | |
1039 | except error.LockError: |
|
1039 | except error.LockError: | |
1040 | pass |
|
1040 | pass | |
1041 |
|
1041 | |||
1042 | if not parentworking: |
|
1042 | if not parentworking: | |
1043 | mf1 = mfmatches(ctx1) |
|
1043 | mf1 = mfmatches(ctx1) | |
1044 | if working: |
|
1044 | if working: | |
1045 | # we are comparing working dir against non-parent |
|
1045 | # we are comparing working dir against non-parent | |
1046 | # generate a pseudo-manifest for the working dir |
|
1046 | # generate a pseudo-manifest for the working dir | |
1047 | mf2 = mfmatches(self['.']) |
|
1047 | mf2 = mfmatches(self['.']) | |
1048 | for f in cmp + modified + added: |
|
1048 | for f in cmp + modified + added: | |
1049 | mf2[f] = None |
|
1049 | mf2[f] = None | |
1050 | mf2.set(f, ctx2.flags(f)) |
|
1050 | mf2.set(f, ctx2.flags(f)) | |
1051 | for f in removed: |
|
1051 | for f in removed: | |
1052 | if f in mf2: |
|
1052 | if f in mf2: | |
1053 | del mf2[f] |
|
1053 | del mf2[f] | |
1054 | else: |
|
1054 | else: | |
1055 | # we are comparing two revisions |
|
1055 | # we are comparing two revisions | |
1056 | deleted, unknown, ignored = [], [], [] |
|
1056 | deleted, unknown, ignored = [], [], [] | |
1057 | mf2 = mfmatches(ctx2) |
|
1057 | mf2 = mfmatches(ctx2) | |
1058 |
|
1058 | |||
1059 | modified, added, clean = [], [], [] |
|
1059 | modified, added, clean = [], [], [] | |
1060 | for fn in mf2: |
|
1060 | for fn in mf2: | |
1061 | if fn in mf1: |
|
1061 | if fn in mf1: | |
1062 | if (mf1.flags(fn) != mf2.flags(fn) or |
|
1062 | if (mf1.flags(fn) != mf2.flags(fn) or | |
1063 | (mf1[fn] != mf2[fn] and |
|
1063 | (mf1[fn] != mf2[fn] and | |
1064 | (mf2[fn] or ctx1[fn].cmp(ctx2[fn].data())))): |
|
1064 | (mf2[fn] or ctx1[fn].cmp(ctx2[fn].data())))): | |
1065 | modified.append(fn) |
|
1065 | modified.append(fn) | |
1066 | elif listclean: |
|
1066 | elif listclean: | |
1067 | clean.append(fn) |
|
1067 | clean.append(fn) | |
1068 | del mf1[fn] |
|
1068 | del mf1[fn] | |
1069 | else: |
|
1069 | else: | |
1070 | added.append(fn) |
|
1070 | added.append(fn) | |
1071 | removed = mf1.keys() |
|
1071 | removed = mf1.keys() | |
1072 |
|
1072 | |||
1073 | r = modified, added, removed, deleted, unknown, ignored, clean |
|
1073 | r = modified, added, removed, deleted, unknown, ignored, clean | |
1074 | [l.sort() for l in r] |
|
1074 | [l.sort() for l in r] | |
1075 | return r |
|
1075 | return r | |
1076 |
|
1076 | |||
1077 | def add(self, list): |
|
1077 | def add(self, list): | |
1078 | wlock = self.wlock() |
|
1078 | wlock = self.wlock() | |
1079 | try: |
|
1079 | try: | |
1080 | rejected = [] |
|
1080 | rejected = [] | |
1081 | for f in list: |
|
1081 | for f in list: | |
1082 | p = self.wjoin(f) |
|
1082 | p = self.wjoin(f) | |
1083 | try: |
|
1083 | try: | |
1084 | st = os.lstat(p) |
|
1084 | st = os.lstat(p) | |
1085 | except: |
|
1085 | except: | |
1086 | self.ui.warn(_("%s does not exist!\n") % f) |
|
1086 | self.ui.warn(_("%s does not exist!\n") % f) | |
1087 | rejected.append(f) |
|
1087 | rejected.append(f) | |
1088 | continue |
|
1088 | continue | |
1089 | if st.st_size > 10000000: |
|
1089 | if st.st_size > 10000000: | |
1090 | self.ui.warn(_("%s: files over 10MB may cause memory and" |
|
1090 | self.ui.warn(_("%s: files over 10MB may cause memory and" | |
1091 | " performance problems\n" |
|
1091 | " performance problems\n" | |
1092 | "(use 'hg revert %s' to unadd the file)\n") |
|
1092 | "(use 'hg revert %s' to unadd the file)\n") | |
1093 | % (f, f)) |
|
1093 | % (f, f)) | |
1094 | if not (stat.S_ISREG(st.st_mode) or stat.S_ISLNK(st.st_mode)): |
|
1094 | if not (stat.S_ISREG(st.st_mode) or stat.S_ISLNK(st.st_mode)): | |
1095 | self.ui.warn(_("%s not added: only files and symlinks " |
|
1095 | self.ui.warn(_("%s not added: only files and symlinks " | |
1096 | "supported currently\n") % f) |
|
1096 | "supported currently\n") % f) | |
1097 | rejected.append(p) |
|
1097 | rejected.append(p) | |
1098 | elif self.dirstate[f] in 'amn': |
|
1098 | elif self.dirstate[f] in 'amn': | |
1099 | self.ui.warn(_("%s already tracked!\n") % f) |
|
1099 | self.ui.warn(_("%s already tracked!\n") % f) | |
1100 | elif self.dirstate[f] == 'r': |
|
1100 | elif self.dirstate[f] == 'r': | |
1101 | self.dirstate.normallookup(f) |
|
1101 | self.dirstate.normallookup(f) | |
1102 | else: |
|
1102 | else: | |
1103 | self.dirstate.add(f) |
|
1103 | self.dirstate.add(f) | |
1104 | return rejected |
|
1104 | return rejected | |
1105 | finally: |
|
1105 | finally: | |
1106 | wlock.release() |
|
1106 | wlock.release() | |
1107 |
|
1107 | |||
1108 | def forget(self, list): |
|
1108 | def forget(self, list): | |
1109 | wlock = self.wlock() |
|
1109 | wlock = self.wlock() | |
1110 | try: |
|
1110 | try: | |
1111 | for f in list: |
|
1111 | for f in list: | |
1112 | if self.dirstate[f] != 'a': |
|
1112 | if self.dirstate[f] != 'a': | |
1113 | self.ui.warn(_("%s not added!\n") % f) |
|
1113 | self.ui.warn(_("%s not added!\n") % f) | |
1114 | else: |
|
1114 | else: | |
1115 | self.dirstate.forget(f) |
|
1115 | self.dirstate.forget(f) | |
1116 | finally: |
|
1116 | finally: | |
1117 | wlock.release() |
|
1117 | wlock.release() | |
1118 |
|
1118 | |||
1119 | def remove(self, list, unlink=False): |
|
1119 | def remove(self, list, unlink=False): | |
1120 | if unlink: |
|
1120 | if unlink: | |
1121 | for f in list: |
|
1121 | for f in list: | |
1122 | try: |
|
1122 | try: | |
1123 | util.unlink(self.wjoin(f)) |
|
1123 | util.unlink(self.wjoin(f)) | |
1124 | except OSError, inst: |
|
1124 | except OSError, inst: | |
1125 | if inst.errno != errno.ENOENT: |
|
1125 | if inst.errno != errno.ENOENT: | |
1126 | raise |
|
1126 | raise | |
1127 | wlock = self.wlock() |
|
1127 | wlock = self.wlock() | |
1128 | try: |
|
1128 | try: | |
1129 | for f in list: |
|
1129 | for f in list: | |
1130 | if unlink and os.path.exists(self.wjoin(f)): |
|
1130 | if unlink and os.path.exists(self.wjoin(f)): | |
1131 | self.ui.warn(_("%s still exists!\n") % f) |
|
1131 | self.ui.warn(_("%s still exists!\n") % f) | |
1132 | elif self.dirstate[f] == 'a': |
|
1132 | elif self.dirstate[f] == 'a': | |
1133 | self.dirstate.forget(f) |
|
1133 | self.dirstate.forget(f) | |
1134 | elif f not in self.dirstate: |
|
1134 | elif f not in self.dirstate: | |
1135 | self.ui.warn(_("%s not tracked!\n") % f) |
|
1135 | self.ui.warn(_("%s not tracked!\n") % f) | |
1136 | else: |
|
1136 | else: | |
1137 | self.dirstate.remove(f) |
|
1137 | self.dirstate.remove(f) | |
1138 | finally: |
|
1138 | finally: | |
1139 | wlock.release() |
|
1139 | wlock.release() | |
1140 |
|
1140 | |||
1141 | def undelete(self, list): |
|
1141 | def undelete(self, list): | |
1142 | manifests = [self.manifest.read(self.changelog.read(p)[0]) |
|
1142 | manifests = [self.manifest.read(self.changelog.read(p)[0]) | |
1143 | for p in self.dirstate.parents() if p != nullid] |
|
1143 | for p in self.dirstate.parents() if p != nullid] | |
1144 | wlock = self.wlock() |
|
1144 | wlock = self.wlock() | |
1145 | try: |
|
1145 | try: | |
1146 | for f in list: |
|
1146 | for f in list: | |
1147 | if self.dirstate[f] != 'r': |
|
1147 | if self.dirstate[f] != 'r': | |
1148 | self.ui.warn(_("%s not removed!\n") % f) |
|
1148 | self.ui.warn(_("%s not removed!\n") % f) | |
1149 | else: |
|
1149 | else: | |
1150 | m = f in manifests[0] and manifests[0] or manifests[1] |
|
1150 | m = f in manifests[0] and manifests[0] or manifests[1] | |
1151 | t = self.file(f).read(m[f]) |
|
1151 | t = self.file(f).read(m[f]) | |
1152 | self.wwrite(f, t, m.flags(f)) |
|
1152 | self.wwrite(f, t, m.flags(f)) | |
1153 | self.dirstate.normal(f) |
|
1153 | self.dirstate.normal(f) | |
1154 | finally: |
|
1154 | finally: | |
1155 | wlock.release() |
|
1155 | wlock.release() | |
1156 |
|
1156 | |||
1157 | def copy(self, source, dest): |
|
1157 | def copy(self, source, dest): | |
1158 | p = self.wjoin(dest) |
|
1158 | p = self.wjoin(dest) | |
1159 | if not (os.path.exists(p) or os.path.islink(p)): |
|
1159 | if not (os.path.exists(p) or os.path.islink(p)): | |
1160 | self.ui.warn(_("%s does not exist!\n") % dest) |
|
1160 | self.ui.warn(_("%s does not exist!\n") % dest) | |
1161 | elif not (os.path.isfile(p) or os.path.islink(p)): |
|
1161 | elif not (os.path.isfile(p) or os.path.islink(p)): | |
1162 | self.ui.warn(_("copy failed: %s is not a file or a " |
|
1162 | self.ui.warn(_("copy failed: %s is not a file or a " | |
1163 | "symbolic link\n") % dest) |
|
1163 | "symbolic link\n") % dest) | |
1164 | else: |
|
1164 | else: | |
1165 | wlock = self.wlock() |
|
1165 | wlock = self.wlock() | |
1166 | try: |
|
1166 | try: | |
1167 | if self.dirstate[dest] in '?r': |
|
1167 | if self.dirstate[dest] in '?r': | |
1168 | self.dirstate.add(dest) |
|
1168 | self.dirstate.add(dest) | |
1169 | self.dirstate.copy(source, dest) |
|
1169 | self.dirstate.copy(source, dest) | |
1170 | finally: |
|
1170 | finally: | |
1171 | wlock.release() |
|
1171 | wlock.release() | |
1172 |
|
1172 | |||
1173 | def heads(self, start=None): |
|
1173 | def heads(self, start=None): | |
1174 | heads = self.changelog.heads(start) |
|
1174 | heads = self.changelog.heads(start) | |
1175 | # sort the output in rev descending order |
|
1175 | # sort the output in rev descending order | |
1176 | heads = [(-self.changelog.rev(h), h) for h in heads] |
|
1176 | heads = [(-self.changelog.rev(h), h) for h in heads] | |
1177 | return [n for (r, n) in sorted(heads)] |
|
1177 | return [n for (r, n) in sorted(heads)] | |
1178 |
|
1178 | |||
1179 | def branchheads(self, branch=None, start=None, closed=False): |
|
1179 | def branchheads(self, branch=None, start=None, closed=False): | |
1180 | '''return a (possibly filtered) list of heads for the given branch |
|
1180 | '''return a (possibly filtered) list of heads for the given branch | |
1181 |
|
1181 | |||
1182 | Heads are returned in topological order, from newest to oldest. |
|
1182 | Heads are returned in topological order, from newest to oldest. | |
1183 | If branch is None, use the dirstate branch. |
|
1183 | If branch is None, use the dirstate branch. | |
1184 | If start is not None, return only heads reachable from start. |
|
1184 | If start is not None, return only heads reachable from start. | |
1185 | If closed is True, return heads that are marked as closed as well. |
|
1185 | If closed is True, return heads that are marked as closed as well. | |
1186 | ''' |
|
1186 | ''' | |
1187 | if branch is None: |
|
1187 | if branch is None: | |
1188 | branch = self[None].branch() |
|
1188 | branch = self[None].branch() | |
1189 | branches = self.branchmap() |
|
1189 | branches = self.branchmap() | |
1190 | if branch not in branches: |
|
1190 | if branch not in branches: | |
1191 | return [] |
|
1191 | return [] | |
1192 | # the cache returns heads ordered lowest to highest |
|
1192 | # the cache returns heads ordered lowest to highest | |
1193 | bheads = list(reversed(branches[branch])) |
|
1193 | bheads = list(reversed(branches[branch])) | |
1194 | if start is not None: |
|
1194 | if start is not None: | |
1195 | # filter out the heads that cannot be reached from startrev |
|
1195 | # filter out the heads that cannot be reached from startrev | |
1196 | fbheads = set(self.changelog.nodesbetween([start], bheads)[2]) |
|
1196 | fbheads = set(self.changelog.nodesbetween([start], bheads)[2]) | |
1197 | bheads = [h for h in bheads if h in fbheads] |
|
1197 | bheads = [h for h in bheads if h in fbheads] | |
1198 | if not closed: |
|
1198 | if not closed: | |
1199 | bheads = [h for h in bheads if |
|
1199 | bheads = [h for h in bheads if | |
1200 | ('close' not in self.changelog.read(h)[5])] |
|
1200 | ('close' not in self.changelog.read(h)[5])] | |
1201 | return bheads |
|
1201 | return bheads | |
1202 |
|
1202 | |||
1203 | def branches(self, nodes): |
|
1203 | def branches(self, nodes): | |
1204 | if not nodes: |
|
1204 | if not nodes: | |
1205 | nodes = [self.changelog.tip()] |
|
1205 | nodes = [self.changelog.tip()] | |
1206 | b = [] |
|
1206 | b = [] | |
1207 | for n in nodes: |
|
1207 | for n in nodes: | |
1208 | t = n |
|
1208 | t = n | |
1209 | while 1: |
|
1209 | while 1: | |
1210 | p = self.changelog.parents(n) |
|
1210 | p = self.changelog.parents(n) | |
1211 | if p[1] != nullid or p[0] == nullid: |
|
1211 | if p[1] != nullid or p[0] == nullid: | |
1212 | b.append((t, n, p[0], p[1])) |
|
1212 | b.append((t, n, p[0], p[1])) | |
1213 | break |
|
1213 | break | |
1214 | n = p[0] |
|
1214 | n = p[0] | |
1215 | return b |
|
1215 | return b | |
1216 |
|
1216 | |||
1217 | def between(self, pairs): |
|
1217 | def between(self, pairs): | |
1218 | r = [] |
|
1218 | r = [] | |
1219 |
|
1219 | |||
1220 | for top, bottom in pairs: |
|
1220 | for top, bottom in pairs: | |
1221 | n, l, i = top, [], 0 |
|
1221 | n, l, i = top, [], 0 | |
1222 | f = 1 |
|
1222 | f = 1 | |
1223 |
|
1223 | |||
1224 | while n != bottom and n != nullid: |
|
1224 | while n != bottom and n != nullid: | |
1225 | p = self.changelog.parents(n)[0] |
|
1225 | p = self.changelog.parents(n)[0] | |
1226 | if i == f: |
|
1226 | if i == f: | |
1227 | l.append(n) |
|
1227 | l.append(n) | |
1228 | f = f * 2 |
|
1228 | f = f * 2 | |
1229 | n = p |
|
1229 | n = p | |
1230 | i += 1 |
|
1230 | i += 1 | |
1231 |
|
1231 | |||
1232 | r.append(l) |
|
1232 | r.append(l) | |
1233 |
|
1233 | |||
1234 | return r |
|
1234 | return r | |
1235 |
|
1235 | |||
1236 | def findincoming(self, remote, base=None, heads=None, force=False): |
|
1236 | def findincoming(self, remote, base=None, heads=None, force=False): | |
1237 | """Return list of roots of the subsets of missing nodes from remote |
|
1237 | """Return list of roots of the subsets of missing nodes from remote | |
1238 |
|
1238 | |||
1239 | If base dict is specified, assume that these nodes and their parents |
|
1239 | If base dict is specified, assume that these nodes and their parents | |
1240 | exist on the remote side and that no child of a node of base exists |
|
1240 | exist on the remote side and that no child of a node of base exists | |
1241 | in both remote and self. |
|
1241 | in both remote and self. | |
1242 | Furthermore base will be updated to include the nodes that exists |
|
1242 | Furthermore base will be updated to include the nodes that exists | |
1243 | in self and remote but no children exists in self and remote. |
|
1243 | in self and remote but no children exists in self and remote. | |
1244 | If a list of heads is specified, return only nodes which are heads |
|
1244 | If a list of heads is specified, return only nodes which are heads | |
1245 | or ancestors of these heads. |
|
1245 | or ancestors of these heads. | |
1246 |
|
1246 | |||
1247 | All the ancestors of base are in self and in remote. |
|
1247 | All the ancestors of base are in self and in remote. | |
1248 | All the descendants of the list returned are missing in self. |
|
1248 | All the descendants of the list returned are missing in self. | |
1249 | (and so we know that the rest of the nodes are missing in remote, see |
|
1249 | (and so we know that the rest of the nodes are missing in remote, see | |
1250 | outgoing) |
|
1250 | outgoing) | |
1251 | """ |
|
1251 | """ | |
1252 | return self.findcommonincoming(remote, base, heads, force)[1] |
|
1252 | return self.findcommonincoming(remote, base, heads, force)[1] | |
1253 |
|
1253 | |||
1254 | def findcommonincoming(self, remote, base=None, heads=None, force=False): |
|
1254 | def findcommonincoming(self, remote, base=None, heads=None, force=False): | |
1255 | """Return a tuple (common, missing roots, heads) used to identify |
|
1255 | """Return a tuple (common, missing roots, heads) used to identify | |
1256 | missing nodes from remote. |
|
1256 | missing nodes from remote. | |
1257 |
|
1257 | |||
1258 | If base dict is specified, assume that these nodes and their parents |
|
1258 | If base dict is specified, assume that these nodes and their parents | |
1259 | exist on the remote side and that no child of a node of base exists |
|
1259 | exist on the remote side and that no child of a node of base exists | |
1260 | in both remote and self. |
|
1260 | in both remote and self. | |
1261 | Furthermore base will be updated to include the nodes that exists |
|
1261 | Furthermore base will be updated to include the nodes that exists | |
1262 | in self and remote but no children exists in self and remote. |
|
1262 | in self and remote but no children exists in self and remote. | |
1263 | If a list of heads is specified, return only nodes which are heads |
|
1263 | If a list of heads is specified, return only nodes which are heads | |
1264 | or ancestors of these heads. |
|
1264 | or ancestors of these heads. | |
1265 |
|
1265 | |||
1266 | All the ancestors of base are in self and in remote. |
|
1266 | All the ancestors of base are in self and in remote. | |
1267 | """ |
|
1267 | """ | |
1268 | m = self.changelog.nodemap |
|
1268 | m = self.changelog.nodemap | |
1269 | search = [] |
|
1269 | search = [] | |
1270 | fetch = set() |
|
1270 | fetch = set() | |
1271 | seen = set() |
|
1271 | seen = set() | |
1272 | seenbranch = set() |
|
1272 | seenbranch = set() | |
1273 | if base is None: |
|
1273 | if base is None: | |
1274 | base = {} |
|
1274 | base = {} | |
1275 |
|
1275 | |||
1276 | if not heads: |
|
1276 | if not heads: | |
1277 | heads = remote.heads() |
|
1277 | heads = remote.heads() | |
1278 |
|
1278 | |||
1279 | if self.changelog.tip() == nullid: |
|
1279 | if self.changelog.tip() == nullid: | |
1280 | base[nullid] = 1 |
|
1280 | base[nullid] = 1 | |
1281 | if heads != [nullid]: |
|
1281 | if heads != [nullid]: | |
1282 | return [nullid], [nullid], list(heads) |
|
1282 | return [nullid], [nullid], list(heads) | |
1283 | return [nullid], [], [] |
|
1283 | return [nullid], [], [] | |
1284 |
|
1284 | |||
1285 | # assume we're closer to the tip than the root |
|
1285 | # assume we're closer to the tip than the root | |
1286 | # and start by examining the heads |
|
1286 | # and start by examining the heads | |
1287 | self.ui.status(_("searching for changes\n")) |
|
1287 | self.ui.status(_("searching for changes\n")) | |
1288 |
|
1288 | |||
1289 | unknown = [] |
|
1289 | unknown = [] | |
1290 | for h in heads: |
|
1290 | for h in heads: | |
1291 | if h not in m: |
|
1291 | if h not in m: | |
1292 | unknown.append(h) |
|
1292 | unknown.append(h) | |
1293 | else: |
|
1293 | else: | |
1294 | base[h] = 1 |
|
1294 | base[h] = 1 | |
1295 |
|
1295 | |||
1296 | heads = unknown |
|
1296 | heads = unknown | |
1297 | if not unknown: |
|
1297 | if not unknown: | |
1298 | return base.keys(), [], [] |
|
1298 | return base.keys(), [], [] | |
1299 |
|
1299 | |||
1300 | req = set(unknown) |
|
1300 | req = set(unknown) | |
1301 | reqcnt = 0 |
|
1301 | reqcnt = 0 | |
1302 |
|
1302 | |||
1303 | # search through remote branches |
|
1303 | # search through remote branches | |
1304 | # a 'branch' here is a linear segment of history, with four parts: |
|
1304 | # a 'branch' here is a linear segment of history, with four parts: | |
1305 | # head, root, first parent, second parent |
|
1305 | # head, root, first parent, second parent | |
1306 | # (a branch always has two parents (or none) by definition) |
|
1306 | # (a branch always has two parents (or none) by definition) | |
1307 | unknown = remote.branches(unknown) |
|
1307 | unknown = remote.branches(unknown) | |
1308 | while unknown: |
|
1308 | while unknown: | |
1309 | r = [] |
|
1309 | r = [] | |
1310 | while unknown: |
|
1310 | while unknown: | |
1311 | n = unknown.pop(0) |
|
1311 | n = unknown.pop(0) | |
1312 | if n[0] in seen: |
|
1312 | if n[0] in seen: | |
1313 | continue |
|
1313 | continue | |
1314 |
|
1314 | |||
1315 | self.ui.debug("examining %s:%s\n" |
|
1315 | self.ui.debug("examining %s:%s\n" | |
1316 | % (short(n[0]), short(n[1]))) |
|
1316 | % (short(n[0]), short(n[1]))) | |
1317 | if n[0] == nullid: # found the end of the branch |
|
1317 | if n[0] == nullid: # found the end of the branch | |
1318 | pass |
|
1318 | pass | |
1319 | elif n in seenbranch: |
|
1319 | elif n in seenbranch: | |
1320 | self.ui.debug("branch already found\n") |
|
1320 | self.ui.debug("branch already found\n") | |
1321 | continue |
|
1321 | continue | |
1322 | elif n[1] and n[1] in m: # do we know the base? |
|
1322 | elif n[1] and n[1] in m: # do we know the base? | |
1323 | self.ui.debug("found incomplete branch %s:%s\n" |
|
1323 | self.ui.debug("found incomplete branch %s:%s\n" | |
1324 | % (short(n[0]), short(n[1]))) |
|
1324 | % (short(n[0]), short(n[1]))) | |
1325 | search.append(n[0:2]) # schedule branch range for scanning |
|
1325 | search.append(n[0:2]) # schedule branch range for scanning | |
1326 | seenbranch.add(n) |
|
1326 | seenbranch.add(n) | |
1327 | else: |
|
1327 | else: | |
1328 | if n[1] not in seen and n[1] not in fetch: |
|
1328 | if n[1] not in seen and n[1] not in fetch: | |
1329 | if n[2] in m and n[3] in m: |
|
1329 | if n[2] in m and n[3] in m: | |
1330 | self.ui.debug("found new changeset %s\n" % |
|
1330 | self.ui.debug("found new changeset %s\n" % | |
1331 | short(n[1])) |
|
1331 | short(n[1])) | |
1332 | fetch.add(n[1]) # earliest unknown |
|
1332 | fetch.add(n[1]) # earliest unknown | |
1333 | for p in n[2:4]: |
|
1333 | for p in n[2:4]: | |
1334 | if p in m: |
|
1334 | if p in m: | |
1335 | base[p] = 1 # latest known |
|
1335 | base[p] = 1 # latest known | |
1336 |
|
1336 | |||
1337 | for p in n[2:4]: |
|
1337 | for p in n[2:4]: | |
1338 | if p not in req and p not in m: |
|
1338 | if p not in req and p not in m: | |
1339 | r.append(p) |
|
1339 | r.append(p) | |
1340 | req.add(p) |
|
1340 | req.add(p) | |
1341 | seen.add(n[0]) |
|
1341 | seen.add(n[0]) | |
1342 |
|
1342 | |||
1343 | if r: |
|
1343 | if r: | |
1344 | reqcnt += 1 |
|
1344 | reqcnt += 1 | |
1345 | self.ui.debug("request %d: %s\n" % |
|
1345 | self.ui.debug("request %d: %s\n" % | |
1346 | (reqcnt, " ".join(map(short, r)))) |
|
1346 | (reqcnt, " ".join(map(short, r)))) | |
1347 | for p in xrange(0, len(r), 10): |
|
1347 | for p in xrange(0, len(r), 10): | |
1348 | for b in remote.branches(r[p:p + 10]): |
|
1348 | for b in remote.branches(r[p:p + 10]): | |
1349 | self.ui.debug("received %s:%s\n" % |
|
1349 | self.ui.debug("received %s:%s\n" % | |
1350 | (short(b[0]), short(b[1]))) |
|
1350 | (short(b[0]), short(b[1]))) | |
1351 | unknown.append(b) |
|
1351 | unknown.append(b) | |
1352 |
|
1352 | |||
1353 | # do binary search on the branches we found |
|
1353 | # do binary search on the branches we found | |
1354 | while search: |
|
1354 | while search: | |
1355 | newsearch = [] |
|
1355 | newsearch = [] | |
1356 | reqcnt += 1 |
|
1356 | reqcnt += 1 | |
1357 | for n, l in zip(search, remote.between(search)): |
|
1357 | for n, l in zip(search, remote.between(search)): | |
1358 | l.append(n[1]) |
|
1358 | l.append(n[1]) | |
1359 | p = n[0] |
|
1359 | p = n[0] | |
1360 | f = 1 |
|
1360 | f = 1 | |
1361 | for i in l: |
|
1361 | for i in l: | |
1362 | self.ui.debug("narrowing %d:%d %s\n" % (f, len(l), short(i))) |
|
1362 | self.ui.debug("narrowing %d:%d %s\n" % (f, len(l), short(i))) | |
1363 | if i in m: |
|
1363 | if i in m: | |
1364 | if f <= 2: |
|
1364 | if f <= 2: | |
1365 | self.ui.debug("found new branch changeset %s\n" % |
|
1365 | self.ui.debug("found new branch changeset %s\n" % | |
1366 | short(p)) |
|
1366 | short(p)) | |
1367 | fetch.add(p) |
|
1367 | fetch.add(p) | |
1368 | base[i] = 1 |
|
1368 | base[i] = 1 | |
1369 | else: |
|
1369 | else: | |
1370 | self.ui.debug("narrowed branch search to %s:%s\n" |
|
1370 | self.ui.debug("narrowed branch search to %s:%s\n" | |
1371 | % (short(p), short(i))) |
|
1371 | % (short(p), short(i))) | |
1372 | newsearch.append((p, i)) |
|
1372 | newsearch.append((p, i)) | |
1373 | break |
|
1373 | break | |
1374 | p, f = i, f * 2 |
|
1374 | p, f = i, f * 2 | |
1375 | search = newsearch |
|
1375 | search = newsearch | |
1376 |
|
1376 | |||
1377 | # sanity check our fetch list |
|
1377 | # sanity check our fetch list | |
1378 | for f in fetch: |
|
1378 | for f in fetch: | |
1379 | if f in m: |
|
1379 | if f in m: | |
1380 | raise error.RepoError(_("already have changeset ") |
|
1380 | raise error.RepoError(_("already have changeset ") | |
1381 | + short(f[:4])) |
|
1381 | + short(f[:4])) | |
1382 |
|
1382 | |||
1383 | if base.keys() == [nullid]: |
|
1383 | if base.keys() == [nullid]: | |
1384 | if force: |
|
1384 | if force: | |
1385 | self.ui.warn(_("warning: repository is unrelated\n")) |
|
1385 | self.ui.warn(_("warning: repository is unrelated\n")) | |
1386 | else: |
|
1386 | else: | |
1387 | raise util.Abort(_("repository is unrelated")) |
|
1387 | raise util.Abort(_("repository is unrelated")) | |
1388 |
|
1388 | |||
1389 | self.ui.debug("found new changesets starting at " + |
|
1389 | self.ui.debug("found new changesets starting at " + | |
1390 | " ".join([short(f) for f in fetch]) + "\n") |
|
1390 | " ".join([short(f) for f in fetch]) + "\n") | |
1391 |
|
1391 | |||
1392 | self.ui.debug("%d total queries\n" % reqcnt) |
|
1392 | self.ui.debug("%d total queries\n" % reqcnt) | |
1393 |
|
1393 | |||
1394 | return base.keys(), list(fetch), heads |
|
1394 | return base.keys(), list(fetch), heads | |
1395 |
|
1395 | |||
1396 | def findoutgoing(self, remote, base=None, heads=None, force=False): |
|
1396 | def findoutgoing(self, remote, base=None, heads=None, force=False): | |
1397 | """Return list of nodes that are roots of subsets not in remote |
|
1397 | """Return list of nodes that are roots of subsets not in remote | |
1398 |
|
1398 | |||
1399 | If base dict is specified, assume that these nodes and their parents |
|
1399 | If base dict is specified, assume that these nodes and their parents | |
1400 | exist on the remote side. |
|
1400 | exist on the remote side. | |
1401 | If a list of heads is specified, return only nodes which are heads |
|
1401 | If a list of heads is specified, return only nodes which are heads | |
1402 | or ancestors of these heads, and return a second element which |
|
1402 | or ancestors of these heads, and return a second element which | |
1403 | contains all remote heads which get new children. |
|
1403 | contains all remote heads which get new children. | |
1404 | """ |
|
1404 | """ | |
1405 | if base is None: |
|
1405 | if base is None: | |
1406 | base = {} |
|
1406 | base = {} | |
1407 | self.findincoming(remote, base, heads, force=force) |
|
1407 | self.findincoming(remote, base, heads, force=force) | |
1408 |
|
1408 | |||
1409 | self.ui.debug("common changesets up to " |
|
1409 | self.ui.debug("common changesets up to " | |
1410 | + " ".join(map(short, base.keys())) + "\n") |
|
1410 | + " ".join(map(short, base.keys())) + "\n") | |
1411 |
|
1411 | |||
1412 | remain = set(self.changelog.nodemap) |
|
1412 | remain = set(self.changelog.nodemap) | |
1413 |
|
1413 | |||
1414 | # prune everything remote has from the tree |
|
1414 | # prune everything remote has from the tree | |
1415 | remain.remove(nullid) |
|
1415 | remain.remove(nullid) | |
1416 | remove = base.keys() |
|
1416 | remove = base.keys() | |
1417 | while remove: |
|
1417 | while remove: | |
1418 | n = remove.pop(0) |
|
1418 | n = remove.pop(0) | |
1419 | if n in remain: |
|
1419 | if n in remain: | |
1420 | remain.remove(n) |
|
1420 | remain.remove(n) | |
1421 | for p in self.changelog.parents(n): |
|
1421 | for p in self.changelog.parents(n): | |
1422 | remove.append(p) |
|
1422 | remove.append(p) | |
1423 |
|
1423 | |||
1424 | # find every node whose parents have been pruned |
|
1424 | # find every node whose parents have been pruned | |
1425 | subset = [] |
|
1425 | subset = [] | |
1426 | # find every remote head that will get new children |
|
1426 | # find every remote head that will get new children | |
1427 | updated_heads = set() |
|
1427 | updated_heads = set() | |
1428 | for n in remain: |
|
1428 | for n in remain: | |
1429 | p1, p2 = self.changelog.parents(n) |
|
1429 | p1, p2 = self.changelog.parents(n) | |
1430 | if p1 not in remain and p2 not in remain: |
|
1430 | if p1 not in remain and p2 not in remain: | |
1431 | subset.append(n) |
|
1431 | subset.append(n) | |
1432 | if heads: |
|
1432 | if heads: | |
1433 | if p1 in heads: |
|
1433 | if p1 in heads: | |
1434 | updated_heads.add(p1) |
|
1434 | updated_heads.add(p1) | |
1435 | if p2 in heads: |
|
1435 | if p2 in heads: | |
1436 | updated_heads.add(p2) |
|
1436 | updated_heads.add(p2) | |
1437 |
|
1437 | |||
1438 | # this is the set of all roots we have to push |
|
1438 | # this is the set of all roots we have to push | |
1439 | if heads: |
|
1439 | if heads: | |
1440 | return subset, list(updated_heads) |
|
1440 | return subset, list(updated_heads) | |
1441 | else: |
|
1441 | else: | |
1442 | return subset |
|
1442 | return subset | |
1443 |
|
1443 | |||
1444 | def pull(self, remote, heads=None, force=False): |
|
1444 | def pull(self, remote, heads=None, force=False): | |
1445 | lock = self.lock() |
|
1445 | lock = self.lock() | |
1446 | try: |
|
1446 | try: | |
1447 | common, fetch, rheads = self.findcommonincoming(remote, heads=heads, |
|
1447 | common, fetch, rheads = self.findcommonincoming(remote, heads=heads, | |
1448 | force=force) |
|
1448 | force=force) | |
1449 | if fetch == [nullid]: |
|
1449 | if fetch == [nullid]: | |
1450 | self.ui.status(_("requesting all changes\n")) |
|
1450 | self.ui.status(_("requesting all changes\n")) | |
1451 |
|
1451 | |||
1452 | if not fetch: |
|
1452 | if not fetch: | |
1453 | self.ui.status(_("no changes found\n")) |
|
1453 | self.ui.status(_("no changes found\n")) | |
1454 | return 0 |
|
1454 | return 0 | |
1455 |
|
1455 | |||
1456 | if heads is None and remote.capable('changegroupsubset'): |
|
1456 | if heads is None and remote.capable('changegroupsubset'): | |
1457 | heads = rheads |
|
1457 | heads = rheads | |
1458 |
|
1458 | |||
1459 | if heads is None: |
|
1459 | if heads is None: | |
1460 | cg = remote.changegroup(fetch, 'pull') |
|
1460 | cg = remote.changegroup(fetch, 'pull') | |
1461 | else: |
|
1461 | else: | |
1462 | if not remote.capable('changegroupsubset'): |
|
1462 | if not remote.capable('changegroupsubset'): | |
1463 | raise util.Abort(_("Partial pull cannot be done because " |
|
1463 | raise util.Abort(_("Partial pull cannot be done because " | |
1464 | "other repository doesn't support " |
|
1464 | "other repository doesn't support " | |
1465 | "changegroupsubset.")) |
|
1465 | "changegroupsubset.")) | |
1466 | cg = remote.changegroupsubset(fetch, heads, 'pull') |
|
1466 | cg = remote.changegroupsubset(fetch, heads, 'pull') | |
1467 | return self.addchangegroup(cg, 'pull', remote.url()) |
|
1467 | return self.addchangegroup(cg, 'pull', remote.url()) | |
1468 | finally: |
|
1468 | finally: | |
1469 | lock.release() |
|
1469 | lock.release() | |
1470 |
|
1470 | |||
1471 | def push(self, remote, force=False, revs=None): |
|
1471 | def push(self, remote, force=False, revs=None): | |
1472 | # there are two ways to push to remote repo: |
|
1472 | # there are two ways to push to remote repo: | |
1473 | # |
|
1473 | # | |
1474 | # addchangegroup assumes local user can lock remote |
|
1474 | # addchangegroup assumes local user can lock remote | |
1475 | # repo (local filesystem, old ssh servers). |
|
1475 | # repo (local filesystem, old ssh servers). | |
1476 | # |
|
1476 | # | |
1477 | # unbundle assumes local user cannot lock remote repo (new ssh |
|
1477 | # unbundle assumes local user cannot lock remote repo (new ssh | |
1478 | # servers, http servers). |
|
1478 | # servers, http servers). | |
1479 |
|
1479 | |||
1480 | if remote.capable('unbundle'): |
|
1480 | if remote.capable('unbundle'): | |
1481 | return self.push_unbundle(remote, force, revs) |
|
1481 | return self.push_unbundle(remote, force, revs) | |
1482 | return self.push_addchangegroup(remote, force, revs) |
|
1482 | return self.push_addchangegroup(remote, force, revs) | |
1483 |
|
1483 | |||
1484 | def prepush(self, remote, force, revs): |
|
1484 | def prepush(self, remote, force, revs): | |
1485 | '''Analyze the local and remote repositories and determine which |
|
1485 | '''Analyze the local and remote repositories and determine which | |
1486 | changesets need to be pushed to the remote. Return a tuple |
|
1486 | changesets need to be pushed to the remote. Return a tuple | |
1487 | (changegroup, remoteheads). changegroup is a readable file-like |
|
1487 | (changegroup, remoteheads). changegroup is a readable file-like | |
1488 | object whose read() returns successive changegroup chunks ready to |
|
1488 | object whose read() returns successive changegroup chunks ready to | |
1489 | be sent over the wire. remoteheads is the list of remote heads. |
|
1489 | be sent over the wire. remoteheads is the list of remote heads. | |
1490 | ''' |
|
1490 | ''' | |
1491 | common = {} |
|
1491 | common = {} | |
1492 | remote_heads = remote.heads() |
|
1492 | remote_heads = remote.heads() | |
1493 | inc = self.findincoming(remote, common, remote_heads, force=force) |
|
1493 | inc = self.findincoming(remote, common, remote_heads, force=force) | |
1494 |
|
1494 | |||
1495 | update, updated_heads = self.findoutgoing(remote, common, remote_heads) |
|
1495 | update, updated_heads = self.findoutgoing(remote, common, remote_heads) | |
1496 | msng_cl, bases, heads = self.changelog.nodesbetween(update, revs) |
|
1496 | msng_cl, bases, heads = self.changelog.nodesbetween(update, revs) | |
1497 |
|
1497 | |||
1498 | def checkbranch(lheads, rheads, updatelb, branchname=None): |
|
1498 | def checkbranch(lheads, rheads, updatelb, branchname=None): | |
1499 | ''' |
|
1499 | ''' | |
1500 | check whether there are more local heads than remote heads on |
|
1500 | check whether there are more local heads than remote heads on | |
1501 | a specific branch. |
|
1501 | a specific branch. | |
1502 |
|
1502 | |||
1503 | lheads: local branch heads |
|
1503 | lheads: local branch heads | |
1504 | rheads: remote branch heads |
|
1504 | rheads: remote branch heads | |
1505 | updatelb: outgoing local branch bases |
|
1505 | updatelb: outgoing local branch bases | |
1506 | ''' |
|
1506 | ''' | |
1507 |
|
1507 | |||
1508 | warn = 0 |
|
1508 | warn = 0 | |
1509 |
|
1509 | |||
1510 | if not revs and len(lheads) > len(rheads): |
|
1510 | if not revs and len(lheads) > len(rheads): | |
1511 | warn = 1 |
|
1511 | warn = 1 | |
1512 | else: |
|
1512 | else: | |
1513 | # add local heads involved in the push |
|
1513 | # add local heads involved in the push | |
1514 | updatelheads = [self.changelog.heads(x, lheads) |
|
1514 | updatelheads = [self.changelog.heads(x, lheads) | |
1515 | for x in updatelb] |
|
1515 | for x in updatelb] | |
1516 | newheads = set(sum(updatelheads, [])) & set(lheads) |
|
1516 | newheads = set(sum(updatelheads, [])) & set(lheads) | |
1517 |
|
1517 | |||
1518 | if not newheads: |
|
1518 | if not newheads: | |
1519 | return True |
|
1519 | return True | |
1520 |
|
1520 | |||
1521 | # add heads we don't have or that are not involved in the push |
|
1521 | # add heads we don't have or that are not involved in the push | |
1522 | for r in rheads: |
|
1522 | for r in rheads: | |
1523 | if r in self.changelog.nodemap: |
|
1523 | if r in self.changelog.nodemap: | |
1524 | desc = self.changelog.heads(r, heads) |
|
1524 | desc = self.changelog.heads(r, heads) | |
1525 | l = [h for h in heads if h in desc] |
|
1525 | l = [h for h in heads if h in desc] | |
1526 | if not l: |
|
1526 | if not l: | |
1527 | newheads.add(r) |
|
1527 | newheads.add(r) | |
1528 | else: |
|
1528 | else: | |
1529 | newheads.add(r) |
|
1529 | newheads.add(r) | |
1530 | if len(newheads) > len(rheads): |
|
1530 | if len(newheads) > len(rheads): | |
1531 | warn = 1 |
|
1531 | warn = 1 | |
1532 |
|
1532 | |||
1533 | if warn: |
|
1533 | if warn: | |
1534 | if branchname is not None: |
|
1534 | if branchname is not None: | |
1535 | msg = _("abort: push creates new remote heads" |
|
1535 | msg = _("abort: push creates new remote heads" | |
1536 | " on branch '%s'!\n") % branchname |
|
1536 | " on branch '%s'!\n") % branchname | |
1537 | else: |
|
1537 | else: | |
1538 | msg = _("abort: push creates new remote heads!\n") |
|
1538 | msg = _("abort: push creates new remote heads!\n") | |
1539 | self.ui.warn(msg) |
|
1539 | self.ui.warn(msg) | |
1540 | if len(lheads) > len(rheads): |
|
1540 | if len(lheads) > len(rheads): | |
1541 | self.ui.status(_("(did you forget to merge?" |
|
1541 | self.ui.status(_("(did you forget to merge?" | |
1542 | " use push -f to force)\n")) |
|
1542 | " use push -f to force)\n")) | |
1543 | else: |
|
1543 | else: | |
1544 | self.ui.status(_("(you should pull and merge or" |
|
1544 | self.ui.status(_("(you should pull and merge or" | |
1545 | " use push -f to force)\n")) |
|
1545 | " use push -f to force)\n")) | |
1546 | return False |
|
1546 | return False | |
1547 | return True |
|
1547 | return True | |
1548 |
|
1548 | |||
1549 | if not bases: |
|
1549 | if not bases: | |
1550 | self.ui.status(_("no changes found\n")) |
|
1550 | self.ui.status(_("no changes found\n")) | |
1551 | return None, 1 |
|
1551 | return None, 1 | |
1552 | elif not force: |
|
1552 | elif not force: | |
1553 | # Check for each named branch if we're creating new remote heads. |
|
1553 | # Check for each named branch if we're creating new remote heads. | |
1554 | # To be a remote head after push, node must be either: |
|
1554 | # To be a remote head after push, node must be either: | |
1555 | # - unknown locally |
|
1555 | # - unknown locally | |
1556 | # - a local outgoing head descended from update |
|
1556 | # - a local outgoing head descended from update | |
1557 | # - a remote head that's known locally and not |
|
1557 | # - a remote head that's known locally and not | |
1558 | # ancestral to an outgoing head |
|
1558 | # ancestral to an outgoing head | |
1559 | # |
|
1559 | # | |
1560 | # New named branches cannot be created without --force. |
|
1560 | # New named branches cannot be created without --force. | |
1561 |
|
1561 | |||
1562 | if remote_heads != [nullid]: |
|
1562 | if remote_heads != [nullid]: | |
1563 | if remote.capable('branchmap'): |
|
1563 | if remote.capable('branchmap'): | |
1564 | remotebrheads = remote.branchmap() |
|
1564 | remotebrheads = remote.branchmap() | |
1565 |
|
1565 | |||
1566 | if not revs: |
|
1566 | if not revs: | |
1567 | localbrheads = self.branchmap() |
|
1567 | localbrheads = self.branchmap() | |
1568 | else: |
|
1568 | else: | |
1569 | localbrheads = {} |
|
1569 | localbrheads = {} | |
1570 | for n in heads: |
|
1570 | for n in heads: | |
1571 | branch = self[n].branch() |
|
1571 | branch = self[n].branch() | |
1572 | localbrheads.setdefault(branch, []).append(n) |
|
1572 | localbrheads.setdefault(branch, []).append(n) | |
1573 |
|
1573 | |||
1574 | newbranches = list(set(localbrheads) - set(remotebrheads)) |
|
1574 | newbranches = list(set(localbrheads) - set(remotebrheads)) | |
1575 | if newbranches: # new branch requires --force |
|
1575 | if newbranches: # new branch requires --force | |
1576 | branchnames = ', '.join("%s" % b for b in newbranches) |
|
1576 | branchnames = ', '.join("%s" % b for b in newbranches) | |
1577 | self.ui.warn(_("abort: push creates " |
|
1577 | self.ui.warn(_("abort: push creates " | |
1578 | "new remote branches: %s!\n") |
|
1578 | "new remote branches: %s!\n") | |
1579 | % branchnames) |
|
1579 | % branchnames) | |
1580 | # propose 'push -b .' in the msg too? |
|
1580 | # propose 'push -b .' in the msg too? | |
1581 | self.ui.status(_("(use 'hg push -f' to force)\n")) |
|
1581 | self.ui.status(_("(use 'hg push -f' to force)\n")) | |
1582 | return None, 0 |
|
1582 | return None, 0 | |
1583 | for branch, lheads in localbrheads.iteritems(): |
|
1583 | for branch, lheads in localbrheads.iteritems(): | |
1584 | if branch in remotebrheads: |
|
1584 | if branch in remotebrheads: | |
1585 | rheads = remotebrheads[branch] |
|
1585 | rheads = remotebrheads[branch] | |
1586 | if not checkbranch(lheads, rheads, update, branch): |
|
1586 | if not checkbranch(lheads, rheads, update, branch): | |
1587 | return None, 0 |
|
1587 | return None, 0 | |
1588 | else: |
|
1588 | else: | |
1589 | if not checkbranch(heads, remote_heads, update): |
|
1589 | if not checkbranch(heads, remote_heads, update): | |
1590 | return None, 0 |
|
1590 | return None, 0 | |
1591 |
|
1591 | |||
1592 | if inc: |
|
1592 | if inc: | |
1593 | self.ui.warn(_("note: unsynced remote changes!\n")) |
|
1593 | self.ui.warn(_("note: unsynced remote changes!\n")) | |
1594 |
|
1594 | |||
1595 |
|
1595 | |||
1596 | if revs is None: |
|
1596 | if revs is None: | |
1597 | # use the fast path, no race possible on push |
|
1597 | # use the fast path, no race possible on push | |
1598 | nodes = self.changelog.findmissing(common.keys()) |
|
1598 | nodes = self.changelog.findmissing(common.keys()) | |
1599 | cg = self._changegroup(nodes, 'push') |
|
1599 | cg = self._changegroup(nodes, 'push') | |
1600 | else: |
|
1600 | else: | |
1601 | cg = self.changegroupsubset(update, revs, 'push') |
|
1601 | cg = self.changegroupsubset(update, revs, 'push') | |
1602 | return cg, remote_heads |
|
1602 | return cg, remote_heads | |
1603 |
|
1603 | |||
1604 | def push_addchangegroup(self, remote, force, revs): |
|
1604 | def push_addchangegroup(self, remote, force, revs): | |
1605 | lock = remote.lock() |
|
1605 | lock = remote.lock() | |
1606 | try: |
|
1606 | try: | |
1607 | ret = self.prepush(remote, force, revs) |
|
1607 | ret = self.prepush(remote, force, revs) | |
1608 | if ret[0] is not None: |
|
1608 | if ret[0] is not None: | |
1609 | cg, remote_heads = ret |
|
1609 | cg, remote_heads = ret | |
1610 | return remote.addchangegroup(cg, 'push', self.url()) |
|
1610 | return remote.addchangegroup(cg, 'push', self.url()) | |
1611 | return ret[1] |
|
1611 | return ret[1] | |
1612 | finally: |
|
1612 | finally: | |
1613 | lock.release() |
|
1613 | lock.release() | |
1614 |
|
1614 | |||
1615 | def push_unbundle(self, remote, force, revs): |
|
1615 | def push_unbundle(self, remote, force, revs): | |
1616 | # local repo finds heads on server, finds out what revs it |
|
1616 | # local repo finds heads on server, finds out what revs it | |
1617 | # must push. once revs transferred, if server finds it has |
|
1617 | # must push. once revs transferred, if server finds it has | |
1618 | # different heads (someone else won commit/push race), server |
|
1618 | # different heads (someone else won commit/push race), server | |
1619 | # aborts. |
|
1619 | # aborts. | |
1620 |
|
1620 | |||
1621 | ret = self.prepush(remote, force, revs) |
|
1621 | ret = self.prepush(remote, force, revs) | |
1622 | if ret[0] is not None: |
|
1622 | if ret[0] is not None: | |
1623 | cg, remote_heads = ret |
|
1623 | cg, remote_heads = ret | |
1624 | if force: |
|
1624 | if force: | |
1625 | remote_heads = ['force'] |
|
1625 | remote_heads = ['force'] | |
1626 | return remote.unbundle(cg, remote_heads, 'push') |
|
1626 | return remote.unbundle(cg, remote_heads, 'push') | |
1627 | return ret[1] |
|
1627 | return ret[1] | |
1628 |
|
1628 | |||
1629 | def changegroupinfo(self, nodes, source): |
|
1629 | def changegroupinfo(self, nodes, source): | |
1630 | if self.ui.verbose or source == 'bundle': |
|
1630 | if self.ui.verbose or source == 'bundle': | |
1631 | self.ui.status(_("%d changesets found\n") % len(nodes)) |
|
1631 | self.ui.status(_("%d changesets found\n") % len(nodes)) | |
1632 | if self.ui.debugflag: |
|
1632 | if self.ui.debugflag: | |
1633 | self.ui.debug("list of changesets:\n") |
|
1633 | self.ui.debug("list of changesets:\n") | |
1634 | for node in nodes: |
|
1634 | for node in nodes: | |
1635 | self.ui.debug("%s\n" % hex(node)) |
|
1635 | self.ui.debug("%s\n" % hex(node)) | |
1636 |
|
1636 | |||
1637 | def changegroupsubset(self, bases, heads, source, extranodes=None): |
|
1637 | def changegroupsubset(self, bases, heads, source, extranodes=None): | |
1638 | """Compute a changegroup consisting of all the nodes that are |
|
1638 | """Compute a changegroup consisting of all the nodes that are | |
1639 | descendents of any of the bases and ancestors of any of the heads. |
|
1639 | descendents of any of the bases and ancestors of any of the heads. | |
1640 | Return a chunkbuffer object whose read() method will return |
|
1640 | Return a chunkbuffer object whose read() method will return | |
1641 | successive changegroup chunks. |
|
1641 | successive changegroup chunks. | |
1642 |
|
1642 | |||
1643 | It is fairly complex as determining which filenodes and which |
|
1643 | It is fairly complex as determining which filenodes and which | |
1644 | manifest nodes need to be included for the changeset to be complete |
|
1644 | manifest nodes need to be included for the changeset to be complete | |
1645 | is non-trivial. |
|
1645 | is non-trivial. | |
1646 |
|
1646 | |||
1647 | Another wrinkle is doing the reverse, figuring out which changeset in |
|
1647 | Another wrinkle is doing the reverse, figuring out which changeset in | |
1648 | the changegroup a particular filenode or manifestnode belongs to. |
|
1648 | the changegroup a particular filenode or manifestnode belongs to. | |
1649 |
|
1649 | |||
1650 | The caller can specify some nodes that must be included in the |
|
1650 | The caller can specify some nodes that must be included in the | |
1651 | changegroup using the extranodes argument. It should be a dict |
|
1651 | changegroup using the extranodes argument. It should be a dict | |
1652 | where the keys are the filenames (or 1 for the manifest), and the |
|
1652 | where the keys are the filenames (or 1 for the manifest), and the | |
1653 | values are lists of (node, linknode) tuples, where node is a wanted |
|
1653 | values are lists of (node, linknode) tuples, where node is a wanted | |
1654 | node and linknode is the changelog node that should be transmitted as |
|
1654 | node and linknode is the changelog node that should be transmitted as | |
1655 | the linkrev. |
|
1655 | the linkrev. | |
1656 | """ |
|
1656 | """ | |
1657 |
|
1657 | |||
1658 | # Set up some initial variables |
|
1658 | # Set up some initial variables | |
1659 | # Make it easy to refer to self.changelog |
|
1659 | # Make it easy to refer to self.changelog | |
1660 | cl = self.changelog |
|
1660 | cl = self.changelog | |
1661 | # msng is short for missing - compute the list of changesets in this |
|
1661 | # msng is short for missing - compute the list of changesets in this | |
1662 | # changegroup. |
|
1662 | # changegroup. | |
1663 | if not bases: |
|
1663 | if not bases: | |
1664 | bases = [nullid] |
|
1664 | bases = [nullid] | |
1665 | msng_cl_lst, bases, heads = cl.nodesbetween(bases, heads) |
|
1665 | msng_cl_lst, bases, heads = cl.nodesbetween(bases, heads) | |
1666 |
|
1666 | |||
1667 | if extranodes is None: |
|
1667 | if extranodes is None: | |
1668 | # can we go through the fast path ? |
|
1668 | # can we go through the fast path ? | |
1669 | heads.sort() |
|
1669 | heads.sort() | |
1670 | allheads = self.heads() |
|
1670 | allheads = self.heads() | |
1671 | allheads.sort() |
|
1671 | allheads.sort() | |
1672 | if heads == allheads: |
|
1672 | if heads == allheads: | |
1673 | return self._changegroup(msng_cl_lst, source) |
|
1673 | return self._changegroup(msng_cl_lst, source) | |
1674 |
|
1674 | |||
1675 | # slow path |
|
1675 | # slow path | |
1676 | self.hook('preoutgoing', throw=True, source=source) |
|
1676 | self.hook('preoutgoing', throw=True, source=source) | |
1677 |
|
1677 | |||
1678 | self.changegroupinfo(msng_cl_lst, source) |
|
1678 | self.changegroupinfo(msng_cl_lst, source) | |
1679 | # Some bases may turn out to be superfluous, and some heads may be |
|
1679 | # Some bases may turn out to be superfluous, and some heads may be | |
1680 | # too. nodesbetween will return the minimal set of bases and heads |
|
1680 | # too. nodesbetween will return the minimal set of bases and heads | |
1681 | # necessary to re-create the changegroup. |
|
1681 | # necessary to re-create the changegroup. | |
1682 |
|
1682 | |||
1683 | # Known heads are the list of heads that it is assumed the recipient |
|
1683 | # Known heads are the list of heads that it is assumed the recipient | |
1684 | # of this changegroup will know about. |
|
1684 | # of this changegroup will know about. | |
1685 | knownheads = set() |
|
1685 | knownheads = set() | |
1686 | # We assume that all parents of bases are known heads. |
|
1686 | # We assume that all parents of bases are known heads. | |
1687 | for n in bases: |
|
1687 | for n in bases: | |
1688 | knownheads.update(cl.parents(n)) |
|
1688 | knownheads.update(cl.parents(n)) | |
1689 | knownheads.discard(nullid) |
|
1689 | knownheads.discard(nullid) | |
1690 | knownheads = list(knownheads) |
|
1690 | knownheads = list(knownheads) | |
1691 | if knownheads: |
|
1691 | if knownheads: | |
1692 | # Now that we know what heads are known, we can compute which |
|
1692 | # Now that we know what heads are known, we can compute which | |
1693 | # changesets are known. The recipient must know about all |
|
1693 | # changesets are known. The recipient must know about all | |
1694 | # changesets required to reach the known heads from the null |
|
1694 | # changesets required to reach the known heads from the null | |
1695 | # changeset. |
|
1695 | # changeset. | |
1696 | has_cl_set, junk, junk = cl.nodesbetween(None, knownheads) |
|
1696 | has_cl_set, junk, junk = cl.nodesbetween(None, knownheads) | |
1697 | junk = None |
|
1697 | junk = None | |
1698 | # Transform the list into a set. |
|
1698 | # Transform the list into a set. | |
1699 | has_cl_set = set(has_cl_set) |
|
1699 | has_cl_set = set(has_cl_set) | |
1700 | else: |
|
1700 | else: | |
1701 | # If there were no known heads, the recipient cannot be assumed to |
|
1701 | # If there were no known heads, the recipient cannot be assumed to | |
1702 | # know about any changesets. |
|
1702 | # know about any changesets. | |
1703 | has_cl_set = set() |
|
1703 | has_cl_set = set() | |
1704 |
|
1704 | |||
1705 | # Make it easy to refer to self.manifest |
|
1705 | # Make it easy to refer to self.manifest | |
1706 | mnfst = self.manifest |
|
1706 | mnfst = self.manifest | |
1707 | # We don't know which manifests are missing yet |
|
1707 | # We don't know which manifests are missing yet | |
1708 | msng_mnfst_set = {} |
|
1708 | msng_mnfst_set = {} | |
1709 | # Nor do we know which filenodes are missing. |
|
1709 | # Nor do we know which filenodes are missing. | |
1710 | msng_filenode_set = {} |
|
1710 | msng_filenode_set = {} | |
1711 |
|
1711 | |||
1712 | junk = mnfst.index[len(mnfst) - 1] # Get around a bug in lazyindex |
|
1712 | junk = mnfst.index[len(mnfst) - 1] # Get around a bug in lazyindex | |
1713 | junk = None |
|
1713 | junk = None | |
1714 |
|
1714 | |||
1715 | # A changeset always belongs to itself, so the changenode lookup |
|
1715 | # A changeset always belongs to itself, so the changenode lookup | |
1716 | # function for a changenode is identity. |
|
1716 | # function for a changenode is identity. | |
1717 | def identity(x): |
|
1717 | def identity(x): | |
1718 | return x |
|
1718 | return x | |
1719 |
|
1719 | |||
1720 | # If we determine that a particular file or manifest node must be a |
|
1720 | # If we determine that a particular file or manifest node must be a | |
1721 | # node that the recipient of the changegroup will already have, we can |
|
1721 | # node that the recipient of the changegroup will already have, we can | |
1722 | # also assume the recipient will have all the parents. This function |
|
1722 | # also assume the recipient will have all the parents. This function | |
1723 | # prunes them from the set of missing nodes. |
|
1723 | # prunes them from the set of missing nodes. | |
1724 | def prune_parents(revlog, hasset, msngset): |
|
1724 | def prune_parents(revlog, hasset, msngset): | |
1725 | for r in revlog.ancestors(*[revlog.rev(n) for n in hasset]): |
|
1725 | for r in revlog.ancestors(*[revlog.rev(n) for n in hasset]): | |
1726 | msngset.pop(revlog.node(r), None) |
|
1726 | msngset.pop(revlog.node(r), None) | |
1727 |
|
1727 | |||
1728 | # Use the information collected in collect_manifests_and_files to say |
|
1728 | # Use the information collected in collect_manifests_and_files to say | |
1729 | # which changenode any manifestnode belongs to. |
|
1729 | # which changenode any manifestnode belongs to. | |
1730 | def lookup_manifest_link(mnfstnode): |
|
1730 | def lookup_manifest_link(mnfstnode): | |
1731 | return msng_mnfst_set[mnfstnode] |
|
1731 | return msng_mnfst_set[mnfstnode] | |
1732 |
|
1732 | |||
1733 | # A function generating function that sets up the initial environment |
|
1733 | # A function generating function that sets up the initial environment | |
1734 | # the inner function. |
|
1734 | # the inner function. | |
1735 | def filenode_collector(changedfiles): |
|
1735 | def filenode_collector(changedfiles): | |
1736 | # This gathers information from each manifestnode included in the |
|
1736 | # This gathers information from each manifestnode included in the | |
1737 | # changegroup about which filenodes the manifest node references |
|
1737 | # changegroup about which filenodes the manifest node references | |
1738 | # so we can include those in the changegroup too. |
|
1738 | # so we can include those in the changegroup too. | |
1739 | # |
|
1739 | # | |
1740 | # It also remembers which changenode each filenode belongs to. It |
|
1740 | # It also remembers which changenode each filenode belongs to. It | |
1741 | # does this by assuming the a filenode belongs to the changenode |
|
1741 | # does this by assuming the a filenode belongs to the changenode | |
1742 | # the first manifest that references it belongs to. |
|
1742 | # the first manifest that references it belongs to. | |
1743 | def collect_msng_filenodes(mnfstnode): |
|
1743 | def collect_msng_filenodes(mnfstnode): | |
1744 | r = mnfst.rev(mnfstnode) |
|
1744 | r = mnfst.rev(mnfstnode) | |
1745 | if r - 1 in mnfst.parentrevs(r): |
|
1745 | if r - 1 in mnfst.parentrevs(r): | |
1746 | # If the previous rev is one of the parents, |
|
1746 | # If the previous rev is one of the parents, | |
1747 | # we only need to see a diff. |
|
1747 | # we only need to see a diff. | |
1748 | deltamf = mnfst.readdelta(mnfstnode) |
|
1748 | deltamf = mnfst.readdelta(mnfstnode) | |
1749 | # For each line in the delta |
|
1749 | # For each line in the delta | |
1750 | for f, fnode in deltamf.iteritems(): |
|
1750 | for f, fnode in deltamf.iteritems(): | |
1751 | f = changedfiles.get(f, None) |
|
1751 | f = changedfiles.get(f, None) | |
1752 | # And if the file is in the list of files we care |
|
1752 | # And if the file is in the list of files we care | |
1753 | # about. |
|
1753 | # about. | |
1754 | if f is not None: |
|
1754 | if f is not None: | |
1755 | # Get the changenode this manifest belongs to |
|
1755 | # Get the changenode this manifest belongs to | |
1756 | clnode = msng_mnfst_set[mnfstnode] |
|
1756 | clnode = msng_mnfst_set[mnfstnode] | |
1757 | # Create the set of filenodes for the file if |
|
1757 | # Create the set of filenodes for the file if | |
1758 | # there isn't one already. |
|
1758 | # there isn't one already. | |
1759 | ndset = msng_filenode_set.setdefault(f, {}) |
|
1759 | ndset = msng_filenode_set.setdefault(f, {}) | |
1760 | # And set the filenode's changelog node to the |
|
1760 | # And set the filenode's changelog node to the | |
1761 | # manifest's if it hasn't been set already. |
|
1761 | # manifest's if it hasn't been set already. | |
1762 | ndset.setdefault(fnode, clnode) |
|
1762 | ndset.setdefault(fnode, clnode) | |
1763 | else: |
|
1763 | else: | |
1764 | # Otherwise we need a full manifest. |
|
1764 | # Otherwise we need a full manifest. | |
1765 | m = mnfst.read(mnfstnode) |
|
1765 | m = mnfst.read(mnfstnode) | |
1766 | # For every file in we care about. |
|
1766 | # For every file in we care about. | |
1767 | for f in changedfiles: |
|
1767 | for f in changedfiles: | |
1768 | fnode = m.get(f, None) |
|
1768 | fnode = m.get(f, None) | |
1769 | # If it's in the manifest |
|
1769 | # If it's in the manifest | |
1770 | if fnode is not None: |
|
1770 | if fnode is not None: | |
1771 | # See comments above. |
|
1771 | # See comments above. | |
1772 | clnode = msng_mnfst_set[mnfstnode] |
|
1772 | clnode = msng_mnfst_set[mnfstnode] | |
1773 | ndset = msng_filenode_set.setdefault(f, {}) |
|
1773 | ndset = msng_filenode_set.setdefault(f, {}) | |
1774 | ndset.setdefault(fnode, clnode) |
|
1774 | ndset.setdefault(fnode, clnode) | |
1775 | return collect_msng_filenodes |
|
1775 | return collect_msng_filenodes | |
1776 |
|
1776 | |||
1777 | # We have a list of filenodes we think we need for a file, lets remove |
|
1777 | # We have a list of filenodes we think we need for a file, lets remove | |
1778 | # all those we know the recipient must have. |
|
1778 | # all those we know the recipient must have. | |
1779 | def prune_filenodes(f, filerevlog): |
|
1779 | def prune_filenodes(f, filerevlog): | |
1780 | msngset = msng_filenode_set[f] |
|
1780 | msngset = msng_filenode_set[f] | |
1781 | hasset = set() |
|
1781 | hasset = set() | |
1782 | # If a 'missing' filenode thinks it belongs to a changenode we |
|
1782 | # If a 'missing' filenode thinks it belongs to a changenode we | |
1783 | # assume the recipient must have, then the recipient must have |
|
1783 | # assume the recipient must have, then the recipient must have | |
1784 | # that filenode. |
|
1784 | # that filenode. | |
1785 | for n in msngset: |
|
1785 | for n in msngset: | |
1786 | clnode = cl.node(filerevlog.linkrev(filerevlog.rev(n))) |
|
1786 | clnode = cl.node(filerevlog.linkrev(filerevlog.rev(n))) | |
1787 | if clnode in has_cl_set: |
|
1787 | if clnode in has_cl_set: | |
1788 | hasset.add(n) |
|
1788 | hasset.add(n) | |
1789 | prune_parents(filerevlog, hasset, msngset) |
|
1789 | prune_parents(filerevlog, hasset, msngset) | |
1790 |
|
1790 | |||
1791 | # A function generator function that sets up the a context for the |
|
1791 | # A function generator function that sets up the a context for the | |
1792 | # inner function. |
|
1792 | # inner function. | |
1793 | def lookup_filenode_link_func(fname): |
|
1793 | def lookup_filenode_link_func(fname): | |
1794 | msngset = msng_filenode_set[fname] |
|
1794 | msngset = msng_filenode_set[fname] | |
1795 | # Lookup the changenode the filenode belongs to. |
|
1795 | # Lookup the changenode the filenode belongs to. | |
1796 | def lookup_filenode_link(fnode): |
|
1796 | def lookup_filenode_link(fnode): | |
1797 | return msngset[fnode] |
|
1797 | return msngset[fnode] | |
1798 | return lookup_filenode_link |
|
1798 | return lookup_filenode_link | |
1799 |
|
1799 | |||
1800 | # Add the nodes that were explicitly requested. |
|
1800 | # Add the nodes that were explicitly requested. | |
1801 | def add_extra_nodes(name, nodes): |
|
1801 | def add_extra_nodes(name, nodes): | |
1802 | if not extranodes or name not in extranodes: |
|
1802 | if not extranodes or name not in extranodes: | |
1803 | return |
|
1803 | return | |
1804 |
|
1804 | |||
1805 | for node, linknode in extranodes[name]: |
|
1805 | for node, linknode in extranodes[name]: | |
1806 | if node not in nodes: |
|
1806 | if node not in nodes: | |
1807 | nodes[node] = linknode |
|
1807 | nodes[node] = linknode | |
1808 |
|
1808 | |||
1809 | # Now that we have all theses utility functions to help out and |
|
1809 | # Now that we have all theses utility functions to help out and | |
1810 | # logically divide up the task, generate the group. |
|
1810 | # logically divide up the task, generate the group. | |
1811 | def gengroup(): |
|
1811 | def gengroup(): | |
1812 | # The set of changed files starts empty. |
|
1812 | # The set of changed files starts empty. | |
1813 | changedfiles = {} |
|
1813 | changedfiles = {} | |
1814 | collect = changegroup.collector(cl, msng_mnfst_set, changedfiles) |
|
1814 | collect = changegroup.collector(cl, msng_mnfst_set, changedfiles) | |
1815 |
|
1815 | |||
1816 | # Create a changenode group generator that will call our functions |
|
1816 | # Create a changenode group generator that will call our functions | |
1817 | # back to lookup the owning changenode and collect information. |
|
1817 | # back to lookup the owning changenode and collect information. | |
1818 | group = cl.group(msng_cl_lst, identity, collect) |
|
1818 | group = cl.group(msng_cl_lst, identity, collect) | |
|
1819 | cnt = 0 | |||
1819 | for chnk in group: |
|
1820 | for chnk in group: | |
1820 | yield chnk |
|
1821 | yield chnk | |
|
1822 | self.ui.progress('bundle changes', cnt, unit='chunks') | |||
|
1823 | cnt += 1 | |||
|
1824 | self.ui.progress('bundle changes', None, unit='chunks') | |||
|
1825 | ||||
1821 |
|
1826 | |||
1822 | # Figure out which manifest nodes (of the ones we think might be |
|
1827 | # Figure out which manifest nodes (of the ones we think might be | |
1823 | # part of the changegroup) the recipient must know about and |
|
1828 | # part of the changegroup) the recipient must know about and | |
1824 | # remove them from the changegroup. |
|
1829 | # remove them from the changegroup. | |
1825 | has_mnfst_set = set() |
|
1830 | has_mnfst_set = set() | |
1826 | for n in msng_mnfst_set: |
|
1831 | for n in msng_mnfst_set: | |
1827 | # If a 'missing' manifest thinks it belongs to a changenode |
|
1832 | # If a 'missing' manifest thinks it belongs to a changenode | |
1828 | # the recipient is assumed to have, obviously the recipient |
|
1833 | # the recipient is assumed to have, obviously the recipient | |
1829 | # must have that manifest. |
|
1834 | # must have that manifest. | |
1830 | linknode = cl.node(mnfst.linkrev(mnfst.rev(n))) |
|
1835 | linknode = cl.node(mnfst.linkrev(mnfst.rev(n))) | |
1831 | if linknode in has_cl_set: |
|
1836 | if linknode in has_cl_set: | |
1832 | has_mnfst_set.add(n) |
|
1837 | has_mnfst_set.add(n) | |
1833 | prune_parents(mnfst, has_mnfst_set, msng_mnfst_set) |
|
1838 | prune_parents(mnfst, has_mnfst_set, msng_mnfst_set) | |
1834 | add_extra_nodes(1, msng_mnfst_set) |
|
1839 | add_extra_nodes(1, msng_mnfst_set) | |
1835 | msng_mnfst_lst = msng_mnfst_set.keys() |
|
1840 | msng_mnfst_lst = msng_mnfst_set.keys() | |
1836 | # Sort the manifestnodes by revision number. |
|
1841 | # Sort the manifestnodes by revision number. | |
1837 | msng_mnfst_lst.sort(key=mnfst.rev) |
|
1842 | msng_mnfst_lst.sort(key=mnfst.rev) | |
1838 | # Create a generator for the manifestnodes that calls our lookup |
|
1843 | # Create a generator for the manifestnodes that calls our lookup | |
1839 | # and data collection functions back. |
|
1844 | # and data collection functions back. | |
1840 | group = mnfst.group(msng_mnfst_lst, lookup_manifest_link, |
|
1845 | group = mnfst.group(msng_mnfst_lst, lookup_manifest_link, | |
1841 | filenode_collector(changedfiles)) |
|
1846 | filenode_collector(changedfiles)) | |
|
1847 | cnt = 0 | |||
1842 | for chnk in group: |
|
1848 | for chnk in group: | |
1843 | yield chnk |
|
1849 | yield chnk | |
|
1850 | self.ui.progress('bundle manifests', cnt, unit='chunks') | |||
|
1851 | cnt += 1 | |||
|
1852 | self.ui.progress('bundle manifests', None, unit='chunks') | |||
1844 |
|
1853 | |||
1845 | # These are no longer needed, dereference and toss the memory for |
|
1854 | # These are no longer needed, dereference and toss the memory for | |
1846 | # them. |
|
1855 | # them. | |
1847 | msng_mnfst_lst = None |
|
1856 | msng_mnfst_lst = None | |
1848 | msng_mnfst_set.clear() |
|
1857 | msng_mnfst_set.clear() | |
1849 |
|
1858 | |||
1850 | if extranodes: |
|
1859 | if extranodes: | |
1851 | for fname in extranodes: |
|
1860 | for fname in extranodes: | |
1852 | if isinstance(fname, int): |
|
1861 | if isinstance(fname, int): | |
1853 | continue |
|
1862 | continue | |
1854 | msng_filenode_set.setdefault(fname, {}) |
|
1863 | msng_filenode_set.setdefault(fname, {}) | |
1855 | changedfiles[fname] = 1 |
|
1864 | changedfiles[fname] = 1 | |
1856 | # Go through all our files in order sorted by name. |
|
1865 | # Go through all our files in order sorted by name. | |
|
1866 | cnt = 0 | |||
1857 | for fname in sorted(changedfiles): |
|
1867 | for fname in sorted(changedfiles): | |
1858 | filerevlog = self.file(fname) |
|
1868 | filerevlog = self.file(fname) | |
1859 | if not len(filerevlog): |
|
1869 | if not len(filerevlog): | |
1860 | raise util.Abort(_("empty or missing revlog for %s") % fname) |
|
1870 | raise util.Abort(_("empty or missing revlog for %s") % fname) | |
1861 | # Toss out the filenodes that the recipient isn't really |
|
1871 | # Toss out the filenodes that the recipient isn't really | |
1862 | # missing. |
|
1872 | # missing. | |
1863 | if fname in msng_filenode_set: |
|
1873 | if fname in msng_filenode_set: | |
1864 | prune_filenodes(fname, filerevlog) |
|
1874 | prune_filenodes(fname, filerevlog) | |
1865 | add_extra_nodes(fname, msng_filenode_set[fname]) |
|
1875 | add_extra_nodes(fname, msng_filenode_set[fname]) | |
1866 | msng_filenode_lst = msng_filenode_set[fname].keys() |
|
1876 | msng_filenode_lst = msng_filenode_set[fname].keys() | |
1867 | else: |
|
1877 | else: | |
1868 | msng_filenode_lst = [] |
|
1878 | msng_filenode_lst = [] | |
1869 | # If any filenodes are left, generate the group for them, |
|
1879 | # If any filenodes are left, generate the group for them, | |
1870 | # otherwise don't bother. |
|
1880 | # otherwise don't bother. | |
1871 | if len(msng_filenode_lst) > 0: |
|
1881 | if len(msng_filenode_lst) > 0: | |
1872 | yield changegroup.chunkheader(len(fname)) |
|
1882 | yield changegroup.chunkheader(len(fname)) | |
1873 | yield fname |
|
1883 | yield fname | |
1874 | # Sort the filenodes by their revision # |
|
1884 | # Sort the filenodes by their revision # | |
1875 | msng_filenode_lst.sort(key=filerevlog.rev) |
|
1885 | msng_filenode_lst.sort(key=filerevlog.rev) | |
1876 | # Create a group generator and only pass in a changenode |
|
1886 | # Create a group generator and only pass in a changenode | |
1877 | # lookup function as we need to collect no information |
|
1887 | # lookup function as we need to collect no information | |
1878 | # from filenodes. |
|
1888 | # from filenodes. | |
1879 | group = filerevlog.group(msng_filenode_lst, |
|
1889 | group = filerevlog.group(msng_filenode_lst, | |
1880 | lookup_filenode_link_func(fname)) |
|
1890 | lookup_filenode_link_func(fname)) | |
1881 | for chnk in group: |
|
1891 | for chnk in group: | |
|
1892 | self.ui.progress( | |||
|
1893 | 'bundle files', cnt, item=fname, unit='chunks') | |||
|
1894 | cnt += 1 | |||
1882 | yield chnk |
|
1895 | yield chnk | |
1883 | if fname in msng_filenode_set: |
|
1896 | if fname in msng_filenode_set: | |
1884 | # Don't need this anymore, toss it to free memory. |
|
1897 | # Don't need this anymore, toss it to free memory. | |
1885 | del msng_filenode_set[fname] |
|
1898 | del msng_filenode_set[fname] | |
1886 | # Signal that no more groups are left. |
|
1899 | # Signal that no more groups are left. | |
1887 | yield changegroup.closechunk() |
|
1900 | yield changegroup.closechunk() | |
|
1901 | self.ui.progress('bundle files', None, unit='chunks') | |||
1888 |
|
1902 | |||
1889 | if msng_cl_lst: |
|
1903 | if msng_cl_lst: | |
1890 | self.hook('outgoing', node=hex(msng_cl_lst[0]), source=source) |
|
1904 | self.hook('outgoing', node=hex(msng_cl_lst[0]), source=source) | |
1891 |
|
1905 | |||
1892 | return util.chunkbuffer(gengroup()) |
|
1906 | return util.chunkbuffer(gengroup()) | |
1893 |
|
1907 | |||
1894 | def changegroup(self, basenodes, source): |
|
1908 | def changegroup(self, basenodes, source): | |
1895 | # to avoid a race we use changegroupsubset() (issue1320) |
|
1909 | # to avoid a race we use changegroupsubset() (issue1320) | |
1896 | return self.changegroupsubset(basenodes, self.heads(), source) |
|
1910 | return self.changegroupsubset(basenodes, self.heads(), source) | |
1897 |
|
1911 | |||
1898 | def _changegroup(self, nodes, source): |
|
1912 | def _changegroup(self, nodes, source): | |
1899 | """Compute the changegroup of all nodes that we have that a recipient |
|
1913 | """Compute the changegroup of all nodes that we have that a recipient | |
1900 | doesn't. Return a chunkbuffer object whose read() method will return |
|
1914 | doesn't. Return a chunkbuffer object whose read() method will return | |
1901 | successive changegroup chunks. |
|
1915 | successive changegroup chunks. | |
1902 |
|
1916 | |||
1903 | This is much easier than the previous function as we can assume that |
|
1917 | This is much easier than the previous function as we can assume that | |
1904 | the recipient has any changenode we aren't sending them. |
|
1918 | the recipient has any changenode we aren't sending them. | |
1905 |
|
1919 | |||
1906 | nodes is the set of nodes to send""" |
|
1920 | nodes is the set of nodes to send""" | |
1907 |
|
1921 | |||
1908 | self.hook('preoutgoing', throw=True, source=source) |
|
1922 | self.hook('preoutgoing', throw=True, source=source) | |
1909 |
|
1923 | |||
1910 | cl = self.changelog |
|
1924 | cl = self.changelog | |
1911 | revset = set([cl.rev(n) for n in nodes]) |
|
1925 | revset = set([cl.rev(n) for n in nodes]) | |
1912 | self.changegroupinfo(nodes, source) |
|
1926 | self.changegroupinfo(nodes, source) | |
1913 |
|
1927 | |||
1914 | def identity(x): |
|
1928 | def identity(x): | |
1915 | return x |
|
1929 | return x | |
1916 |
|
1930 | |||
1917 | def gennodelst(log): |
|
1931 | def gennodelst(log): | |
1918 | for r in log: |
|
1932 | for r in log: | |
1919 | if log.linkrev(r) in revset: |
|
1933 | if log.linkrev(r) in revset: | |
1920 | yield log.node(r) |
|
1934 | yield log.node(r) | |
1921 |
|
1935 | |||
1922 | def lookuprevlink_func(revlog): |
|
1936 | def lookuprevlink_func(revlog): | |
1923 | def lookuprevlink(n): |
|
1937 | def lookuprevlink(n): | |
1924 | return cl.node(revlog.linkrev(revlog.rev(n))) |
|
1938 | return cl.node(revlog.linkrev(revlog.rev(n))) | |
1925 | return lookuprevlink |
|
1939 | return lookuprevlink | |
1926 |
|
1940 | |||
1927 | def gengroup(): |
|
1941 | def gengroup(): | |
1928 | '''yield a sequence of changegroup chunks (strings)''' |
|
1942 | '''yield a sequence of changegroup chunks (strings)''' | |
1929 | # construct a list of all changed files |
|
1943 | # construct a list of all changed files | |
1930 | changedfiles = {} |
|
1944 | changedfiles = {} | |
1931 | mmfs = {} |
|
1945 | mmfs = {} | |
1932 | collect = changegroup.collector(cl, mmfs, changedfiles) |
|
1946 | collect = changegroup.collector(cl, mmfs, changedfiles) | |
1933 |
|
1947 | |||
|
1948 | cnt = 0 | |||
1934 | for chnk in cl.group(nodes, identity, collect): |
|
1949 | for chnk in cl.group(nodes, identity, collect): | |
|
1950 | self.ui.progress('bundle changes', cnt, unit='chunks') | |||
|
1951 | cnt += 1 | |||
1935 | yield chnk |
|
1952 | yield chnk | |
|
1953 | self.ui.progress('bundle changes', None, unit='chunks') | |||
1936 |
|
1954 | |||
1937 | mnfst = self.manifest |
|
1955 | mnfst = self.manifest | |
1938 | nodeiter = gennodelst(mnfst) |
|
1956 | nodeiter = gennodelst(mnfst) | |
|
1957 | cnt = 0 | |||
1939 | for chnk in mnfst.group(nodeiter, lookuprevlink_func(mnfst)): |
|
1958 | for chnk in mnfst.group(nodeiter, lookuprevlink_func(mnfst)): | |
|
1959 | self.ui.progress('bundle manifests', cnt, unit='chunks') | |||
|
1960 | cnt += 1 | |||
1940 | yield chnk |
|
1961 | yield chnk | |
|
1962 | self.ui.progress('bundle manifests', None, unit='chunks') | |||
1941 |
|
1963 | |||
|
1964 | cnt = 0 | |||
1942 | for fname in sorted(changedfiles): |
|
1965 | for fname in sorted(changedfiles): | |
1943 | filerevlog = self.file(fname) |
|
1966 | filerevlog = self.file(fname) | |
1944 | if not len(filerevlog): |
|
1967 | if not len(filerevlog): | |
1945 | raise util.Abort(_("empty or missing revlog for %s") % fname) |
|
1968 | raise util.Abort(_("empty or missing revlog for %s") % fname) | |
1946 | nodeiter = gennodelst(filerevlog) |
|
1969 | nodeiter = gennodelst(filerevlog) | |
1947 | nodeiter = list(nodeiter) |
|
1970 | nodeiter = list(nodeiter) | |
1948 | if nodeiter: |
|
1971 | if nodeiter: | |
1949 | yield changegroup.chunkheader(len(fname)) |
|
1972 | yield changegroup.chunkheader(len(fname)) | |
1950 | yield fname |
|
1973 | yield fname | |
1951 | lookup = lookuprevlink_func(filerevlog) |
|
1974 | lookup = lookuprevlink_func(filerevlog) | |
1952 | for chnk in filerevlog.group(nodeiter, lookup): |
|
1975 | for chnk in filerevlog.group(nodeiter, lookup): | |
|
1976 | self.ui.progress( | |||
|
1977 | 'bundle files', cnt, item=fname, unit='chunks') | |||
|
1978 | cnt += 1 | |||
1953 | yield chnk |
|
1979 | yield chnk | |
|
1980 | self.ui.progress('bundle files', None, unit='chunks') | |||
1954 |
|
1981 | |||
1955 | yield changegroup.closechunk() |
|
1982 | yield changegroup.closechunk() | |
1956 |
|
1983 | |||
1957 | if nodes: |
|
1984 | if nodes: | |
1958 | self.hook('outgoing', node=hex(nodes[0]), source=source) |
|
1985 | self.hook('outgoing', node=hex(nodes[0]), source=source) | |
1959 |
|
1986 | |||
1960 | return util.chunkbuffer(gengroup()) |
|
1987 | return util.chunkbuffer(gengroup()) | |
1961 |
|
1988 | |||
1962 | def addchangegroup(self, source, srctype, url, emptyok=False): |
|
1989 | def addchangegroup(self, source, srctype, url, emptyok=False): | |
1963 | """add changegroup to repo. |
|
1990 | """add changegroup to repo. | |
1964 |
|
1991 | |||
1965 | return values: |
|
1992 | return values: | |
1966 | - nothing changed or no source: 0 |
|
1993 | - nothing changed or no source: 0 | |
1967 | - more heads than before: 1+added heads (2..n) |
|
1994 | - more heads than before: 1+added heads (2..n) | |
1968 | - less heads than before: -1-removed heads (-2..-n) |
|
1995 | - less heads than before: -1-removed heads (-2..-n) | |
1969 | - number of heads stays the same: 1 |
|
1996 | - number of heads stays the same: 1 | |
1970 | """ |
|
1997 | """ | |
1971 | def csmap(x): |
|
1998 | def csmap(x): | |
1972 | self.ui.debug("add changeset %s\n" % short(x)) |
|
1999 | self.ui.debug("add changeset %s\n" % short(x)) | |
1973 | return len(cl) |
|
2000 | return len(cl) | |
1974 |
|
2001 | |||
1975 | def revmap(x): |
|
2002 | def revmap(x): | |
1976 | return cl.rev(x) |
|
2003 | return cl.rev(x) | |
1977 |
|
2004 | |||
1978 | if not source: |
|
2005 | if not source: | |
1979 | return 0 |
|
2006 | return 0 | |
1980 |
|
2007 | |||
1981 | self.hook('prechangegroup', throw=True, source=srctype, url=url) |
|
2008 | self.hook('prechangegroup', throw=True, source=srctype, url=url) | |
1982 |
|
2009 | |||
1983 | changesets = files = revisions = 0 |
|
2010 | changesets = files = revisions = 0 | |
1984 |
|
2011 | |||
1985 | # write changelog data to temp files so concurrent readers will not see |
|
2012 | # write changelog data to temp files so concurrent readers will not see | |
1986 | # inconsistent view |
|
2013 | # inconsistent view | |
1987 | cl = self.changelog |
|
2014 | cl = self.changelog | |
1988 | cl.delayupdate() |
|
2015 | cl.delayupdate() | |
1989 | oldheads = len(cl.heads()) |
|
2016 | oldheads = len(cl.heads()) | |
1990 |
|
2017 | |||
1991 | tr = self.transaction() |
|
2018 | tr = self.transaction() | |
1992 | try: |
|
2019 | try: | |
1993 | trp = weakref.proxy(tr) |
|
2020 | trp = weakref.proxy(tr) | |
1994 | # pull off the changeset group |
|
2021 | # pull off the changeset group | |
1995 | self.ui.status(_("adding changesets\n")) |
|
2022 | self.ui.status(_("adding changesets\n")) | |
1996 | clstart = len(cl) |
|
2023 | clstart = len(cl) | |
1997 | class prog(object): |
|
2024 | class prog(object): | |
1998 | step = 'changesets' |
|
2025 | step = 'changesets' | |
1999 | count = 1 |
|
2026 | count = 1 | |
2000 | ui = self.ui |
|
2027 | ui = self.ui | |
2001 | def __call__(self): |
|
2028 | def __call__(self): | |
2002 | self.ui.progress(self.step, self.count, unit='chunks') |
|
2029 | self.ui.progress(self.step, self.count, unit='chunks') | |
2003 | self.count += 1 |
|
2030 | self.count += 1 | |
2004 | pr = prog() |
|
2031 | pr = prog() | |
2005 | chunkiter = changegroup.chunkiter(source, progress=pr) |
|
2032 | chunkiter = changegroup.chunkiter(source, progress=pr) | |
2006 | if cl.addgroup(chunkiter, csmap, trp) is None and not emptyok: |
|
2033 | if cl.addgroup(chunkiter, csmap, trp) is None and not emptyok: | |
2007 | raise util.Abort(_("received changelog group is empty")) |
|
2034 | raise util.Abort(_("received changelog group is empty")) | |
2008 | clend = len(cl) |
|
2035 | clend = len(cl) | |
2009 | changesets = clend - clstart |
|
2036 | changesets = clend - clstart | |
2010 | self.ui.progress('changesets', None) |
|
2037 | self.ui.progress('changesets', None) | |
2011 |
|
2038 | |||
2012 | # pull off the manifest group |
|
2039 | # pull off the manifest group | |
2013 | self.ui.status(_("adding manifests\n")) |
|
2040 | self.ui.status(_("adding manifests\n")) | |
2014 | pr.step = 'manifests' |
|
2041 | pr.step = 'manifests' | |
2015 | pr.count = 1 |
|
2042 | pr.count = 1 | |
2016 | chunkiter = changegroup.chunkiter(source, progress=pr) |
|
2043 | chunkiter = changegroup.chunkiter(source, progress=pr) | |
2017 | # no need to check for empty manifest group here: |
|
2044 | # no need to check for empty manifest group here: | |
2018 | # if the result of the merge of 1 and 2 is the same in 3 and 4, |
|
2045 | # if the result of the merge of 1 and 2 is the same in 3 and 4, | |
2019 | # no new manifest will be created and the manifest group will |
|
2046 | # no new manifest will be created and the manifest group will | |
2020 | # be empty during the pull |
|
2047 | # be empty during the pull | |
2021 | self.manifest.addgroup(chunkiter, revmap, trp) |
|
2048 | self.manifest.addgroup(chunkiter, revmap, trp) | |
2022 | self.ui.progress('manifests', None) |
|
2049 | self.ui.progress('manifests', None) | |
2023 |
|
2050 | |||
2024 | needfiles = {} |
|
2051 | needfiles = {} | |
2025 | if self.ui.configbool('server', 'validate', default=False): |
|
2052 | if self.ui.configbool('server', 'validate', default=False): | |
2026 | # validate incoming csets have their manifests |
|
2053 | # validate incoming csets have their manifests | |
2027 | for cset in xrange(clstart, clend): |
|
2054 | for cset in xrange(clstart, clend): | |
2028 | mfest = self.changelog.read(self.changelog.node(cset))[0] |
|
2055 | mfest = self.changelog.read(self.changelog.node(cset))[0] | |
2029 | mfest = self.manifest.readdelta(mfest) |
|
2056 | mfest = self.manifest.readdelta(mfest) | |
2030 | # store file nodes we must see |
|
2057 | # store file nodes we must see | |
2031 | for f, n in mfest.iteritems(): |
|
2058 | for f, n in mfest.iteritems(): | |
2032 | needfiles.setdefault(f, set()).add(n) |
|
2059 | needfiles.setdefault(f, set()).add(n) | |
2033 |
|
2060 | |||
2034 | # process the files |
|
2061 | # process the files | |
2035 | self.ui.status(_("adding file changes\n")) |
|
2062 | self.ui.status(_("adding file changes\n")) | |
2036 | pr.step = 'files' |
|
2063 | pr.step = 'files' | |
2037 | pr.count = 1 |
|
2064 | pr.count = 1 | |
2038 | while 1: |
|
2065 | while 1: | |
2039 | f = changegroup.getchunk(source) |
|
2066 | f = changegroup.getchunk(source) | |
2040 | if not f: |
|
2067 | if not f: | |
2041 | break |
|
2068 | break | |
2042 | self.ui.debug("adding %s revisions\n" % f) |
|
2069 | self.ui.debug("adding %s revisions\n" % f) | |
2043 | fl = self.file(f) |
|
2070 | fl = self.file(f) | |
2044 | o = len(fl) |
|
2071 | o = len(fl) | |
2045 | chunkiter = changegroup.chunkiter(source, progress=pr) |
|
2072 | chunkiter = changegroup.chunkiter(source, progress=pr) | |
2046 | if fl.addgroup(chunkiter, revmap, trp) is None: |
|
2073 | if fl.addgroup(chunkiter, revmap, trp) is None: | |
2047 | raise util.Abort(_("received file revlog group is empty")) |
|
2074 | raise util.Abort(_("received file revlog group is empty")) | |
2048 | revisions += len(fl) - o |
|
2075 | revisions += len(fl) - o | |
2049 | files += 1 |
|
2076 | files += 1 | |
2050 | if f in needfiles: |
|
2077 | if f in needfiles: | |
2051 | needs = needfiles[f] |
|
2078 | needs = needfiles[f] | |
2052 | for new in xrange(o, len(fl)): |
|
2079 | for new in xrange(o, len(fl)): | |
2053 | n = fl.node(new) |
|
2080 | n = fl.node(new) | |
2054 | if n in needs: |
|
2081 | if n in needs: | |
2055 | needs.remove(n) |
|
2082 | needs.remove(n) | |
2056 | if not needs: |
|
2083 | if not needs: | |
2057 | del needfiles[f] |
|
2084 | del needfiles[f] | |
2058 | self.ui.progress('files', None) |
|
2085 | self.ui.progress('files', None) | |
2059 |
|
2086 | |||
2060 | for f, needs in needfiles.iteritems(): |
|
2087 | for f, needs in needfiles.iteritems(): | |
2061 | fl = self.file(f) |
|
2088 | fl = self.file(f) | |
2062 | for n in needs: |
|
2089 | for n in needs: | |
2063 | try: |
|
2090 | try: | |
2064 | fl.rev(n) |
|
2091 | fl.rev(n) | |
2065 | except error.LookupError: |
|
2092 | except error.LookupError: | |
2066 | raise util.Abort( |
|
2093 | raise util.Abort( | |
2067 | _('missing file data for %s:%s - run hg verify') % |
|
2094 | _('missing file data for %s:%s - run hg verify') % | |
2068 | (f, hex(n))) |
|
2095 | (f, hex(n))) | |
2069 |
|
2096 | |||
2070 | newheads = len(cl.heads()) |
|
2097 | newheads = len(cl.heads()) | |
2071 | heads = "" |
|
2098 | heads = "" | |
2072 | if oldheads and newheads != oldheads: |
|
2099 | if oldheads and newheads != oldheads: | |
2073 | heads = _(" (%+d heads)") % (newheads - oldheads) |
|
2100 | heads = _(" (%+d heads)") % (newheads - oldheads) | |
2074 |
|
2101 | |||
2075 | self.ui.status(_("added %d changesets" |
|
2102 | self.ui.status(_("added %d changesets" | |
2076 | " with %d changes to %d files%s\n") |
|
2103 | " with %d changes to %d files%s\n") | |
2077 | % (changesets, revisions, files, heads)) |
|
2104 | % (changesets, revisions, files, heads)) | |
2078 |
|
2105 | |||
2079 | if changesets > 0: |
|
2106 | if changesets > 0: | |
2080 | p = lambda: cl.writepending() and self.root or "" |
|
2107 | p = lambda: cl.writepending() and self.root or "" | |
2081 | self.hook('pretxnchangegroup', throw=True, |
|
2108 | self.hook('pretxnchangegroup', throw=True, | |
2082 | node=hex(cl.node(clstart)), source=srctype, |
|
2109 | node=hex(cl.node(clstart)), source=srctype, | |
2083 | url=url, pending=p) |
|
2110 | url=url, pending=p) | |
2084 |
|
2111 | |||
2085 | # make changelog see real files again |
|
2112 | # make changelog see real files again | |
2086 | cl.finalize(trp) |
|
2113 | cl.finalize(trp) | |
2087 |
|
2114 | |||
2088 | tr.close() |
|
2115 | tr.close() | |
2089 | finally: |
|
2116 | finally: | |
2090 | del tr |
|
2117 | del tr | |
2091 |
|
2118 | |||
2092 | if changesets > 0: |
|
2119 | if changesets > 0: | |
2093 | # forcefully update the on-disk branch cache |
|
2120 | # forcefully update the on-disk branch cache | |
2094 | self.ui.debug("updating the branch cache\n") |
|
2121 | self.ui.debug("updating the branch cache\n") | |
2095 | self.branchtags() |
|
2122 | self.branchtags() | |
2096 | self.hook("changegroup", node=hex(cl.node(clstart)), |
|
2123 | self.hook("changegroup", node=hex(cl.node(clstart)), | |
2097 | source=srctype, url=url) |
|
2124 | source=srctype, url=url) | |
2098 |
|
2125 | |||
2099 | for i in xrange(clstart, clend): |
|
2126 | for i in xrange(clstart, clend): | |
2100 | self.hook("incoming", node=hex(cl.node(i)), |
|
2127 | self.hook("incoming", node=hex(cl.node(i)), | |
2101 | source=srctype, url=url) |
|
2128 | source=srctype, url=url) | |
2102 |
|
2129 | |||
2103 | # never return 0 here: |
|
2130 | # never return 0 here: | |
2104 | if newheads < oldheads: |
|
2131 | if newheads < oldheads: | |
2105 | return newheads - oldheads - 1 |
|
2132 | return newheads - oldheads - 1 | |
2106 | else: |
|
2133 | else: | |
2107 | return newheads - oldheads + 1 |
|
2134 | return newheads - oldheads + 1 | |
2108 |
|
2135 | |||
2109 |
|
2136 | |||
2110 | def stream_in(self, remote): |
|
2137 | def stream_in(self, remote): | |
2111 | fp = remote.stream_out() |
|
2138 | fp = remote.stream_out() | |
2112 | l = fp.readline() |
|
2139 | l = fp.readline() | |
2113 | try: |
|
2140 | try: | |
2114 | resp = int(l) |
|
2141 | resp = int(l) | |
2115 | except ValueError: |
|
2142 | except ValueError: | |
2116 | raise error.ResponseError( |
|
2143 | raise error.ResponseError( | |
2117 | _('Unexpected response from remote server:'), l) |
|
2144 | _('Unexpected response from remote server:'), l) | |
2118 | if resp == 1: |
|
2145 | if resp == 1: | |
2119 | raise util.Abort(_('operation forbidden by server')) |
|
2146 | raise util.Abort(_('operation forbidden by server')) | |
2120 | elif resp == 2: |
|
2147 | elif resp == 2: | |
2121 | raise util.Abort(_('locking the remote repository failed')) |
|
2148 | raise util.Abort(_('locking the remote repository failed')) | |
2122 | elif resp != 0: |
|
2149 | elif resp != 0: | |
2123 | raise util.Abort(_('the server sent an unknown error code')) |
|
2150 | raise util.Abort(_('the server sent an unknown error code')) | |
2124 | self.ui.status(_('streaming all changes\n')) |
|
2151 | self.ui.status(_('streaming all changes\n')) | |
2125 | l = fp.readline() |
|
2152 | l = fp.readline() | |
2126 | try: |
|
2153 | try: | |
2127 | total_files, total_bytes = map(int, l.split(' ', 1)) |
|
2154 | total_files, total_bytes = map(int, l.split(' ', 1)) | |
2128 | except (ValueError, TypeError): |
|
2155 | except (ValueError, TypeError): | |
2129 | raise error.ResponseError( |
|
2156 | raise error.ResponseError( | |
2130 | _('Unexpected response from remote server:'), l) |
|
2157 | _('Unexpected response from remote server:'), l) | |
2131 | self.ui.status(_('%d files to transfer, %s of data\n') % |
|
2158 | self.ui.status(_('%d files to transfer, %s of data\n') % | |
2132 | (total_files, util.bytecount(total_bytes))) |
|
2159 | (total_files, util.bytecount(total_bytes))) | |
2133 | start = time.time() |
|
2160 | start = time.time() | |
2134 | for i in xrange(total_files): |
|
2161 | for i in xrange(total_files): | |
2135 | # XXX doesn't support '\n' or '\r' in filenames |
|
2162 | # XXX doesn't support '\n' or '\r' in filenames | |
2136 | l = fp.readline() |
|
2163 | l = fp.readline() | |
2137 | try: |
|
2164 | try: | |
2138 | name, size = l.split('\0', 1) |
|
2165 | name, size = l.split('\0', 1) | |
2139 | size = int(size) |
|
2166 | size = int(size) | |
2140 | except (ValueError, TypeError): |
|
2167 | except (ValueError, TypeError): | |
2141 | raise error.ResponseError( |
|
2168 | raise error.ResponseError( | |
2142 | _('Unexpected response from remote server:'), l) |
|
2169 | _('Unexpected response from remote server:'), l) | |
2143 | self.ui.debug('adding %s (%s)\n' % (name, util.bytecount(size))) |
|
2170 | self.ui.debug('adding %s (%s)\n' % (name, util.bytecount(size))) | |
2144 | # for backwards compat, name was partially encoded |
|
2171 | # for backwards compat, name was partially encoded | |
2145 | ofp = self.sopener(store.decodedir(name), 'w') |
|
2172 | ofp = self.sopener(store.decodedir(name), 'w') | |
2146 | for chunk in util.filechunkiter(fp, limit=size): |
|
2173 | for chunk in util.filechunkiter(fp, limit=size): | |
2147 | ofp.write(chunk) |
|
2174 | ofp.write(chunk) | |
2148 | ofp.close() |
|
2175 | ofp.close() | |
2149 | elapsed = time.time() - start |
|
2176 | elapsed = time.time() - start | |
2150 | if elapsed <= 0: |
|
2177 | if elapsed <= 0: | |
2151 | elapsed = 0.001 |
|
2178 | elapsed = 0.001 | |
2152 | self.ui.status(_('transferred %s in %.1f seconds (%s/sec)\n') % |
|
2179 | self.ui.status(_('transferred %s in %.1f seconds (%s/sec)\n') % | |
2153 | (util.bytecount(total_bytes), elapsed, |
|
2180 | (util.bytecount(total_bytes), elapsed, | |
2154 | util.bytecount(total_bytes / elapsed))) |
|
2181 | util.bytecount(total_bytes / elapsed))) | |
2155 | self.invalidate() |
|
2182 | self.invalidate() | |
2156 | return len(self.heads()) + 1 |
|
2183 | return len(self.heads()) + 1 | |
2157 |
|
2184 | |||
2158 | def clone(self, remote, heads=[], stream=False): |
|
2185 | def clone(self, remote, heads=[], stream=False): | |
2159 | '''clone remote repository. |
|
2186 | '''clone remote repository. | |
2160 |
|
2187 | |||
2161 | keyword arguments: |
|
2188 | keyword arguments: | |
2162 | heads: list of revs to clone (forces use of pull) |
|
2189 | heads: list of revs to clone (forces use of pull) | |
2163 | stream: use streaming clone if possible''' |
|
2190 | stream: use streaming clone if possible''' | |
2164 |
|
2191 | |||
2165 | # now, all clients that can request uncompressed clones can |
|
2192 | # now, all clients that can request uncompressed clones can | |
2166 | # read repo formats supported by all servers that can serve |
|
2193 | # read repo formats supported by all servers that can serve | |
2167 | # them. |
|
2194 | # them. | |
2168 |
|
2195 | |||
2169 | # if revlog format changes, client will have to check version |
|
2196 | # if revlog format changes, client will have to check version | |
2170 | # and format flags on "stream" capability, and use |
|
2197 | # and format flags on "stream" capability, and use | |
2171 | # uncompressed only if compatible. |
|
2198 | # uncompressed only if compatible. | |
2172 |
|
2199 | |||
2173 | if stream and not heads and remote.capable('stream'): |
|
2200 | if stream and not heads and remote.capable('stream'): | |
2174 | return self.stream_in(remote) |
|
2201 | return self.stream_in(remote) | |
2175 | return self.pull(remote, heads) |
|
2202 | return self.pull(remote, heads) | |
2176 |
|
2203 | |||
2177 | # used to avoid circular references so destructors work |
|
2204 | # used to avoid circular references so destructors work | |
2178 | def aftertrans(files): |
|
2205 | def aftertrans(files): | |
2179 | renamefiles = [tuple(t) for t in files] |
|
2206 | renamefiles = [tuple(t) for t in files] | |
2180 | def a(): |
|
2207 | def a(): | |
2181 | for src, dest in renamefiles: |
|
2208 | for src, dest in renamefiles: | |
2182 | util.rename(src, dest) |
|
2209 | util.rename(src, dest) | |
2183 | return a |
|
2210 | return a | |
2184 |
|
2211 | |||
2185 | def instance(ui, path, create): |
|
2212 | def instance(ui, path, create): | |
2186 | return localrepository(ui, util.drop_scheme('file', path), create) |
|
2213 | return localrepository(ui, util.drop_scheme('file', path), create) | |
2187 |
|
2214 | |||
2188 | def islocal(path): |
|
2215 | def islocal(path): | |
2189 | return True |
|
2216 | return True |
@@ -1,717 +1,1165 | |||||
1 | 3:911600dab2ae |
|
1 | 3:911600dab2ae | |
2 | requesting all changes |
|
2 | requesting all changes | |
3 | adding changesets |
|
3 | adding changesets | |
4 | adding manifests |
|
4 | adding manifests | |
5 | adding file changes |
|
5 | adding file changes | |
6 | added 1 changesets with 3 changes to 3 files |
|
6 | added 1 changesets with 3 changes to 3 files | |
7 | updating to branch default |
|
7 | updating to branch default | |
8 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
8 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
9 |
|
9 | |||
10 | Extension disabled for lack of a hook |
|
10 | Extension disabled for lack of a hook | |
11 | Pushing as user fred |
|
11 | Pushing as user fred | |
12 | hgrc = """ |
|
12 | hgrc = """ | |
13 | """ |
|
13 | """ | |
14 | pushing to ../b |
|
14 | pushing to ../b | |
15 | searching for changes |
|
15 | searching for changes | |
16 | common changesets up to 6675d58eff77 |
|
16 | common changesets up to 6675d58eff77 | |
17 | 3 changesets found |
|
17 | 3 changesets found | |
18 | list of changesets: |
|
18 | list of changesets: | |
19 | ef1ea85a6374b77d6da9dcda9541f498f2d17df7 |
|
19 | ef1ea85a6374b77d6da9dcda9541f498f2d17df7 | |
20 | f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd |
|
20 | f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd | |
21 | 911600dab2ae7a9baff75958b84fe606851ce955 |
|
21 | 911600dab2ae7a9baff75958b84fe606851ce955 | |
22 | adding changesets |
|
22 | adding changesets | |
|
23 | bundle changes: 0 chunks | |||
|
24 | bundle changes: 1 chunks | |||
|
25 | bundle changes: 2 chunks | |||
|
26 | bundle changes: 3 chunks | |||
|
27 | bundle changes: 4 chunks | |||
|
28 | bundle changes: 5 chunks | |||
|
29 | bundle changes: 6 chunks | |||
|
30 | bundle changes: 7 chunks | |||
|
31 | bundle changes: 8 chunks | |||
|
32 | bundle changes: 9 chunks | |||
|
33 | bundle manifests: 0 chunks | |||
|
34 | bundle manifests: 1 chunks | |||
|
35 | bundle manifests: 2 chunks | |||
|
36 | bundle manifests: 3 chunks | |||
|
37 | bundle manifests: 4 chunks | |||
|
38 | bundle manifests: 5 chunks | |||
|
39 | bundle manifests: 6 chunks | |||
|
40 | bundle manifests: 7 chunks | |||
|
41 | bundle manifests: 8 chunks | |||
|
42 | bundle manifests: 9 chunks | |||
|
43 | bundle files: foo/Bar/file.txt 0 chunks | |||
|
44 | bundle files: foo/Bar/file.txt 1 chunks | |||
|
45 | bundle files: foo/Bar/file.txt 2 chunks | |||
|
46 | bundle files: foo/Bar/file.txt 3 chunks | |||
|
47 | bundle files: foo/file.txt 4 chunks | |||
|
48 | bundle files: foo/file.txt 5 chunks | |||
|
49 | bundle files: foo/file.txt 6 chunks | |||
|
50 | bundle files: foo/file.txt 7 chunks | |||
|
51 | bundle files: quux/file.py 8 chunks | |||
|
52 | bundle files: quux/file.py 9 chunks | |||
|
53 | bundle files: quux/file.py 10 chunks | |||
|
54 | bundle files: quux/file.py 11 chunks | |||
23 | changesets: 1 chunks |
|
55 | changesets: 1 chunks | |
24 | add changeset ef1ea85a6374 |
|
56 | add changeset ef1ea85a6374 | |
25 | changesets: 2 chunks |
|
57 | changesets: 2 chunks | |
26 | add changeset f9cafe1212c8 |
|
58 | add changeset f9cafe1212c8 | |
27 | changesets: 3 chunks |
|
59 | changesets: 3 chunks | |
28 | add changeset 911600dab2ae |
|
60 | add changeset 911600dab2ae | |
29 | adding manifests |
|
61 | adding manifests | |
30 | manifests: 1 chunks |
|
62 | manifests: 1 chunks | |
31 | manifests: 2 chunks |
|
63 | manifests: 2 chunks | |
32 | manifests: 3 chunks |
|
64 | manifests: 3 chunks | |
33 | adding file changes |
|
65 | adding file changes | |
34 | adding foo/Bar/file.txt revisions |
|
66 | adding foo/Bar/file.txt revisions | |
35 | files: 1 chunks |
|
67 | files: 1 chunks | |
36 | adding foo/file.txt revisions |
|
68 | adding foo/file.txt revisions | |
37 | files: 2 chunks |
|
69 | files: 2 chunks | |
38 | adding quux/file.py revisions |
|
70 | adding quux/file.py revisions | |
39 | files: 3 chunks |
|
71 | files: 3 chunks | |
40 | added 3 changesets with 3 changes to 3 files |
|
72 | added 3 changesets with 3 changes to 3 files | |
41 | updating the branch cache |
|
73 | updating the branch cache | |
42 | rolling back last transaction |
|
74 | rolling back last transaction | |
43 | 0:6675d58eff77 |
|
75 | 0:6675d58eff77 | |
44 |
|
76 | |||
45 | Extension disabled for lack of acl.sources |
|
77 | Extension disabled for lack of acl.sources | |
46 | Pushing as user fred |
|
78 | Pushing as user fred | |
47 | hgrc = """ |
|
79 | hgrc = """ | |
48 | [hooks] |
|
80 | [hooks] | |
49 | pretxnchangegroup.acl = python:hgext.acl.hook |
|
81 | pretxnchangegroup.acl = python:hgext.acl.hook | |
50 | """ |
|
82 | """ | |
51 | pushing to ../b |
|
83 | pushing to ../b | |
52 | searching for changes |
|
84 | searching for changes | |
53 | common changesets up to 6675d58eff77 |
|
85 | common changesets up to 6675d58eff77 | |
54 | invalidating branch cache (tip differs) |
|
86 | invalidating branch cache (tip differs) | |
55 | 3 changesets found |
|
87 | 3 changesets found | |
56 | list of changesets: |
|
88 | list of changesets: | |
57 | ef1ea85a6374b77d6da9dcda9541f498f2d17df7 |
|
89 | ef1ea85a6374b77d6da9dcda9541f498f2d17df7 | |
58 | f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd |
|
90 | f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd | |
59 | 911600dab2ae7a9baff75958b84fe606851ce955 |
|
91 | 911600dab2ae7a9baff75958b84fe606851ce955 | |
60 | adding changesets |
|
92 | adding changesets | |
|
93 | bundle changes: 0 chunks | |||
|
94 | bundle changes: 1 chunks | |||
|
95 | bundle changes: 2 chunks | |||
|
96 | bundle changes: 3 chunks | |||
|
97 | bundle changes: 4 chunks | |||
|
98 | bundle changes: 5 chunks | |||
|
99 | bundle changes: 6 chunks | |||
|
100 | bundle changes: 7 chunks | |||
|
101 | bundle changes: 8 chunks | |||
|
102 | bundle changes: 9 chunks | |||
|
103 | bundle manifests: 0 chunks | |||
|
104 | bundle manifests: 1 chunks | |||
|
105 | bundle manifests: 2 chunks | |||
|
106 | bundle manifests: 3 chunks | |||
|
107 | bundle manifests: 4 chunks | |||
|
108 | bundle manifests: 5 chunks | |||
|
109 | bundle manifests: 6 chunks | |||
|
110 | bundle manifests: 7 chunks | |||
|
111 | bundle manifests: 8 chunks | |||
|
112 | bundle manifests: 9 chunks | |||
|
113 | bundle files: foo/Bar/file.txt 0 chunks | |||
|
114 | bundle files: foo/Bar/file.txt 1 chunks | |||
|
115 | bundle files: foo/Bar/file.txt 2 chunks | |||
|
116 | bundle files: foo/Bar/file.txt 3 chunks | |||
|
117 | bundle files: foo/file.txt 4 chunks | |||
|
118 | bundle files: foo/file.txt 5 chunks | |||
|
119 | bundle files: foo/file.txt 6 chunks | |||
|
120 | bundle files: foo/file.txt 7 chunks | |||
|
121 | bundle files: quux/file.py 8 chunks | |||
|
122 | bundle files: quux/file.py 9 chunks | |||
|
123 | bundle files: quux/file.py 10 chunks | |||
|
124 | bundle files: quux/file.py 11 chunks | |||
61 | changesets: 1 chunks |
|
125 | changesets: 1 chunks | |
62 | add changeset ef1ea85a6374 |
|
126 | add changeset ef1ea85a6374 | |
63 | changesets: 2 chunks |
|
127 | changesets: 2 chunks | |
64 | add changeset f9cafe1212c8 |
|
128 | add changeset f9cafe1212c8 | |
65 | changesets: 3 chunks |
|
129 | changesets: 3 chunks | |
66 | add changeset 911600dab2ae |
|
130 | add changeset 911600dab2ae | |
67 | adding manifests |
|
131 | adding manifests | |
68 | manifests: 1 chunks |
|
132 | manifests: 1 chunks | |
69 | manifests: 2 chunks |
|
133 | manifests: 2 chunks | |
70 | manifests: 3 chunks |
|
134 | manifests: 3 chunks | |
71 | adding file changes |
|
135 | adding file changes | |
72 | adding foo/Bar/file.txt revisions |
|
136 | adding foo/Bar/file.txt revisions | |
73 | files: 1 chunks |
|
137 | files: 1 chunks | |
74 | adding foo/file.txt revisions |
|
138 | adding foo/file.txt revisions | |
75 | files: 2 chunks |
|
139 | files: 2 chunks | |
76 | adding quux/file.py revisions |
|
140 | adding quux/file.py revisions | |
77 | files: 3 chunks |
|
141 | files: 3 chunks | |
78 | added 3 changesets with 3 changes to 3 files |
|
142 | added 3 changesets with 3 changes to 3 files | |
79 | calling hook pretxnchangegroup.acl: hgext.acl.hook |
|
143 | calling hook pretxnchangegroup.acl: hgext.acl.hook | |
80 | acl: changes have source "push" - skipping |
|
144 | acl: changes have source "push" - skipping | |
81 | updating the branch cache |
|
145 | updating the branch cache | |
82 | rolling back last transaction |
|
146 | rolling back last transaction | |
83 | 0:6675d58eff77 |
|
147 | 0:6675d58eff77 | |
84 |
|
148 | |||
85 | No [acl.allow]/[acl.deny] |
|
149 | No [acl.allow]/[acl.deny] | |
86 | Pushing as user fred |
|
150 | Pushing as user fred | |
87 | hgrc = """ |
|
151 | hgrc = """ | |
88 | [hooks] |
|
152 | [hooks] | |
89 | pretxnchangegroup.acl = python:hgext.acl.hook |
|
153 | pretxnchangegroup.acl = python:hgext.acl.hook | |
90 | [acl] |
|
154 | [acl] | |
91 | sources = push |
|
155 | sources = push | |
92 | """ |
|
156 | """ | |
93 | pushing to ../b |
|
157 | pushing to ../b | |
94 | searching for changes |
|
158 | searching for changes | |
95 | common changesets up to 6675d58eff77 |
|
159 | common changesets up to 6675d58eff77 | |
96 | invalidating branch cache (tip differs) |
|
160 | invalidating branch cache (tip differs) | |
97 | 3 changesets found |
|
161 | 3 changesets found | |
98 | list of changesets: |
|
162 | list of changesets: | |
99 | ef1ea85a6374b77d6da9dcda9541f498f2d17df7 |
|
163 | ef1ea85a6374b77d6da9dcda9541f498f2d17df7 | |
100 | f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd |
|
164 | f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd | |
101 | 911600dab2ae7a9baff75958b84fe606851ce955 |
|
165 | 911600dab2ae7a9baff75958b84fe606851ce955 | |
102 | adding changesets |
|
166 | adding changesets | |
|
167 | bundle changes: 0 chunks | |||
|
168 | bundle changes: 1 chunks | |||
|
169 | bundle changes: 2 chunks | |||
|
170 | bundle changes: 3 chunks | |||
|
171 | bundle changes: 4 chunks | |||
|
172 | bundle changes: 5 chunks | |||
|
173 | bundle changes: 6 chunks | |||
|
174 | bundle changes: 7 chunks | |||
|
175 | bundle changes: 8 chunks | |||
|
176 | bundle changes: 9 chunks | |||
|
177 | bundle manifests: 0 chunks | |||
|
178 | bundle manifests: 1 chunks | |||
|
179 | bundle manifests: 2 chunks | |||
|
180 | bundle manifests: 3 chunks | |||
|
181 | bundle manifests: 4 chunks | |||
|
182 | bundle manifests: 5 chunks | |||
|
183 | bundle manifests: 6 chunks | |||
|
184 | bundle manifests: 7 chunks | |||
|
185 | bundle manifests: 8 chunks | |||
|
186 | bundle manifests: 9 chunks | |||
|
187 | bundle files: foo/Bar/file.txt 0 chunks | |||
|
188 | bundle files: foo/Bar/file.txt 1 chunks | |||
|
189 | bundle files: foo/Bar/file.txt 2 chunks | |||
|
190 | bundle files: foo/Bar/file.txt 3 chunks | |||
|
191 | bundle files: foo/file.txt 4 chunks | |||
|
192 | bundle files: foo/file.txt 5 chunks | |||
|
193 | bundle files: foo/file.txt 6 chunks | |||
|
194 | bundle files: foo/file.txt 7 chunks | |||
|
195 | bundle files: quux/file.py 8 chunks | |||
|
196 | bundle files: quux/file.py 9 chunks | |||
|
197 | bundle files: quux/file.py 10 chunks | |||
|
198 | bundle files: quux/file.py 11 chunks | |||
103 | changesets: 1 chunks |
|
199 | changesets: 1 chunks | |
104 | add changeset ef1ea85a6374 |
|
200 | add changeset ef1ea85a6374 | |
105 | changesets: 2 chunks |
|
201 | changesets: 2 chunks | |
106 | add changeset f9cafe1212c8 |
|
202 | add changeset f9cafe1212c8 | |
107 | changesets: 3 chunks |
|
203 | changesets: 3 chunks | |
108 | add changeset 911600dab2ae |
|
204 | add changeset 911600dab2ae | |
109 | adding manifests |
|
205 | adding manifests | |
110 | manifests: 1 chunks |
|
206 | manifests: 1 chunks | |
111 | manifests: 2 chunks |
|
207 | manifests: 2 chunks | |
112 | manifests: 3 chunks |
|
208 | manifests: 3 chunks | |
113 | adding file changes |
|
209 | adding file changes | |
114 | adding foo/Bar/file.txt revisions |
|
210 | adding foo/Bar/file.txt revisions | |
115 | files: 1 chunks |
|
211 | files: 1 chunks | |
116 | adding foo/file.txt revisions |
|
212 | adding foo/file.txt revisions | |
117 | files: 2 chunks |
|
213 | files: 2 chunks | |
118 | adding quux/file.py revisions |
|
214 | adding quux/file.py revisions | |
119 | files: 3 chunks |
|
215 | files: 3 chunks | |
120 | added 3 changesets with 3 changes to 3 files |
|
216 | added 3 changesets with 3 changes to 3 files | |
121 | calling hook pretxnchangegroup.acl: hgext.acl.hook |
|
217 | calling hook pretxnchangegroup.acl: hgext.acl.hook | |
122 | acl: acl.allow not enabled |
|
218 | acl: acl.allow not enabled | |
123 | acl: acl.deny not enabled |
|
219 | acl: acl.deny not enabled | |
124 | acl: allowing changeset ef1ea85a6374 |
|
220 | acl: allowing changeset ef1ea85a6374 | |
125 | acl: allowing changeset f9cafe1212c8 |
|
221 | acl: allowing changeset f9cafe1212c8 | |
126 | acl: allowing changeset 911600dab2ae |
|
222 | acl: allowing changeset 911600dab2ae | |
127 | updating the branch cache |
|
223 | updating the branch cache | |
128 | rolling back last transaction |
|
224 | rolling back last transaction | |
129 | 0:6675d58eff77 |
|
225 | 0:6675d58eff77 | |
130 |
|
226 | |||
131 | Empty [acl.allow] |
|
227 | Empty [acl.allow] | |
132 | Pushing as user fred |
|
228 | Pushing as user fred | |
133 | hgrc = """ |
|
229 | hgrc = """ | |
134 | [hooks] |
|
230 | [hooks] | |
135 | pretxnchangegroup.acl = python:hgext.acl.hook |
|
231 | pretxnchangegroup.acl = python:hgext.acl.hook | |
136 | [acl] |
|
232 | [acl] | |
137 | sources = push |
|
233 | sources = push | |
138 | [acl.allow] |
|
234 | [acl.allow] | |
139 | """ |
|
235 | """ | |
140 | pushing to ../b |
|
236 | pushing to ../b | |
141 | searching for changes |
|
237 | searching for changes | |
142 | common changesets up to 6675d58eff77 |
|
238 | common changesets up to 6675d58eff77 | |
143 | invalidating branch cache (tip differs) |
|
239 | invalidating branch cache (tip differs) | |
144 | 3 changesets found |
|
240 | 3 changesets found | |
145 | list of changesets: |
|
241 | list of changesets: | |
146 | ef1ea85a6374b77d6da9dcda9541f498f2d17df7 |
|
242 | ef1ea85a6374b77d6da9dcda9541f498f2d17df7 | |
147 | f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd |
|
243 | f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd | |
148 | 911600dab2ae7a9baff75958b84fe606851ce955 |
|
244 | 911600dab2ae7a9baff75958b84fe606851ce955 | |
149 | adding changesets |
|
245 | adding changesets | |
|
246 | bundle changes: 0 chunks | |||
|
247 | bundle changes: 1 chunks | |||
|
248 | bundle changes: 2 chunks | |||
|
249 | bundle changes: 3 chunks | |||
|
250 | bundle changes: 4 chunks | |||
|
251 | bundle changes: 5 chunks | |||
|
252 | bundle changes: 6 chunks | |||
|
253 | bundle changes: 7 chunks | |||
|
254 | bundle changes: 8 chunks | |||
|
255 | bundle changes: 9 chunks | |||
|
256 | bundle manifests: 0 chunks | |||
|
257 | bundle manifests: 1 chunks | |||
|
258 | bundle manifests: 2 chunks | |||
|
259 | bundle manifests: 3 chunks | |||
|
260 | bundle manifests: 4 chunks | |||
|
261 | bundle manifests: 5 chunks | |||
|
262 | bundle manifests: 6 chunks | |||
|
263 | bundle manifests: 7 chunks | |||
|
264 | bundle manifests: 8 chunks | |||
|
265 | bundle manifests: 9 chunks | |||
|
266 | bundle files: foo/Bar/file.txt 0 chunks | |||
|
267 | bundle files: foo/Bar/file.txt 1 chunks | |||
|
268 | bundle files: foo/Bar/file.txt 2 chunks | |||
|
269 | bundle files: foo/Bar/file.txt 3 chunks | |||
|
270 | bundle files: foo/file.txt 4 chunks | |||
|
271 | bundle files: foo/file.txt 5 chunks | |||
|
272 | bundle files: foo/file.txt 6 chunks | |||
|
273 | bundle files: foo/file.txt 7 chunks | |||
|
274 | bundle files: quux/file.py 8 chunks | |||
|
275 | bundle files: quux/file.py 9 chunks | |||
|
276 | bundle files: quux/file.py 10 chunks | |||
|
277 | bundle files: quux/file.py 11 chunks | |||
150 | changesets: 1 chunks |
|
278 | changesets: 1 chunks | |
151 | add changeset ef1ea85a6374 |
|
279 | add changeset ef1ea85a6374 | |
152 | changesets: 2 chunks |
|
280 | changesets: 2 chunks | |
153 | add changeset f9cafe1212c8 |
|
281 | add changeset f9cafe1212c8 | |
154 | changesets: 3 chunks |
|
282 | changesets: 3 chunks | |
155 | add changeset 911600dab2ae |
|
283 | add changeset 911600dab2ae | |
156 | adding manifests |
|
284 | adding manifests | |
157 | manifests: 1 chunks |
|
285 | manifests: 1 chunks | |
158 | manifests: 2 chunks |
|
286 | manifests: 2 chunks | |
159 | manifests: 3 chunks |
|
287 | manifests: 3 chunks | |
160 | adding file changes |
|
288 | adding file changes | |
161 | adding foo/Bar/file.txt revisions |
|
289 | adding foo/Bar/file.txt revisions | |
162 | files: 1 chunks |
|
290 | files: 1 chunks | |
163 | adding foo/file.txt revisions |
|
291 | adding foo/file.txt revisions | |
164 | files: 2 chunks |
|
292 | files: 2 chunks | |
165 | adding quux/file.py revisions |
|
293 | adding quux/file.py revisions | |
166 | files: 3 chunks |
|
294 | files: 3 chunks | |
167 | added 3 changesets with 3 changes to 3 files |
|
295 | added 3 changesets with 3 changes to 3 files | |
168 | calling hook pretxnchangegroup.acl: hgext.acl.hook |
|
296 | calling hook pretxnchangegroup.acl: hgext.acl.hook | |
169 | acl: acl.allow enabled, 0 entries for user fred |
|
297 | acl: acl.allow enabled, 0 entries for user fred | |
170 | acl: acl.deny not enabled |
|
298 | acl: acl.deny not enabled | |
171 | acl: user fred not allowed on foo/file.txt |
|
299 | acl: user fred not allowed on foo/file.txt | |
172 | error: pretxnchangegroup.acl hook failed: acl: access denied for changeset ef1ea85a6374 |
|
300 | error: pretxnchangegroup.acl hook failed: acl: access denied for changeset ef1ea85a6374 | |
173 | transaction abort! |
|
301 | transaction abort! | |
174 | rollback completed |
|
302 | rollback completed | |
175 | abort: acl: access denied for changeset ef1ea85a6374 |
|
303 | abort: acl: access denied for changeset ef1ea85a6374 | |
176 | no rollback information available |
|
304 | no rollback information available | |
177 | 0:6675d58eff77 |
|
305 | 0:6675d58eff77 | |
178 |
|
306 | |||
179 | fred is allowed inside foo/ |
|
307 | fred is allowed inside foo/ | |
180 | Pushing as user fred |
|
308 | Pushing as user fred | |
181 | hgrc = """ |
|
309 | hgrc = """ | |
182 | [hooks] |
|
310 | [hooks] | |
183 | pretxnchangegroup.acl = python:hgext.acl.hook |
|
311 | pretxnchangegroup.acl = python:hgext.acl.hook | |
184 | [acl] |
|
312 | [acl] | |
185 | sources = push |
|
313 | sources = push | |
186 | [acl.allow] |
|
314 | [acl.allow] | |
187 | foo/** = fred |
|
315 | foo/** = fred | |
188 | """ |
|
316 | """ | |
189 | pushing to ../b |
|
317 | pushing to ../b | |
190 | searching for changes |
|
318 | searching for changes | |
191 | common changesets up to 6675d58eff77 |
|
319 | common changesets up to 6675d58eff77 | |
192 | 3 changesets found |
|
320 | 3 changesets found | |
193 | list of changesets: |
|
321 | list of changesets: | |
194 | ef1ea85a6374b77d6da9dcda9541f498f2d17df7 |
|
322 | ef1ea85a6374b77d6da9dcda9541f498f2d17df7 | |
195 | f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd |
|
323 | f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd | |
196 | 911600dab2ae7a9baff75958b84fe606851ce955 |
|
324 | 911600dab2ae7a9baff75958b84fe606851ce955 | |
197 | adding changesets |
|
325 | adding changesets | |
|
326 | bundle changes: 0 chunks | |||
|
327 | bundle changes: 1 chunks | |||
|
328 | bundle changes: 2 chunks | |||
|
329 | bundle changes: 3 chunks | |||
|
330 | bundle changes: 4 chunks | |||
|
331 | bundle changes: 5 chunks | |||
|
332 | bundle changes: 6 chunks | |||
|
333 | bundle changes: 7 chunks | |||
|
334 | bundle changes: 8 chunks | |||
|
335 | bundle changes: 9 chunks | |||
|
336 | bundle manifests: 0 chunks | |||
|
337 | bundle manifests: 1 chunks | |||
|
338 | bundle manifests: 2 chunks | |||
|
339 | bundle manifests: 3 chunks | |||
|
340 | bundle manifests: 4 chunks | |||
|
341 | bundle manifests: 5 chunks | |||
|
342 | bundle manifests: 6 chunks | |||
|
343 | bundle manifests: 7 chunks | |||
|
344 | bundle manifests: 8 chunks | |||
|
345 | bundle manifests: 9 chunks | |||
|
346 | bundle files: foo/Bar/file.txt 0 chunks | |||
|
347 | bundle files: foo/Bar/file.txt 1 chunks | |||
|
348 | bundle files: foo/Bar/file.txt 2 chunks | |||
|
349 | bundle files: foo/Bar/file.txt 3 chunks | |||
|
350 | bundle files: foo/file.txt 4 chunks | |||
|
351 | bundle files: foo/file.txt 5 chunks | |||
|
352 | bundle files: foo/file.txt 6 chunks | |||
|
353 | bundle files: foo/file.txt 7 chunks | |||
|
354 | bundle files: quux/file.py 8 chunks | |||
|
355 | bundle files: quux/file.py 9 chunks | |||
|
356 | bundle files: quux/file.py 10 chunks | |||
|
357 | bundle files: quux/file.py 11 chunks | |||
198 | changesets: 1 chunks |
|
358 | changesets: 1 chunks | |
199 | add changeset ef1ea85a6374 |
|
359 | add changeset ef1ea85a6374 | |
200 | changesets: 2 chunks |
|
360 | changesets: 2 chunks | |
201 | add changeset f9cafe1212c8 |
|
361 | add changeset f9cafe1212c8 | |
202 | changesets: 3 chunks |
|
362 | changesets: 3 chunks | |
203 | add changeset 911600dab2ae |
|
363 | add changeset 911600dab2ae | |
204 | adding manifests |
|
364 | adding manifests | |
205 | manifests: 1 chunks |
|
365 | manifests: 1 chunks | |
206 | manifests: 2 chunks |
|
366 | manifests: 2 chunks | |
207 | manifests: 3 chunks |
|
367 | manifests: 3 chunks | |
208 | adding file changes |
|
368 | adding file changes | |
209 | adding foo/Bar/file.txt revisions |
|
369 | adding foo/Bar/file.txt revisions | |
210 | files: 1 chunks |
|
370 | files: 1 chunks | |
211 | adding foo/file.txt revisions |
|
371 | adding foo/file.txt revisions | |
212 | files: 2 chunks |
|
372 | files: 2 chunks | |
213 | adding quux/file.py revisions |
|
373 | adding quux/file.py revisions | |
214 | files: 3 chunks |
|
374 | files: 3 chunks | |
215 | added 3 changesets with 3 changes to 3 files |
|
375 | added 3 changesets with 3 changes to 3 files | |
216 | calling hook pretxnchangegroup.acl: hgext.acl.hook |
|
376 | calling hook pretxnchangegroup.acl: hgext.acl.hook | |
217 | acl: acl.allow enabled, 1 entries for user fred |
|
377 | acl: acl.allow enabled, 1 entries for user fred | |
218 | acl: acl.deny not enabled |
|
378 | acl: acl.deny not enabled | |
219 | acl: allowing changeset ef1ea85a6374 |
|
379 | acl: allowing changeset ef1ea85a6374 | |
220 | acl: allowing changeset f9cafe1212c8 |
|
380 | acl: allowing changeset f9cafe1212c8 | |
221 | acl: user fred not allowed on quux/file.py |
|
381 | acl: user fred not allowed on quux/file.py | |
222 | error: pretxnchangegroup.acl hook failed: acl: access denied for changeset 911600dab2ae |
|
382 | error: pretxnchangegroup.acl hook failed: acl: access denied for changeset 911600dab2ae | |
223 | transaction abort! |
|
383 | transaction abort! | |
224 | rollback completed |
|
384 | rollback completed | |
225 | abort: acl: access denied for changeset 911600dab2ae |
|
385 | abort: acl: access denied for changeset 911600dab2ae | |
226 | no rollback information available |
|
386 | no rollback information available | |
227 | 0:6675d58eff77 |
|
387 | 0:6675d58eff77 | |
228 |
|
388 | |||
229 | Empty [acl.deny] |
|
389 | Empty [acl.deny] | |
230 | Pushing as user barney |
|
390 | Pushing as user barney | |
231 | hgrc = """ |
|
391 | hgrc = """ | |
232 | [hooks] |
|
392 | [hooks] | |
233 | pretxnchangegroup.acl = python:hgext.acl.hook |
|
393 | pretxnchangegroup.acl = python:hgext.acl.hook | |
234 | [acl] |
|
394 | [acl] | |
235 | sources = push |
|
395 | sources = push | |
236 | [acl.allow] |
|
396 | [acl.allow] | |
237 | foo/** = fred |
|
397 | foo/** = fred | |
238 | [acl.deny] |
|
398 | [acl.deny] | |
239 | """ |
|
399 | """ | |
240 | pushing to ../b |
|
400 | pushing to ../b | |
241 | searching for changes |
|
401 | searching for changes | |
242 | common changesets up to 6675d58eff77 |
|
402 | common changesets up to 6675d58eff77 | |
243 | 3 changesets found |
|
403 | 3 changesets found | |
244 | list of changesets: |
|
404 | list of changesets: | |
245 | ef1ea85a6374b77d6da9dcda9541f498f2d17df7 |
|
405 | ef1ea85a6374b77d6da9dcda9541f498f2d17df7 | |
246 | f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd |
|
406 | f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd | |
247 | 911600dab2ae7a9baff75958b84fe606851ce955 |
|
407 | 911600dab2ae7a9baff75958b84fe606851ce955 | |
248 | adding changesets |
|
408 | adding changesets | |
|
409 | bundle changes: 0 chunks | |||
|
410 | bundle changes: 1 chunks | |||
|
411 | bundle changes: 2 chunks | |||
|
412 | bundle changes: 3 chunks | |||
|
413 | bundle changes: 4 chunks | |||
|
414 | bundle changes: 5 chunks | |||
|
415 | bundle changes: 6 chunks | |||
|
416 | bundle changes: 7 chunks | |||
|
417 | bundle changes: 8 chunks | |||
|
418 | bundle changes: 9 chunks | |||
|
419 | bundle manifests: 0 chunks | |||
|
420 | bundle manifests: 1 chunks | |||
|
421 | bundle manifests: 2 chunks | |||
|
422 | bundle manifests: 3 chunks | |||
|
423 | bundle manifests: 4 chunks | |||
|
424 | bundle manifests: 5 chunks | |||
|
425 | bundle manifests: 6 chunks | |||
|
426 | bundle manifests: 7 chunks | |||
|
427 | bundle manifests: 8 chunks | |||
|
428 | bundle manifests: 9 chunks | |||
|
429 | bundle files: foo/Bar/file.txt 0 chunks | |||
|
430 | bundle files: foo/Bar/file.txt 1 chunks | |||
|
431 | bundle files: foo/Bar/file.txt 2 chunks | |||
|
432 | bundle files: foo/Bar/file.txt 3 chunks | |||
|
433 | bundle files: foo/file.txt 4 chunks | |||
|
434 | bundle files: foo/file.txt 5 chunks | |||
|
435 | bundle files: foo/file.txt 6 chunks | |||
|
436 | bundle files: foo/file.txt 7 chunks | |||
|
437 | bundle files: quux/file.py 8 chunks | |||
|
438 | bundle files: quux/file.py 9 chunks | |||
|
439 | bundle files: quux/file.py 10 chunks | |||
|
440 | bundle files: quux/file.py 11 chunks | |||
249 | changesets: 1 chunks |
|
441 | changesets: 1 chunks | |
250 | add changeset ef1ea85a6374 |
|
442 | add changeset ef1ea85a6374 | |
251 | changesets: 2 chunks |
|
443 | changesets: 2 chunks | |
252 | add changeset f9cafe1212c8 |
|
444 | add changeset f9cafe1212c8 | |
253 | changesets: 3 chunks |
|
445 | changesets: 3 chunks | |
254 | add changeset 911600dab2ae |
|
446 | add changeset 911600dab2ae | |
255 | adding manifests |
|
447 | adding manifests | |
256 | manifests: 1 chunks |
|
448 | manifests: 1 chunks | |
257 | manifests: 2 chunks |
|
449 | manifests: 2 chunks | |
258 | manifests: 3 chunks |
|
450 | manifests: 3 chunks | |
259 | adding file changes |
|
451 | adding file changes | |
260 | adding foo/Bar/file.txt revisions |
|
452 | adding foo/Bar/file.txt revisions | |
261 | files: 1 chunks |
|
453 | files: 1 chunks | |
262 | adding foo/file.txt revisions |
|
454 | adding foo/file.txt revisions | |
263 | files: 2 chunks |
|
455 | files: 2 chunks | |
264 | adding quux/file.py revisions |
|
456 | adding quux/file.py revisions | |
265 | files: 3 chunks |
|
457 | files: 3 chunks | |
266 | added 3 changesets with 3 changes to 3 files |
|
458 | added 3 changesets with 3 changes to 3 files | |
267 | calling hook pretxnchangegroup.acl: hgext.acl.hook |
|
459 | calling hook pretxnchangegroup.acl: hgext.acl.hook | |
268 | acl: acl.allow enabled, 0 entries for user barney |
|
460 | acl: acl.allow enabled, 0 entries for user barney | |
269 | acl: acl.deny enabled, 0 entries for user barney |
|
461 | acl: acl.deny enabled, 0 entries for user barney | |
270 | acl: user barney not allowed on foo/file.txt |
|
462 | acl: user barney not allowed on foo/file.txt | |
271 | error: pretxnchangegroup.acl hook failed: acl: access denied for changeset ef1ea85a6374 |
|
463 | error: pretxnchangegroup.acl hook failed: acl: access denied for changeset ef1ea85a6374 | |
272 | transaction abort! |
|
464 | transaction abort! | |
273 | rollback completed |
|
465 | rollback completed | |
274 | abort: acl: access denied for changeset ef1ea85a6374 |
|
466 | abort: acl: access denied for changeset ef1ea85a6374 | |
275 | no rollback information available |
|
467 | no rollback information available | |
276 | 0:6675d58eff77 |
|
468 | 0:6675d58eff77 | |
277 |
|
469 | |||
278 | fred is allowed inside foo/, but not foo/bar/ (case matters) |
|
470 | fred is allowed inside foo/, but not foo/bar/ (case matters) | |
279 | Pushing as user fred |
|
471 | Pushing as user fred | |
280 | hgrc = """ |
|
472 | hgrc = """ | |
281 | [hooks] |
|
473 | [hooks] | |
282 | pretxnchangegroup.acl = python:hgext.acl.hook |
|
474 | pretxnchangegroup.acl = python:hgext.acl.hook | |
283 | [acl] |
|
475 | [acl] | |
284 | sources = push |
|
476 | sources = push | |
285 | [acl.allow] |
|
477 | [acl.allow] | |
286 | foo/** = fred |
|
478 | foo/** = fred | |
287 | [acl.deny] |
|
479 | [acl.deny] | |
288 | foo/bar/** = fred |
|
480 | foo/bar/** = fred | |
289 | """ |
|
481 | """ | |
290 | pushing to ../b |
|
482 | pushing to ../b | |
291 | searching for changes |
|
483 | searching for changes | |
292 | common changesets up to 6675d58eff77 |
|
484 | common changesets up to 6675d58eff77 | |
293 | 3 changesets found |
|
485 | 3 changesets found | |
294 | list of changesets: |
|
486 | list of changesets: | |
295 | ef1ea85a6374b77d6da9dcda9541f498f2d17df7 |
|
487 | ef1ea85a6374b77d6da9dcda9541f498f2d17df7 | |
296 | f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd |
|
488 | f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd | |
297 | 911600dab2ae7a9baff75958b84fe606851ce955 |
|
489 | 911600dab2ae7a9baff75958b84fe606851ce955 | |
298 | adding changesets |
|
490 | adding changesets | |
|
491 | bundle changes: 0 chunks | |||
|
492 | bundle changes: 1 chunks | |||
|
493 | bundle changes: 2 chunks | |||
|
494 | bundle changes: 3 chunks | |||
|
495 | bundle changes: 4 chunks | |||
|
496 | bundle changes: 5 chunks | |||
|
497 | bundle changes: 6 chunks | |||
|
498 | bundle changes: 7 chunks | |||
|
499 | bundle changes: 8 chunks | |||
|
500 | bundle changes: 9 chunks | |||
|
501 | bundle manifests: 0 chunks | |||
|
502 | bundle manifests: 1 chunks | |||
|
503 | bundle manifests: 2 chunks | |||
|
504 | bundle manifests: 3 chunks | |||
|
505 | bundle manifests: 4 chunks | |||
|
506 | bundle manifests: 5 chunks | |||
|
507 | bundle manifests: 6 chunks | |||
|
508 | bundle manifests: 7 chunks | |||
|
509 | bundle manifests: 8 chunks | |||
|
510 | bundle manifests: 9 chunks | |||
|
511 | bundle files: foo/Bar/file.txt 0 chunks | |||
|
512 | bundle files: foo/Bar/file.txt 1 chunks | |||
|
513 | bundle files: foo/Bar/file.txt 2 chunks | |||
|
514 | bundle files: foo/Bar/file.txt 3 chunks | |||
|
515 | bundle files: foo/file.txt 4 chunks | |||
|
516 | bundle files: foo/file.txt 5 chunks | |||
|
517 | bundle files: foo/file.txt 6 chunks | |||
|
518 | bundle files: foo/file.txt 7 chunks | |||
|
519 | bundle files: quux/file.py 8 chunks | |||
|
520 | bundle files: quux/file.py 9 chunks | |||
|
521 | bundle files: quux/file.py 10 chunks | |||
|
522 | bundle files: quux/file.py 11 chunks | |||
299 | changesets: 1 chunks |
|
523 | changesets: 1 chunks | |
300 | add changeset ef1ea85a6374 |
|
524 | add changeset ef1ea85a6374 | |
301 | changesets: 2 chunks |
|
525 | changesets: 2 chunks | |
302 | add changeset f9cafe1212c8 |
|
526 | add changeset f9cafe1212c8 | |
303 | changesets: 3 chunks |
|
527 | changesets: 3 chunks | |
304 | add changeset 911600dab2ae |
|
528 | add changeset 911600dab2ae | |
305 | adding manifests |
|
529 | adding manifests | |
306 | manifests: 1 chunks |
|
530 | manifests: 1 chunks | |
307 | manifests: 2 chunks |
|
531 | manifests: 2 chunks | |
308 | manifests: 3 chunks |
|
532 | manifests: 3 chunks | |
309 | adding file changes |
|
533 | adding file changes | |
310 | adding foo/Bar/file.txt revisions |
|
534 | adding foo/Bar/file.txt revisions | |
311 | files: 1 chunks |
|
535 | files: 1 chunks | |
312 | adding foo/file.txt revisions |
|
536 | adding foo/file.txt revisions | |
313 | files: 2 chunks |
|
537 | files: 2 chunks | |
314 | adding quux/file.py revisions |
|
538 | adding quux/file.py revisions | |
315 | files: 3 chunks |
|
539 | files: 3 chunks | |
316 | added 3 changesets with 3 changes to 3 files |
|
540 | added 3 changesets with 3 changes to 3 files | |
317 | calling hook pretxnchangegroup.acl: hgext.acl.hook |
|
541 | calling hook pretxnchangegroup.acl: hgext.acl.hook | |
318 | acl: acl.allow enabled, 1 entries for user fred |
|
542 | acl: acl.allow enabled, 1 entries for user fred | |
319 | acl: acl.deny enabled, 1 entries for user fred |
|
543 | acl: acl.deny enabled, 1 entries for user fred | |
320 | acl: allowing changeset ef1ea85a6374 |
|
544 | acl: allowing changeset ef1ea85a6374 | |
321 | acl: allowing changeset f9cafe1212c8 |
|
545 | acl: allowing changeset f9cafe1212c8 | |
322 | acl: user fred not allowed on quux/file.py |
|
546 | acl: user fred not allowed on quux/file.py | |
323 | error: pretxnchangegroup.acl hook failed: acl: access denied for changeset 911600dab2ae |
|
547 | error: pretxnchangegroup.acl hook failed: acl: access denied for changeset 911600dab2ae | |
324 | transaction abort! |
|
548 | transaction abort! | |
325 | rollback completed |
|
549 | rollback completed | |
326 | abort: acl: access denied for changeset 911600dab2ae |
|
550 | abort: acl: access denied for changeset 911600dab2ae | |
327 | no rollback information available |
|
551 | no rollback information available | |
328 | 0:6675d58eff77 |
|
552 | 0:6675d58eff77 | |
329 |
|
553 | |||
330 | fred is allowed inside foo/, but not foo/Bar/ |
|
554 | fred is allowed inside foo/, but not foo/Bar/ | |
331 | Pushing as user fred |
|
555 | Pushing as user fred | |
332 | hgrc = """ |
|
556 | hgrc = """ | |
333 | [hooks] |
|
557 | [hooks] | |
334 | pretxnchangegroup.acl = python:hgext.acl.hook |
|
558 | pretxnchangegroup.acl = python:hgext.acl.hook | |
335 | [acl] |
|
559 | [acl] | |
336 | sources = push |
|
560 | sources = push | |
337 | [acl.allow] |
|
561 | [acl.allow] | |
338 | foo/** = fred |
|
562 | foo/** = fred | |
339 | [acl.deny] |
|
563 | [acl.deny] | |
340 | foo/bar/** = fred |
|
564 | foo/bar/** = fred | |
341 | foo/Bar/** = fred |
|
565 | foo/Bar/** = fred | |
342 | """ |
|
566 | """ | |
343 | pushing to ../b |
|
567 | pushing to ../b | |
344 | searching for changes |
|
568 | searching for changes | |
345 | common changesets up to 6675d58eff77 |
|
569 | common changesets up to 6675d58eff77 | |
346 | 3 changesets found |
|
570 | 3 changesets found | |
347 | list of changesets: |
|
571 | list of changesets: | |
348 | ef1ea85a6374b77d6da9dcda9541f498f2d17df7 |
|
572 | ef1ea85a6374b77d6da9dcda9541f498f2d17df7 | |
349 | f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd |
|
573 | f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd | |
350 | 911600dab2ae7a9baff75958b84fe606851ce955 |
|
574 | 911600dab2ae7a9baff75958b84fe606851ce955 | |
351 | adding changesets |
|
575 | adding changesets | |
|
576 | bundle changes: 0 chunks | |||
|
577 | bundle changes: 1 chunks | |||
|
578 | bundle changes: 2 chunks | |||
|
579 | bundle changes: 3 chunks | |||
|
580 | bundle changes: 4 chunks | |||
|
581 | bundle changes: 5 chunks | |||
|
582 | bundle changes: 6 chunks | |||
|
583 | bundle changes: 7 chunks | |||
|
584 | bundle changes: 8 chunks | |||
|
585 | bundle changes: 9 chunks | |||
|
586 | bundle manifests: 0 chunks | |||
|
587 | bundle manifests: 1 chunks | |||
|
588 | bundle manifests: 2 chunks | |||
|
589 | bundle manifests: 3 chunks | |||
|
590 | bundle manifests: 4 chunks | |||
|
591 | bundle manifests: 5 chunks | |||
|
592 | bundle manifests: 6 chunks | |||
|
593 | bundle manifests: 7 chunks | |||
|
594 | bundle manifests: 8 chunks | |||
|
595 | bundle manifests: 9 chunks | |||
|
596 | bundle files: foo/Bar/file.txt 0 chunks | |||
|
597 | bundle files: foo/Bar/file.txt 1 chunks | |||
|
598 | bundle files: foo/Bar/file.txt 2 chunks | |||
|
599 | bundle files: foo/Bar/file.txt 3 chunks | |||
|
600 | bundle files: foo/file.txt 4 chunks | |||
|
601 | bundle files: foo/file.txt 5 chunks | |||
|
602 | bundle files: foo/file.txt 6 chunks | |||
|
603 | bundle files: foo/file.txt 7 chunks | |||
|
604 | bundle files: quux/file.py 8 chunks | |||
|
605 | bundle files: quux/file.py 9 chunks | |||
|
606 | bundle files: quux/file.py 10 chunks | |||
|
607 | bundle files: quux/file.py 11 chunks | |||
352 | changesets: 1 chunks |
|
608 | changesets: 1 chunks | |
353 | add changeset ef1ea85a6374 |
|
609 | add changeset ef1ea85a6374 | |
354 | changesets: 2 chunks |
|
610 | changesets: 2 chunks | |
355 | add changeset f9cafe1212c8 |
|
611 | add changeset f9cafe1212c8 | |
356 | changesets: 3 chunks |
|
612 | changesets: 3 chunks | |
357 | add changeset 911600dab2ae |
|
613 | add changeset 911600dab2ae | |
358 | adding manifests |
|
614 | adding manifests | |
359 | manifests: 1 chunks |
|
615 | manifests: 1 chunks | |
360 | manifests: 2 chunks |
|
616 | manifests: 2 chunks | |
361 | manifests: 3 chunks |
|
617 | manifests: 3 chunks | |
362 | adding file changes |
|
618 | adding file changes | |
363 | adding foo/Bar/file.txt revisions |
|
619 | adding foo/Bar/file.txt revisions | |
364 | files: 1 chunks |
|
620 | files: 1 chunks | |
365 | adding foo/file.txt revisions |
|
621 | adding foo/file.txt revisions | |
366 | files: 2 chunks |
|
622 | files: 2 chunks | |
367 | adding quux/file.py revisions |
|
623 | adding quux/file.py revisions | |
368 | files: 3 chunks |
|
624 | files: 3 chunks | |
369 | added 3 changesets with 3 changes to 3 files |
|
625 | added 3 changesets with 3 changes to 3 files | |
370 | calling hook pretxnchangegroup.acl: hgext.acl.hook |
|
626 | calling hook pretxnchangegroup.acl: hgext.acl.hook | |
371 | acl: acl.allow enabled, 1 entries for user fred |
|
627 | acl: acl.allow enabled, 1 entries for user fred | |
372 | acl: acl.deny enabled, 2 entries for user fred |
|
628 | acl: acl.deny enabled, 2 entries for user fred | |
373 | acl: allowing changeset ef1ea85a6374 |
|
629 | acl: allowing changeset ef1ea85a6374 | |
374 | acl: user fred denied on foo/Bar/file.txt |
|
630 | acl: user fred denied on foo/Bar/file.txt | |
375 | error: pretxnchangegroup.acl hook failed: acl: access denied for changeset f9cafe1212c8 |
|
631 | error: pretxnchangegroup.acl hook failed: acl: access denied for changeset f9cafe1212c8 | |
376 | transaction abort! |
|
632 | transaction abort! | |
377 | rollback completed |
|
633 | rollback completed | |
378 | abort: acl: access denied for changeset f9cafe1212c8 |
|
634 | abort: acl: access denied for changeset f9cafe1212c8 | |
379 | no rollback information available |
|
635 | no rollback information available | |
380 | 0:6675d58eff77 |
|
636 | 0:6675d58eff77 | |
381 |
|
637 | |||
382 | barney is not mentioned => not allowed anywhere |
|
638 | barney is not mentioned => not allowed anywhere | |
383 | Pushing as user barney |
|
639 | Pushing as user barney | |
384 | hgrc = """ |
|
640 | hgrc = """ | |
385 | [hooks] |
|
641 | [hooks] | |
386 | pretxnchangegroup.acl = python:hgext.acl.hook |
|
642 | pretxnchangegroup.acl = python:hgext.acl.hook | |
387 | [acl] |
|
643 | [acl] | |
388 | sources = push |
|
644 | sources = push | |
389 | [acl.allow] |
|
645 | [acl.allow] | |
390 | foo/** = fred |
|
646 | foo/** = fred | |
391 | [acl.deny] |
|
647 | [acl.deny] | |
392 | foo/bar/** = fred |
|
648 | foo/bar/** = fred | |
393 | foo/Bar/** = fred |
|
649 | foo/Bar/** = fred | |
394 | """ |
|
650 | """ | |
395 | pushing to ../b |
|
651 | pushing to ../b | |
396 | searching for changes |
|
652 | searching for changes | |
397 | common changesets up to 6675d58eff77 |
|
653 | common changesets up to 6675d58eff77 | |
398 | 3 changesets found |
|
654 | 3 changesets found | |
399 | list of changesets: |
|
655 | list of changesets: | |
400 | ef1ea85a6374b77d6da9dcda9541f498f2d17df7 |
|
656 | ef1ea85a6374b77d6da9dcda9541f498f2d17df7 | |
401 | f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd |
|
657 | f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd | |
402 | 911600dab2ae7a9baff75958b84fe606851ce955 |
|
658 | 911600dab2ae7a9baff75958b84fe606851ce955 | |
403 | adding changesets |
|
659 | adding changesets | |
|
660 | bundle changes: 0 chunks | |||
|
661 | bundle changes: 1 chunks | |||
|
662 | bundle changes: 2 chunks | |||
|
663 | bundle changes: 3 chunks | |||
|
664 | bundle changes: 4 chunks | |||
|
665 | bundle changes: 5 chunks | |||
|
666 | bundle changes: 6 chunks | |||
|
667 | bundle changes: 7 chunks | |||
|
668 | bundle changes: 8 chunks | |||
|
669 | bundle changes: 9 chunks | |||
|
670 | bundle manifests: 0 chunks | |||
|
671 | bundle manifests: 1 chunks | |||
|
672 | bundle manifests: 2 chunks | |||
|
673 | bundle manifests: 3 chunks | |||
|
674 | bundle manifests: 4 chunks | |||
|
675 | bundle manifests: 5 chunks | |||
|
676 | bundle manifests: 6 chunks | |||
|
677 | bundle manifests: 7 chunks | |||
|
678 | bundle manifests: 8 chunks | |||
|
679 | bundle manifests: 9 chunks | |||
|
680 | bundle files: foo/Bar/file.txt 0 chunks | |||
|
681 | bundle files: foo/Bar/file.txt 1 chunks | |||
|
682 | bundle files: foo/Bar/file.txt 2 chunks | |||
|
683 | bundle files: foo/Bar/file.txt 3 chunks | |||
|
684 | bundle files: foo/file.txt 4 chunks | |||
|
685 | bundle files: foo/file.txt 5 chunks | |||
|
686 | bundle files: foo/file.txt 6 chunks | |||
|
687 | bundle files: foo/file.txt 7 chunks | |||
|
688 | bundle files: quux/file.py 8 chunks | |||
|
689 | bundle files: quux/file.py 9 chunks | |||
|
690 | bundle files: quux/file.py 10 chunks | |||
|
691 | bundle files: quux/file.py 11 chunks | |||
404 | changesets: 1 chunks |
|
692 | changesets: 1 chunks | |
405 | add changeset ef1ea85a6374 |
|
693 | add changeset ef1ea85a6374 | |
406 | changesets: 2 chunks |
|
694 | changesets: 2 chunks | |
407 | add changeset f9cafe1212c8 |
|
695 | add changeset f9cafe1212c8 | |
408 | changesets: 3 chunks |
|
696 | changesets: 3 chunks | |
409 | add changeset 911600dab2ae |
|
697 | add changeset 911600dab2ae | |
410 | adding manifests |
|
698 | adding manifests | |
411 | manifests: 1 chunks |
|
699 | manifests: 1 chunks | |
412 | manifests: 2 chunks |
|
700 | manifests: 2 chunks | |
413 | manifests: 3 chunks |
|
701 | manifests: 3 chunks | |
414 | adding file changes |
|
702 | adding file changes | |
415 | adding foo/Bar/file.txt revisions |
|
703 | adding foo/Bar/file.txt revisions | |
416 | files: 1 chunks |
|
704 | files: 1 chunks | |
417 | adding foo/file.txt revisions |
|
705 | adding foo/file.txt revisions | |
418 | files: 2 chunks |
|
706 | files: 2 chunks | |
419 | adding quux/file.py revisions |
|
707 | adding quux/file.py revisions | |
420 | files: 3 chunks |
|
708 | files: 3 chunks | |
421 | added 3 changesets with 3 changes to 3 files |
|
709 | added 3 changesets with 3 changes to 3 files | |
422 | calling hook pretxnchangegroup.acl: hgext.acl.hook |
|
710 | calling hook pretxnchangegroup.acl: hgext.acl.hook | |
423 | acl: acl.allow enabled, 0 entries for user barney |
|
711 | acl: acl.allow enabled, 0 entries for user barney | |
424 | acl: acl.deny enabled, 0 entries for user barney |
|
712 | acl: acl.deny enabled, 0 entries for user barney | |
425 | acl: user barney not allowed on foo/file.txt |
|
713 | acl: user barney not allowed on foo/file.txt | |
426 | error: pretxnchangegroup.acl hook failed: acl: access denied for changeset ef1ea85a6374 |
|
714 | error: pretxnchangegroup.acl hook failed: acl: access denied for changeset ef1ea85a6374 | |
427 | transaction abort! |
|
715 | transaction abort! | |
428 | rollback completed |
|
716 | rollback completed | |
429 | abort: acl: access denied for changeset ef1ea85a6374 |
|
717 | abort: acl: access denied for changeset ef1ea85a6374 | |
430 | no rollback information available |
|
718 | no rollback information available | |
431 | 0:6675d58eff77 |
|
719 | 0:6675d58eff77 | |
432 |
|
720 | |||
433 | barney is allowed everywhere |
|
721 | barney is allowed everywhere | |
434 | Pushing as user barney |
|
722 | Pushing as user barney | |
435 | hgrc = """ |
|
723 | hgrc = """ | |
436 | [hooks] |
|
724 | [hooks] | |
437 | pretxnchangegroup.acl = python:hgext.acl.hook |
|
725 | pretxnchangegroup.acl = python:hgext.acl.hook | |
438 | [acl] |
|
726 | [acl] | |
439 | sources = push |
|
727 | sources = push | |
440 | [acl.allow] |
|
728 | [acl.allow] | |
441 | foo/** = fred |
|
729 | foo/** = fred | |
442 | [acl.deny] |
|
730 | [acl.deny] | |
443 | foo/bar/** = fred |
|
731 | foo/bar/** = fred | |
444 | foo/Bar/** = fred |
|
732 | foo/Bar/** = fred | |
445 | [acl.allow] |
|
733 | [acl.allow] | |
446 | ** = barney |
|
734 | ** = barney | |
447 | """ |
|
735 | """ | |
448 | pushing to ../b |
|
736 | pushing to ../b | |
449 | searching for changes |
|
737 | searching for changes | |
450 | common changesets up to 6675d58eff77 |
|
738 | common changesets up to 6675d58eff77 | |
451 | 3 changesets found |
|
739 | 3 changesets found | |
452 | list of changesets: |
|
740 | list of changesets: | |
453 | ef1ea85a6374b77d6da9dcda9541f498f2d17df7 |
|
741 | ef1ea85a6374b77d6da9dcda9541f498f2d17df7 | |
454 | f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd |
|
742 | f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd | |
455 | 911600dab2ae7a9baff75958b84fe606851ce955 |
|
743 | 911600dab2ae7a9baff75958b84fe606851ce955 | |
456 | adding changesets |
|
744 | adding changesets | |
|
745 | bundle changes: 0 chunks | |||
|
746 | bundle changes: 1 chunks | |||
|
747 | bundle changes: 2 chunks | |||
|
748 | bundle changes: 3 chunks | |||
|
749 | bundle changes: 4 chunks | |||
|
750 | bundle changes: 5 chunks | |||
|
751 | bundle changes: 6 chunks | |||
|
752 | bundle changes: 7 chunks | |||
|
753 | bundle changes: 8 chunks | |||
|
754 | bundle changes: 9 chunks | |||
|
755 | bundle manifests: 0 chunks | |||
|
756 | bundle manifests: 1 chunks | |||
|
757 | bundle manifests: 2 chunks | |||
|
758 | bundle manifests: 3 chunks | |||
|
759 | bundle manifests: 4 chunks | |||
|
760 | bundle manifests: 5 chunks | |||
|
761 | bundle manifests: 6 chunks | |||
|
762 | bundle manifests: 7 chunks | |||
|
763 | bundle manifests: 8 chunks | |||
|
764 | bundle manifests: 9 chunks | |||
|
765 | bundle files: foo/Bar/file.txt 0 chunks | |||
|
766 | bundle files: foo/Bar/file.txt 1 chunks | |||
|
767 | bundle files: foo/Bar/file.txt 2 chunks | |||
|
768 | bundle files: foo/Bar/file.txt 3 chunks | |||
|
769 | bundle files: foo/file.txt 4 chunks | |||
|
770 | bundle files: foo/file.txt 5 chunks | |||
|
771 | bundle files: foo/file.txt 6 chunks | |||
|
772 | bundle files: foo/file.txt 7 chunks | |||
|
773 | bundle files: quux/file.py 8 chunks | |||
|
774 | bundle files: quux/file.py 9 chunks | |||
|
775 | bundle files: quux/file.py 10 chunks | |||
|
776 | bundle files: quux/file.py 11 chunks | |||
457 | changesets: 1 chunks |
|
777 | changesets: 1 chunks | |
458 | add changeset ef1ea85a6374 |
|
778 | add changeset ef1ea85a6374 | |
459 | changesets: 2 chunks |
|
779 | changesets: 2 chunks | |
460 | add changeset f9cafe1212c8 |
|
780 | add changeset f9cafe1212c8 | |
461 | changesets: 3 chunks |
|
781 | changesets: 3 chunks | |
462 | add changeset 911600dab2ae |
|
782 | add changeset 911600dab2ae | |
463 | adding manifests |
|
783 | adding manifests | |
464 | manifests: 1 chunks |
|
784 | manifests: 1 chunks | |
465 | manifests: 2 chunks |
|
785 | manifests: 2 chunks | |
466 | manifests: 3 chunks |
|
786 | manifests: 3 chunks | |
467 | adding file changes |
|
787 | adding file changes | |
468 | adding foo/Bar/file.txt revisions |
|
788 | adding foo/Bar/file.txt revisions | |
469 | files: 1 chunks |
|
789 | files: 1 chunks | |
470 | adding foo/file.txt revisions |
|
790 | adding foo/file.txt revisions | |
471 | files: 2 chunks |
|
791 | files: 2 chunks | |
472 | adding quux/file.py revisions |
|
792 | adding quux/file.py revisions | |
473 | files: 3 chunks |
|
793 | files: 3 chunks | |
474 | added 3 changesets with 3 changes to 3 files |
|
794 | added 3 changesets with 3 changes to 3 files | |
475 | calling hook pretxnchangegroup.acl: hgext.acl.hook |
|
795 | calling hook pretxnchangegroup.acl: hgext.acl.hook | |
476 | acl: acl.allow enabled, 1 entries for user barney |
|
796 | acl: acl.allow enabled, 1 entries for user barney | |
477 | acl: acl.deny enabled, 0 entries for user barney |
|
797 | acl: acl.deny enabled, 0 entries for user barney | |
478 | acl: allowing changeset ef1ea85a6374 |
|
798 | acl: allowing changeset ef1ea85a6374 | |
479 | acl: allowing changeset f9cafe1212c8 |
|
799 | acl: allowing changeset f9cafe1212c8 | |
480 | acl: allowing changeset 911600dab2ae |
|
800 | acl: allowing changeset 911600dab2ae | |
481 | updating the branch cache |
|
801 | updating the branch cache | |
482 | rolling back last transaction |
|
802 | rolling back last transaction | |
483 | 0:6675d58eff77 |
|
803 | 0:6675d58eff77 | |
484 |
|
804 | |||
485 | wilma can change files with a .txt extension |
|
805 | wilma can change files with a .txt extension | |
486 | Pushing as user wilma |
|
806 | Pushing as user wilma | |
487 | hgrc = """ |
|
807 | hgrc = """ | |
488 | [hooks] |
|
808 | [hooks] | |
489 | pretxnchangegroup.acl = python:hgext.acl.hook |
|
809 | pretxnchangegroup.acl = python:hgext.acl.hook | |
490 | [acl] |
|
810 | [acl] | |
491 | sources = push |
|
811 | sources = push | |
492 | [acl.allow] |
|
812 | [acl.allow] | |
493 | foo/** = fred |
|
813 | foo/** = fred | |
494 | [acl.deny] |
|
814 | [acl.deny] | |
495 | foo/bar/** = fred |
|
815 | foo/bar/** = fred | |
496 | foo/Bar/** = fred |
|
816 | foo/Bar/** = fred | |
497 | [acl.allow] |
|
817 | [acl.allow] | |
498 | ** = barney |
|
818 | ** = barney | |
499 | **/*.txt = wilma |
|
819 | **/*.txt = wilma | |
500 | """ |
|
820 | """ | |
501 | pushing to ../b |
|
821 | pushing to ../b | |
502 | searching for changes |
|
822 | searching for changes | |
503 | common changesets up to 6675d58eff77 |
|
823 | common changesets up to 6675d58eff77 | |
504 | invalidating branch cache (tip differs) |
|
824 | invalidating branch cache (tip differs) | |
505 | 3 changesets found |
|
825 | 3 changesets found | |
506 | list of changesets: |
|
826 | list of changesets: | |
507 | ef1ea85a6374b77d6da9dcda9541f498f2d17df7 |
|
827 | ef1ea85a6374b77d6da9dcda9541f498f2d17df7 | |
508 | f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd |
|
828 | f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd | |
509 | 911600dab2ae7a9baff75958b84fe606851ce955 |
|
829 | 911600dab2ae7a9baff75958b84fe606851ce955 | |
510 | adding changesets |
|
830 | adding changesets | |
|
831 | bundle changes: 0 chunks | |||
|
832 | bundle changes: 1 chunks | |||
|
833 | bundle changes: 2 chunks | |||
|
834 | bundle changes: 3 chunks | |||
|
835 | bundle changes: 4 chunks | |||
|
836 | bundle changes: 5 chunks | |||
|
837 | bundle changes: 6 chunks | |||
|
838 | bundle changes: 7 chunks | |||
|
839 | bundle changes: 8 chunks | |||
|
840 | bundle changes: 9 chunks | |||
|
841 | bundle manifests: 0 chunks | |||
|
842 | bundle manifests: 1 chunks | |||
|
843 | bundle manifests: 2 chunks | |||
|
844 | bundle manifests: 3 chunks | |||
|
845 | bundle manifests: 4 chunks | |||
|
846 | bundle manifests: 5 chunks | |||
|
847 | bundle manifests: 6 chunks | |||
|
848 | bundle manifests: 7 chunks | |||
|
849 | bundle manifests: 8 chunks | |||
|
850 | bundle manifests: 9 chunks | |||
|
851 | bundle files: foo/Bar/file.txt 0 chunks | |||
|
852 | bundle files: foo/Bar/file.txt 1 chunks | |||
|
853 | bundle files: foo/Bar/file.txt 2 chunks | |||
|
854 | bundle files: foo/Bar/file.txt 3 chunks | |||
|
855 | bundle files: foo/file.txt 4 chunks | |||
|
856 | bundle files: foo/file.txt 5 chunks | |||
|
857 | bundle files: foo/file.txt 6 chunks | |||
|
858 | bundle files: foo/file.txt 7 chunks | |||
|
859 | bundle files: quux/file.py 8 chunks | |||
|
860 | bundle files: quux/file.py 9 chunks | |||
|
861 | bundle files: quux/file.py 10 chunks | |||
|
862 | bundle files: quux/file.py 11 chunks | |||
511 | changesets: 1 chunks |
|
863 | changesets: 1 chunks | |
512 | add changeset ef1ea85a6374 |
|
864 | add changeset ef1ea85a6374 | |
513 | changesets: 2 chunks |
|
865 | changesets: 2 chunks | |
514 | add changeset f9cafe1212c8 |
|
866 | add changeset f9cafe1212c8 | |
515 | changesets: 3 chunks |
|
867 | changesets: 3 chunks | |
516 | add changeset 911600dab2ae |
|
868 | add changeset 911600dab2ae | |
517 | adding manifests |
|
869 | adding manifests | |
518 | manifests: 1 chunks |
|
870 | manifests: 1 chunks | |
519 | manifests: 2 chunks |
|
871 | manifests: 2 chunks | |
520 | manifests: 3 chunks |
|
872 | manifests: 3 chunks | |
521 | adding file changes |
|
873 | adding file changes | |
522 | adding foo/Bar/file.txt revisions |
|
874 | adding foo/Bar/file.txt revisions | |
523 | files: 1 chunks |
|
875 | files: 1 chunks | |
524 | adding foo/file.txt revisions |
|
876 | adding foo/file.txt revisions | |
525 | files: 2 chunks |
|
877 | files: 2 chunks | |
526 | adding quux/file.py revisions |
|
878 | adding quux/file.py revisions | |
527 | files: 3 chunks |
|
879 | files: 3 chunks | |
528 | added 3 changesets with 3 changes to 3 files |
|
880 | added 3 changesets with 3 changes to 3 files | |
529 | calling hook pretxnchangegroup.acl: hgext.acl.hook |
|
881 | calling hook pretxnchangegroup.acl: hgext.acl.hook | |
530 | acl: acl.allow enabled, 1 entries for user wilma |
|
882 | acl: acl.allow enabled, 1 entries for user wilma | |
531 | acl: acl.deny enabled, 0 entries for user wilma |
|
883 | acl: acl.deny enabled, 0 entries for user wilma | |
532 | acl: allowing changeset ef1ea85a6374 |
|
884 | acl: allowing changeset ef1ea85a6374 | |
533 | acl: allowing changeset f9cafe1212c8 |
|
885 | acl: allowing changeset f9cafe1212c8 | |
534 | acl: user wilma not allowed on quux/file.py |
|
886 | acl: user wilma not allowed on quux/file.py | |
535 | error: pretxnchangegroup.acl hook failed: acl: access denied for changeset 911600dab2ae |
|
887 | error: pretxnchangegroup.acl hook failed: acl: access denied for changeset 911600dab2ae | |
536 | transaction abort! |
|
888 | transaction abort! | |
537 | rollback completed |
|
889 | rollback completed | |
538 | abort: acl: access denied for changeset 911600dab2ae |
|
890 | abort: acl: access denied for changeset 911600dab2ae | |
539 | no rollback information available |
|
891 | no rollback information available | |
540 | 0:6675d58eff77 |
|
892 | 0:6675d58eff77 | |
541 |
|
893 | |||
542 | file specified by acl.config does not exist |
|
894 | file specified by acl.config does not exist | |
543 | Pushing as user barney |
|
895 | Pushing as user barney | |
544 | hgrc = """ |
|
896 | hgrc = """ | |
545 | [hooks] |
|
897 | [hooks] | |
546 | pretxnchangegroup.acl = python:hgext.acl.hook |
|
898 | pretxnchangegroup.acl = python:hgext.acl.hook | |
547 | [acl] |
|
899 | [acl] | |
548 | sources = push |
|
900 | sources = push | |
549 | [acl.allow] |
|
901 | [acl.allow] | |
550 | foo/** = fred |
|
902 | foo/** = fred | |
551 | [acl.deny] |
|
903 | [acl.deny] | |
552 | foo/bar/** = fred |
|
904 | foo/bar/** = fred | |
553 | foo/Bar/** = fred |
|
905 | foo/Bar/** = fred | |
554 | [acl.allow] |
|
906 | [acl.allow] | |
555 | ** = barney |
|
907 | ** = barney | |
556 | **/*.txt = wilma |
|
908 | **/*.txt = wilma | |
557 | [acl] |
|
909 | [acl] | |
558 | config = ../acl.config |
|
910 | config = ../acl.config | |
559 | """ |
|
911 | """ | |
560 | pushing to ../b |
|
912 | pushing to ../b | |
561 | searching for changes |
|
913 | searching for changes | |
562 | common changesets up to 6675d58eff77 |
|
914 | common changesets up to 6675d58eff77 | |
563 | 3 changesets found |
|
915 | 3 changesets found | |
564 | list of changesets: |
|
916 | list of changesets: | |
565 | ef1ea85a6374b77d6da9dcda9541f498f2d17df7 |
|
917 | ef1ea85a6374b77d6da9dcda9541f498f2d17df7 | |
566 | f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd |
|
918 | f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd | |
567 | 911600dab2ae7a9baff75958b84fe606851ce955 |
|
919 | 911600dab2ae7a9baff75958b84fe606851ce955 | |
568 | adding changesets |
|
920 | adding changesets | |
|
921 | bundle changes: 0 chunks | |||
|
922 | bundle changes: 1 chunks | |||
|
923 | bundle changes: 2 chunks | |||
|
924 | bundle changes: 3 chunks | |||
|
925 | bundle changes: 4 chunks | |||
|
926 | bundle changes: 5 chunks | |||
|
927 | bundle changes: 6 chunks | |||
|
928 | bundle changes: 7 chunks | |||
|
929 | bundle changes: 8 chunks | |||
|
930 | bundle changes: 9 chunks | |||
|
931 | bundle manifests: 0 chunks | |||
|
932 | bundle manifests: 1 chunks | |||
|
933 | bundle manifests: 2 chunks | |||
|
934 | bundle manifests: 3 chunks | |||
|
935 | bundle manifests: 4 chunks | |||
|
936 | bundle manifests: 5 chunks | |||
|
937 | bundle manifests: 6 chunks | |||
|
938 | bundle manifests: 7 chunks | |||
|
939 | bundle manifests: 8 chunks | |||
|
940 | bundle manifests: 9 chunks | |||
|
941 | bundle files: foo/Bar/file.txt 0 chunks | |||
|
942 | bundle files: foo/Bar/file.txt 1 chunks | |||
|
943 | bundle files: foo/Bar/file.txt 2 chunks | |||
|
944 | bundle files: foo/Bar/file.txt 3 chunks | |||
|
945 | bundle files: foo/file.txt 4 chunks | |||
|
946 | bundle files: foo/file.txt 5 chunks | |||
|
947 | bundle files: foo/file.txt 6 chunks | |||
|
948 | bundle files: foo/file.txt 7 chunks | |||
|
949 | bundle files: quux/file.py 8 chunks | |||
|
950 | bundle files: quux/file.py 9 chunks | |||
|
951 | bundle files: quux/file.py 10 chunks | |||
|
952 | bundle files: quux/file.py 11 chunks | |||
569 | changesets: 1 chunks |
|
953 | changesets: 1 chunks | |
570 | add changeset ef1ea85a6374 |
|
954 | add changeset ef1ea85a6374 | |
571 | changesets: 2 chunks |
|
955 | changesets: 2 chunks | |
572 | add changeset f9cafe1212c8 |
|
956 | add changeset f9cafe1212c8 | |
573 | changesets: 3 chunks |
|
957 | changesets: 3 chunks | |
574 | add changeset 911600dab2ae |
|
958 | add changeset 911600dab2ae | |
575 | adding manifests |
|
959 | adding manifests | |
576 | manifests: 1 chunks |
|
960 | manifests: 1 chunks | |
577 | manifests: 2 chunks |
|
961 | manifests: 2 chunks | |
578 | manifests: 3 chunks |
|
962 | manifests: 3 chunks | |
579 | adding file changes |
|
963 | adding file changes | |
580 | adding foo/Bar/file.txt revisions |
|
964 | adding foo/Bar/file.txt revisions | |
581 | files: 1 chunks |
|
965 | files: 1 chunks | |
582 | adding foo/file.txt revisions |
|
966 | adding foo/file.txt revisions | |
583 | files: 2 chunks |
|
967 | files: 2 chunks | |
584 | adding quux/file.py revisions |
|
968 | adding quux/file.py revisions | |
585 | files: 3 chunks |
|
969 | files: 3 chunks | |
586 | added 3 changesets with 3 changes to 3 files |
|
970 | added 3 changesets with 3 changes to 3 files | |
587 | calling hook pretxnchangegroup.acl: hgext.acl.hook |
|
971 | calling hook pretxnchangegroup.acl: hgext.acl.hook | |
588 | error: pretxnchangegroup.acl hook raised an exception: [Errno 2] No such file or directory: '../acl.config' |
|
972 | error: pretxnchangegroup.acl hook raised an exception: [Errno 2] No such file or directory: '../acl.config' | |
589 | transaction abort! |
|
973 | transaction abort! | |
590 | rollback completed |
|
974 | rollback completed | |
591 | abort: No such file or directory: ../acl.config |
|
975 | abort: No such file or directory: ../acl.config | |
592 | no rollback information available |
|
976 | no rollback information available | |
593 | 0:6675d58eff77 |
|
977 | 0:6675d58eff77 | |
594 |
|
978 | |||
595 | betty is allowed inside foo/ by a acl.config file |
|
979 | betty is allowed inside foo/ by a acl.config file | |
596 | Pushing as user betty |
|
980 | Pushing as user betty | |
597 | hgrc = """ |
|
981 | hgrc = """ | |
598 | [hooks] |
|
982 | [hooks] | |
599 | pretxnchangegroup.acl = python:hgext.acl.hook |
|
983 | pretxnchangegroup.acl = python:hgext.acl.hook | |
600 | [acl] |
|
984 | [acl] | |
601 | sources = push |
|
985 | sources = push | |
602 | [acl.allow] |
|
986 | [acl.allow] | |
603 | foo/** = fred |
|
987 | foo/** = fred | |
604 | [acl.deny] |
|
988 | [acl.deny] | |
605 | foo/bar/** = fred |
|
989 | foo/bar/** = fred | |
606 | foo/Bar/** = fred |
|
990 | foo/Bar/** = fred | |
607 | [acl.allow] |
|
991 | [acl.allow] | |
608 | ** = barney |
|
992 | ** = barney | |
609 | **/*.txt = wilma |
|
993 | **/*.txt = wilma | |
610 | [acl] |
|
994 | [acl] | |
611 | config = ../acl.config |
|
995 | config = ../acl.config | |
612 | """ |
|
996 | """ | |
613 | acl.config = """ |
|
997 | acl.config = """ | |
614 | [acl.allow] |
|
998 | [acl.allow] | |
615 | foo/** = betty |
|
999 | foo/** = betty | |
616 | """ |
|
1000 | """ | |
617 | pushing to ../b |
|
1001 | pushing to ../b | |
618 | searching for changes |
|
1002 | searching for changes | |
619 | common changesets up to 6675d58eff77 |
|
1003 | common changesets up to 6675d58eff77 | |
620 | 3 changesets found |
|
1004 | 3 changesets found | |
621 | list of changesets: |
|
1005 | list of changesets: | |
622 | ef1ea85a6374b77d6da9dcda9541f498f2d17df7 |
|
1006 | ef1ea85a6374b77d6da9dcda9541f498f2d17df7 | |
623 | f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd |
|
1007 | f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd | |
624 | 911600dab2ae7a9baff75958b84fe606851ce955 |
|
1008 | 911600dab2ae7a9baff75958b84fe606851ce955 | |
625 | adding changesets |
|
1009 | adding changesets | |
|
1010 | bundle changes: 0 chunks | |||
|
1011 | bundle changes: 1 chunks | |||
|
1012 | bundle changes: 2 chunks | |||
|
1013 | bundle changes: 3 chunks | |||
|
1014 | bundle changes: 4 chunks | |||
|
1015 | bundle changes: 5 chunks | |||
|
1016 | bundle changes: 6 chunks | |||
|
1017 | bundle changes: 7 chunks | |||
|
1018 | bundle changes: 8 chunks | |||
|
1019 | bundle changes: 9 chunks | |||
|
1020 | bundle manifests: 0 chunks | |||
|
1021 | bundle manifests: 1 chunks | |||
|
1022 | bundle manifests: 2 chunks | |||
|
1023 | bundle manifests: 3 chunks | |||
|
1024 | bundle manifests: 4 chunks | |||
|
1025 | bundle manifests: 5 chunks | |||
|
1026 | bundle manifests: 6 chunks | |||
|
1027 | bundle manifests: 7 chunks | |||
|
1028 | bundle manifests: 8 chunks | |||
|
1029 | bundle manifests: 9 chunks | |||
|
1030 | bundle files: foo/Bar/file.txt 0 chunks | |||
|
1031 | bundle files: foo/Bar/file.txt 1 chunks | |||
|
1032 | bundle files: foo/Bar/file.txt 2 chunks | |||
|
1033 | bundle files: foo/Bar/file.txt 3 chunks | |||
|
1034 | bundle files: foo/file.txt 4 chunks | |||
|
1035 | bundle files: foo/file.txt 5 chunks | |||
|
1036 | bundle files: foo/file.txt 6 chunks | |||
|
1037 | bundle files: foo/file.txt 7 chunks | |||
|
1038 | bundle files: quux/file.py 8 chunks | |||
|
1039 | bundle files: quux/file.py 9 chunks | |||
|
1040 | bundle files: quux/file.py 10 chunks | |||
|
1041 | bundle files: quux/file.py 11 chunks | |||
626 | changesets: 1 chunks |
|
1042 | changesets: 1 chunks | |
627 | add changeset ef1ea85a6374 |
|
1043 | add changeset ef1ea85a6374 | |
628 | changesets: 2 chunks |
|
1044 | changesets: 2 chunks | |
629 | add changeset f9cafe1212c8 |
|
1045 | add changeset f9cafe1212c8 | |
630 | changesets: 3 chunks |
|
1046 | changesets: 3 chunks | |
631 | add changeset 911600dab2ae |
|
1047 | add changeset 911600dab2ae | |
632 | adding manifests |
|
1048 | adding manifests | |
633 | manifests: 1 chunks |
|
1049 | manifests: 1 chunks | |
634 | manifests: 2 chunks |
|
1050 | manifests: 2 chunks | |
635 | manifests: 3 chunks |
|
1051 | manifests: 3 chunks | |
636 | adding file changes |
|
1052 | adding file changes | |
637 | adding foo/Bar/file.txt revisions |
|
1053 | adding foo/Bar/file.txt revisions | |
638 | files: 1 chunks |
|
1054 | files: 1 chunks | |
639 | adding foo/file.txt revisions |
|
1055 | adding foo/file.txt revisions | |
640 | files: 2 chunks |
|
1056 | files: 2 chunks | |
641 | adding quux/file.py revisions |
|
1057 | adding quux/file.py revisions | |
642 | files: 3 chunks |
|
1058 | files: 3 chunks | |
643 | added 3 changesets with 3 changes to 3 files |
|
1059 | added 3 changesets with 3 changes to 3 files | |
644 | calling hook pretxnchangegroup.acl: hgext.acl.hook |
|
1060 | calling hook pretxnchangegroup.acl: hgext.acl.hook | |
645 | acl: acl.allow enabled, 1 entries for user betty |
|
1061 | acl: acl.allow enabled, 1 entries for user betty | |
646 | acl: acl.deny enabled, 0 entries for user betty |
|
1062 | acl: acl.deny enabled, 0 entries for user betty | |
647 | acl: allowing changeset ef1ea85a6374 |
|
1063 | acl: allowing changeset ef1ea85a6374 | |
648 | acl: allowing changeset f9cafe1212c8 |
|
1064 | acl: allowing changeset f9cafe1212c8 | |
649 | acl: user betty not allowed on quux/file.py |
|
1065 | acl: user betty not allowed on quux/file.py | |
650 | error: pretxnchangegroup.acl hook failed: acl: access denied for changeset 911600dab2ae |
|
1066 | error: pretxnchangegroup.acl hook failed: acl: access denied for changeset 911600dab2ae | |
651 | transaction abort! |
|
1067 | transaction abort! | |
652 | rollback completed |
|
1068 | rollback completed | |
653 | abort: acl: access denied for changeset 911600dab2ae |
|
1069 | abort: acl: access denied for changeset 911600dab2ae | |
654 | no rollback information available |
|
1070 | no rollback information available | |
655 | 0:6675d58eff77 |
|
1071 | 0:6675d58eff77 | |
656 |
|
1072 | |||
657 | acl.config can set only [acl.allow]/[acl.deny] |
|
1073 | acl.config can set only [acl.allow]/[acl.deny] | |
658 | Pushing as user barney |
|
1074 | Pushing as user barney | |
659 | hgrc = """ |
|
1075 | hgrc = """ | |
660 | [hooks] |
|
1076 | [hooks] | |
661 | pretxnchangegroup.acl = python:hgext.acl.hook |
|
1077 | pretxnchangegroup.acl = python:hgext.acl.hook | |
662 | [acl] |
|
1078 | [acl] | |
663 | sources = push |
|
1079 | sources = push | |
664 | [acl.allow] |
|
1080 | [acl.allow] | |
665 | foo/** = fred |
|
1081 | foo/** = fred | |
666 | [acl.deny] |
|
1082 | [acl.deny] | |
667 | foo/bar/** = fred |
|
1083 | foo/bar/** = fred | |
668 | foo/Bar/** = fred |
|
1084 | foo/Bar/** = fred | |
669 | [acl.allow] |
|
1085 | [acl.allow] | |
670 | ** = barney |
|
1086 | ** = barney | |
671 | **/*.txt = wilma |
|
1087 | **/*.txt = wilma | |
672 | [acl] |
|
1088 | [acl] | |
673 | config = ../acl.config |
|
1089 | config = ../acl.config | |
674 | """ |
|
1090 | """ | |
675 | acl.config = """ |
|
1091 | acl.config = """ | |
676 | [acl.allow] |
|
1092 | [acl.allow] | |
677 | foo/** = betty |
|
1093 | foo/** = betty | |
678 | [hooks] |
|
1094 | [hooks] | |
679 | changegroup.acl = false |
|
1095 | changegroup.acl = false | |
680 | """ |
|
1096 | """ | |
681 | pushing to ../b |
|
1097 | pushing to ../b | |
682 | searching for changes |
|
1098 | searching for changes | |
683 | common changesets up to 6675d58eff77 |
|
1099 | common changesets up to 6675d58eff77 | |
684 | 3 changesets found |
|
1100 | 3 changesets found | |
685 | list of changesets: |
|
1101 | list of changesets: | |
686 | ef1ea85a6374b77d6da9dcda9541f498f2d17df7 |
|
1102 | ef1ea85a6374b77d6da9dcda9541f498f2d17df7 | |
687 | f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd |
|
1103 | f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd | |
688 | 911600dab2ae7a9baff75958b84fe606851ce955 |
|
1104 | 911600dab2ae7a9baff75958b84fe606851ce955 | |
689 | adding changesets |
|
1105 | adding changesets | |
|
1106 | bundle changes: 0 chunks | |||
|
1107 | bundle changes: 1 chunks | |||
|
1108 | bundle changes: 2 chunks | |||
|
1109 | bundle changes: 3 chunks | |||
|
1110 | bundle changes: 4 chunks | |||
|
1111 | bundle changes: 5 chunks | |||
|
1112 | bundle changes: 6 chunks | |||
|
1113 | bundle changes: 7 chunks | |||
|
1114 | bundle changes: 8 chunks | |||
|
1115 | bundle changes: 9 chunks | |||
|
1116 | bundle manifests: 0 chunks | |||
|
1117 | bundle manifests: 1 chunks | |||
|
1118 | bundle manifests: 2 chunks | |||
|
1119 | bundle manifests: 3 chunks | |||
|
1120 | bundle manifests: 4 chunks | |||
|
1121 | bundle manifests: 5 chunks | |||
|
1122 | bundle manifests: 6 chunks | |||
|
1123 | bundle manifests: 7 chunks | |||
|
1124 | bundle manifests: 8 chunks | |||
|
1125 | bundle manifests: 9 chunks | |||
|
1126 | bundle files: foo/Bar/file.txt 0 chunks | |||
|
1127 | bundle files: foo/Bar/file.txt 1 chunks | |||
|
1128 | bundle files: foo/Bar/file.txt 2 chunks | |||
|
1129 | bundle files: foo/Bar/file.txt 3 chunks | |||
|
1130 | bundle files: foo/file.txt 4 chunks | |||
|
1131 | bundle files: foo/file.txt 5 chunks | |||
|
1132 | bundle files: foo/file.txt 6 chunks | |||
|
1133 | bundle files: foo/file.txt 7 chunks | |||
|
1134 | bundle files: quux/file.py 8 chunks | |||
|
1135 | bundle files: quux/file.py 9 chunks | |||
|
1136 | bundle files: quux/file.py 10 chunks | |||
|
1137 | bundle files: quux/file.py 11 chunks | |||
690 | changesets: 1 chunks |
|
1138 | changesets: 1 chunks | |
691 | add changeset ef1ea85a6374 |
|
1139 | add changeset ef1ea85a6374 | |
692 | changesets: 2 chunks |
|
1140 | changesets: 2 chunks | |
693 | add changeset f9cafe1212c8 |
|
1141 | add changeset f9cafe1212c8 | |
694 | changesets: 3 chunks |
|
1142 | changesets: 3 chunks | |
695 | add changeset 911600dab2ae |
|
1143 | add changeset 911600dab2ae | |
696 | adding manifests |
|
1144 | adding manifests | |
697 | manifests: 1 chunks |
|
1145 | manifests: 1 chunks | |
698 | manifests: 2 chunks |
|
1146 | manifests: 2 chunks | |
699 | manifests: 3 chunks |
|
1147 | manifests: 3 chunks | |
700 | adding file changes |
|
1148 | adding file changes | |
701 | adding foo/Bar/file.txt revisions |
|
1149 | adding foo/Bar/file.txt revisions | |
702 | files: 1 chunks |
|
1150 | files: 1 chunks | |
703 | adding foo/file.txt revisions |
|
1151 | adding foo/file.txt revisions | |
704 | files: 2 chunks |
|
1152 | files: 2 chunks | |
705 | adding quux/file.py revisions |
|
1153 | adding quux/file.py revisions | |
706 | files: 3 chunks |
|
1154 | files: 3 chunks | |
707 | added 3 changesets with 3 changes to 3 files |
|
1155 | added 3 changesets with 3 changes to 3 files | |
708 | calling hook pretxnchangegroup.acl: hgext.acl.hook |
|
1156 | calling hook pretxnchangegroup.acl: hgext.acl.hook | |
709 | acl: acl.allow enabled, 1 entries for user barney |
|
1157 | acl: acl.allow enabled, 1 entries for user barney | |
710 | acl: acl.deny enabled, 0 entries for user barney |
|
1158 | acl: acl.deny enabled, 0 entries for user barney | |
711 | acl: allowing changeset ef1ea85a6374 |
|
1159 | acl: allowing changeset ef1ea85a6374 | |
712 | acl: allowing changeset f9cafe1212c8 |
|
1160 | acl: allowing changeset f9cafe1212c8 | |
713 | acl: allowing changeset 911600dab2ae |
|
1161 | acl: allowing changeset 911600dab2ae | |
714 | updating the branch cache |
|
1162 | updating the branch cache | |
715 | rolling back last transaction |
|
1163 | rolling back last transaction | |
716 | 0:6675d58eff77 |
|
1164 | 0:6675d58eff77 | |
717 |
|
1165 |
@@ -1,343 +1,365 | |||||
1 | ====== Setting up test |
|
1 | ====== Setting up test | |
2 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
2 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
3 | created new head |
|
3 | created new head | |
4 | 1 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
4 | 1 files updated, 0 files merged, 2 files removed, 0 files unresolved | |
5 | checking changesets |
|
5 | checking changesets | |
6 | checking manifests |
|
6 | checking manifests | |
7 | crosschecking files in changesets and manifests |
|
7 | crosschecking files in changesets and manifests | |
8 | checking files |
|
8 | checking files | |
9 | 4 files, 9 changesets, 7 total revisions |
|
9 | 4 files, 9 changesets, 7 total revisions | |
10 | ====== Bundle --all |
|
10 | ====== Bundle --all | |
11 | 9 changesets found |
|
11 | 9 changesets found | |
12 | ====== Bundle test to full.hg |
|
12 | ====== Bundle test to full.hg | |
13 | searching for changes |
|
13 | searching for changes | |
14 | 9 changesets found |
|
14 | 9 changesets found | |
15 | ====== Unbundle full.hg in test |
|
15 | ====== Unbundle full.hg in test | |
16 | adding changesets |
|
16 | adding changesets | |
17 | adding manifests |
|
17 | adding manifests | |
18 | adding file changes |
|
18 | adding file changes | |
19 | added 0 changesets with 0 changes to 4 files |
|
19 | added 0 changesets with 0 changes to 4 files | |
20 | (run 'hg update' to get a working copy) |
|
20 | (run 'hg update' to get a working copy) | |
21 | ====== Verify empty |
|
21 | ====== Verify empty | |
22 | checking changesets |
|
22 | checking changesets | |
23 | checking manifests |
|
23 | checking manifests | |
24 | crosschecking files in changesets and manifests |
|
24 | crosschecking files in changesets and manifests | |
25 | checking files |
|
25 | checking files | |
26 | 0 files, 0 changesets, 0 total revisions |
|
26 | 0 files, 0 changesets, 0 total revisions | |
27 | ====== Pull full.hg into test (using --cwd) |
|
27 | ====== Pull full.hg into test (using --cwd) | |
28 | pulling from ../full.hg |
|
28 | pulling from ../full.hg | |
29 | searching for changes |
|
29 | searching for changes | |
30 | no changes found |
|
30 | no changes found | |
31 | ====== Pull full.hg into empty (using --cwd) |
|
31 | ====== Pull full.hg into empty (using --cwd) | |
32 | pulling from ../full.hg |
|
32 | pulling from ../full.hg | |
33 | requesting all changes |
|
33 | requesting all changes | |
34 | adding changesets |
|
34 | adding changesets | |
35 | adding manifests |
|
35 | adding manifests | |
36 | adding file changes |
|
36 | adding file changes | |
37 | added 9 changesets with 7 changes to 4 files (+1 heads) |
|
37 | added 9 changesets with 7 changes to 4 files (+1 heads) | |
38 | (run 'hg heads' to see heads, 'hg merge' to merge) |
|
38 | (run 'hg heads' to see heads, 'hg merge' to merge) | |
39 | ====== Rollback empty |
|
39 | ====== Rollback empty | |
40 | rolling back last transaction |
|
40 | rolling back last transaction | |
41 | ====== Pull full.hg into empty again (using --cwd) |
|
41 | ====== Pull full.hg into empty again (using --cwd) | |
42 | pulling from ../full.hg |
|
42 | pulling from ../full.hg | |
43 | requesting all changes |
|
43 | requesting all changes | |
44 | adding changesets |
|
44 | adding changesets | |
45 | adding manifests |
|
45 | adding manifests | |
46 | adding file changes |
|
46 | adding file changes | |
47 | added 9 changesets with 7 changes to 4 files (+1 heads) |
|
47 | added 9 changesets with 7 changes to 4 files (+1 heads) | |
48 | (run 'hg heads' to see heads, 'hg merge' to merge) |
|
48 | (run 'hg heads' to see heads, 'hg merge' to merge) | |
49 | ====== Pull full.hg into test (using -R) |
|
49 | ====== Pull full.hg into test (using -R) | |
50 | pulling from full.hg |
|
50 | pulling from full.hg | |
51 | searching for changes |
|
51 | searching for changes | |
52 | no changes found |
|
52 | no changes found | |
53 | ====== Pull full.hg into empty (using -R) |
|
53 | ====== Pull full.hg into empty (using -R) | |
54 | pulling from full.hg |
|
54 | pulling from full.hg | |
55 | searching for changes |
|
55 | searching for changes | |
56 | no changes found |
|
56 | no changes found | |
57 | ====== Rollback empty |
|
57 | ====== Rollback empty | |
58 | rolling back last transaction |
|
58 | rolling back last transaction | |
59 | ====== Pull full.hg into empty again (using -R) |
|
59 | ====== Pull full.hg into empty again (using -R) | |
60 | pulling from full.hg |
|
60 | pulling from full.hg | |
61 | requesting all changes |
|
61 | requesting all changes | |
62 | adding changesets |
|
62 | adding changesets | |
63 | adding manifests |
|
63 | adding manifests | |
64 | adding file changes |
|
64 | adding file changes | |
65 | added 9 changesets with 7 changes to 4 files (+1 heads) |
|
65 | added 9 changesets with 7 changes to 4 files (+1 heads) | |
66 | (run 'hg heads' to see heads, 'hg merge' to merge) |
|
66 | (run 'hg heads' to see heads, 'hg merge' to merge) | |
67 | ====== Log -R full.hg in fresh empty |
|
67 | ====== Log -R full.hg in fresh empty | |
68 | changeset: 8:836ac62537ab |
|
68 | changeset: 8:836ac62537ab | |
69 | tag: tip |
|
69 | tag: tip | |
70 | parent: 3:ac69c658229d |
|
70 | parent: 3:ac69c658229d | |
71 | user: test |
|
71 | user: test | |
72 | date: Mon Jan 12 13:46:40 1970 +0000 |
|
72 | date: Mon Jan 12 13:46:40 1970 +0000 | |
73 | summary: 0.3m |
|
73 | summary: 0.3m | |
74 |
|
74 | |||
75 | changeset: 7:80fe151401c2 |
|
75 | changeset: 7:80fe151401c2 | |
76 | user: test |
|
76 | user: test | |
77 | date: Mon Jan 12 13:46:40 1970 +0000 |
|
77 | date: Mon Jan 12 13:46:40 1970 +0000 | |
78 | summary: 1.3m |
|
78 | summary: 1.3m | |
79 |
|
79 | |||
80 | changeset: 6:1e3f6b843bd6 |
|
80 | changeset: 6:1e3f6b843bd6 | |
81 | user: test |
|
81 | user: test | |
82 | date: Mon Jan 12 13:46:40 1970 +0000 |
|
82 | date: Mon Jan 12 13:46:40 1970 +0000 | |
83 | summary: 1.3 |
|
83 | summary: 1.3 | |
84 |
|
84 | |||
85 | changeset: 5:024e4e7df376 |
|
85 | changeset: 5:024e4e7df376 | |
86 | user: test |
|
86 | user: test | |
87 | date: Mon Jan 12 13:46:40 1970 +0000 |
|
87 | date: Mon Jan 12 13:46:40 1970 +0000 | |
88 | summary: 1.2 |
|
88 | summary: 1.2 | |
89 |
|
89 | |||
90 | changeset: 4:5f4f3ceb285e |
|
90 | changeset: 4:5f4f3ceb285e | |
91 | parent: 0:5649c9d34dd8 |
|
91 | parent: 0:5649c9d34dd8 | |
92 | user: test |
|
92 | user: test | |
93 | date: Mon Jan 12 13:46:40 1970 +0000 |
|
93 | date: Mon Jan 12 13:46:40 1970 +0000 | |
94 | summary: 1.1 |
|
94 | summary: 1.1 | |
95 |
|
95 | |||
96 | changeset: 3:ac69c658229d |
|
96 | changeset: 3:ac69c658229d | |
97 | user: test |
|
97 | user: test | |
98 | date: Mon Jan 12 13:46:40 1970 +0000 |
|
98 | date: Mon Jan 12 13:46:40 1970 +0000 | |
99 | summary: 0.3 |
|
99 | summary: 0.3 | |
100 |
|
100 | |||
101 | changeset: 2:d62976ca1e50 |
|
101 | changeset: 2:d62976ca1e50 | |
102 | user: test |
|
102 | user: test | |
103 | date: Mon Jan 12 13:46:40 1970 +0000 |
|
103 | date: Mon Jan 12 13:46:40 1970 +0000 | |
104 | summary: 0.2 |
|
104 | summary: 0.2 | |
105 |
|
105 | |||
106 | changeset: 1:10b2180f755b |
|
106 | changeset: 1:10b2180f755b | |
107 | user: test |
|
107 | user: test | |
108 | date: Mon Jan 12 13:46:40 1970 +0000 |
|
108 | date: Mon Jan 12 13:46:40 1970 +0000 | |
109 | summary: 0.1 |
|
109 | summary: 0.1 | |
110 |
|
110 | |||
111 | changeset: 0:5649c9d34dd8 |
|
111 | changeset: 0:5649c9d34dd8 | |
112 | user: test |
|
112 | user: test | |
113 | date: Mon Jan 12 13:46:40 1970 +0000 |
|
113 | date: Mon Jan 12 13:46:40 1970 +0000 | |
114 | summary: 0.0 |
|
114 | summary: 0.0 | |
115 |
|
115 | |||
116 | ====== Pull ../full.hg into empty (with hook) |
|
116 | ====== Pull ../full.hg into empty (with hook) | |
117 | changegroup hook: HG_NODE=5649c9d34dd87d0ecb5fd39672128376e83b22e1 HG_SOURCE=pull HG_URL=bundle:../full.hg |
|
117 | changegroup hook: HG_NODE=5649c9d34dd87d0ecb5fd39672128376e83b22e1 HG_SOURCE=pull HG_URL=bundle:../full.hg | |
118 | pulling from bundle://../full.hg |
|
118 | pulling from bundle://../full.hg | |
119 | requesting all changes |
|
119 | requesting all changes | |
120 | adding changesets |
|
120 | adding changesets | |
121 | adding manifests |
|
121 | adding manifests | |
122 | adding file changes |
|
122 | adding file changes | |
123 | added 9 changesets with 7 changes to 4 files (+1 heads) |
|
123 | added 9 changesets with 7 changes to 4 files (+1 heads) | |
124 | (run 'hg heads' to see heads, 'hg merge' to merge) |
|
124 | (run 'hg heads' to see heads, 'hg merge' to merge) | |
125 | ====== Rollback empty |
|
125 | ====== Rollback empty | |
126 | rolling back last transaction |
|
126 | rolling back last transaction | |
127 | ====== Log -R bundle:empty+full.hg |
|
127 | ====== Log -R bundle:empty+full.hg | |
128 | 8 7 6 5 4 3 2 1 0 |
|
128 | 8 7 6 5 4 3 2 1 0 | |
129 | ====== Pull full.hg into empty again (using -R; with hook) |
|
129 | ====== Pull full.hg into empty again (using -R; with hook) | |
130 | changegroup hook: HG_NODE=5649c9d34dd87d0ecb5fd39672128376e83b22e1 HG_SOURCE=pull HG_URL=bundle:empty+full.hg |
|
130 | changegroup hook: HG_NODE=5649c9d34dd87d0ecb5fd39672128376e83b22e1 HG_SOURCE=pull HG_URL=bundle:empty+full.hg | |
131 | pulling from full.hg |
|
131 | pulling from full.hg | |
132 | requesting all changes |
|
132 | requesting all changes | |
133 | adding changesets |
|
133 | adding changesets | |
134 | adding manifests |
|
134 | adding manifests | |
135 | adding file changes |
|
135 | adding file changes | |
136 | added 9 changesets with 7 changes to 4 files (+1 heads) |
|
136 | added 9 changesets with 7 changes to 4 files (+1 heads) | |
137 | (run 'hg heads' to see heads, 'hg merge' to merge) |
|
137 | (run 'hg heads' to see heads, 'hg merge' to merge) | |
138 | ====== Create partial clones |
|
138 | ====== Create partial clones | |
139 | requesting all changes |
|
139 | requesting all changes | |
140 | adding changesets |
|
140 | adding changesets | |
141 | adding manifests |
|
141 | adding manifests | |
142 | adding file changes |
|
142 | adding file changes | |
143 | added 4 changesets with 4 changes to 1 files |
|
143 | added 4 changesets with 4 changes to 1 files | |
144 | updating to branch default |
|
144 | updating to branch default | |
145 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
145 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
146 | updating to branch default |
|
146 | updating to branch default | |
147 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
147 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
148 | ====== Log -R full.hg in partial |
|
148 | ====== Log -R full.hg in partial | |
149 | changeset: 8:836ac62537ab |
|
149 | changeset: 8:836ac62537ab | |
150 | tag: tip |
|
150 | tag: tip | |
151 | parent: 3:ac69c658229d |
|
151 | parent: 3:ac69c658229d | |
152 | user: test |
|
152 | user: test | |
153 | date: Mon Jan 12 13:46:40 1970 +0000 |
|
153 | date: Mon Jan 12 13:46:40 1970 +0000 | |
154 | summary: 0.3m |
|
154 | summary: 0.3m | |
155 |
|
155 | |||
156 | changeset: 7:80fe151401c2 |
|
156 | changeset: 7:80fe151401c2 | |
157 | user: test |
|
157 | user: test | |
158 | date: Mon Jan 12 13:46:40 1970 +0000 |
|
158 | date: Mon Jan 12 13:46:40 1970 +0000 | |
159 | summary: 1.3m |
|
159 | summary: 1.3m | |
160 |
|
160 | |||
161 | changeset: 6:1e3f6b843bd6 |
|
161 | changeset: 6:1e3f6b843bd6 | |
162 | user: test |
|
162 | user: test | |
163 | date: Mon Jan 12 13:46:40 1970 +0000 |
|
163 | date: Mon Jan 12 13:46:40 1970 +0000 | |
164 | summary: 1.3 |
|
164 | summary: 1.3 | |
165 |
|
165 | |||
166 | changeset: 5:024e4e7df376 |
|
166 | changeset: 5:024e4e7df376 | |
167 | user: test |
|
167 | user: test | |
168 | date: Mon Jan 12 13:46:40 1970 +0000 |
|
168 | date: Mon Jan 12 13:46:40 1970 +0000 | |
169 | summary: 1.2 |
|
169 | summary: 1.2 | |
170 |
|
170 | |||
171 | changeset: 4:5f4f3ceb285e |
|
171 | changeset: 4:5f4f3ceb285e | |
172 | parent: 0:5649c9d34dd8 |
|
172 | parent: 0:5649c9d34dd8 | |
173 | user: test |
|
173 | user: test | |
174 | date: Mon Jan 12 13:46:40 1970 +0000 |
|
174 | date: Mon Jan 12 13:46:40 1970 +0000 | |
175 | summary: 1.1 |
|
175 | summary: 1.1 | |
176 |
|
176 | |||
177 | changeset: 3:ac69c658229d |
|
177 | changeset: 3:ac69c658229d | |
178 | user: test |
|
178 | user: test | |
179 | date: Mon Jan 12 13:46:40 1970 +0000 |
|
179 | date: Mon Jan 12 13:46:40 1970 +0000 | |
180 | summary: 0.3 |
|
180 | summary: 0.3 | |
181 |
|
181 | |||
182 | changeset: 2:d62976ca1e50 |
|
182 | changeset: 2:d62976ca1e50 | |
183 | user: test |
|
183 | user: test | |
184 | date: Mon Jan 12 13:46:40 1970 +0000 |
|
184 | date: Mon Jan 12 13:46:40 1970 +0000 | |
185 | summary: 0.2 |
|
185 | summary: 0.2 | |
186 |
|
186 | |||
187 | changeset: 1:10b2180f755b |
|
187 | changeset: 1:10b2180f755b | |
188 | user: test |
|
188 | user: test | |
189 | date: Mon Jan 12 13:46:40 1970 +0000 |
|
189 | date: Mon Jan 12 13:46:40 1970 +0000 | |
190 | summary: 0.1 |
|
190 | summary: 0.1 | |
191 |
|
191 | |||
192 | changeset: 0:5649c9d34dd8 |
|
192 | changeset: 0:5649c9d34dd8 | |
193 | user: test |
|
193 | user: test | |
194 | date: Mon Jan 12 13:46:40 1970 +0000 |
|
194 | date: Mon Jan 12 13:46:40 1970 +0000 | |
195 | summary: 0.0 |
|
195 | summary: 0.0 | |
196 |
|
196 | |||
197 | ====== Incoming full.hg in partial |
|
197 | ====== Incoming full.hg in partial | |
198 | comparing with bundle://../full.hg |
|
198 | comparing with bundle://../full.hg | |
199 | searching for changes |
|
199 | searching for changes | |
200 | changeset: 4:5f4f3ceb285e |
|
200 | changeset: 4:5f4f3ceb285e | |
201 | parent: 0:5649c9d34dd8 |
|
201 | parent: 0:5649c9d34dd8 | |
202 | user: test |
|
202 | user: test | |
203 | date: Mon Jan 12 13:46:40 1970 +0000 |
|
203 | date: Mon Jan 12 13:46:40 1970 +0000 | |
204 | summary: 1.1 |
|
204 | summary: 1.1 | |
205 |
|
205 | |||
206 | changeset: 5:024e4e7df376 |
|
206 | changeset: 5:024e4e7df376 | |
207 | user: test |
|
207 | user: test | |
208 | date: Mon Jan 12 13:46:40 1970 +0000 |
|
208 | date: Mon Jan 12 13:46:40 1970 +0000 | |
209 | summary: 1.2 |
|
209 | summary: 1.2 | |
210 |
|
210 | |||
211 | changeset: 6:1e3f6b843bd6 |
|
211 | changeset: 6:1e3f6b843bd6 | |
212 | user: test |
|
212 | user: test | |
213 | date: Mon Jan 12 13:46:40 1970 +0000 |
|
213 | date: Mon Jan 12 13:46:40 1970 +0000 | |
214 | summary: 1.3 |
|
214 | summary: 1.3 | |
215 |
|
215 | |||
216 | changeset: 7:80fe151401c2 |
|
216 | changeset: 7:80fe151401c2 | |
217 | user: test |
|
217 | user: test | |
218 | date: Mon Jan 12 13:46:40 1970 +0000 |
|
218 | date: Mon Jan 12 13:46:40 1970 +0000 | |
219 | summary: 1.3m |
|
219 | summary: 1.3m | |
220 |
|
220 | |||
221 | changeset: 8:836ac62537ab |
|
221 | changeset: 8:836ac62537ab | |
222 | tag: tip |
|
222 | tag: tip | |
223 | parent: 3:ac69c658229d |
|
223 | parent: 3:ac69c658229d | |
224 | user: test |
|
224 | user: test | |
225 | date: Mon Jan 12 13:46:40 1970 +0000 |
|
225 | date: Mon Jan 12 13:46:40 1970 +0000 | |
226 | summary: 0.3m |
|
226 | summary: 0.3m | |
227 |
|
227 | |||
228 | ====== Outgoing -R full.hg vs partial2 in partial |
|
228 | ====== Outgoing -R full.hg vs partial2 in partial | |
229 | comparing with ../partial2 |
|
229 | comparing with ../partial2 | |
230 | searching for changes |
|
230 | searching for changes | |
231 | changeset: 4:5f4f3ceb285e |
|
231 | changeset: 4:5f4f3ceb285e | |
232 | parent: 0:5649c9d34dd8 |
|
232 | parent: 0:5649c9d34dd8 | |
233 | user: test |
|
233 | user: test | |
234 | date: Mon Jan 12 13:46:40 1970 +0000 |
|
234 | date: Mon Jan 12 13:46:40 1970 +0000 | |
235 | summary: 1.1 |
|
235 | summary: 1.1 | |
236 |
|
236 | |||
237 | changeset: 5:024e4e7df376 |
|
237 | changeset: 5:024e4e7df376 | |
238 | user: test |
|
238 | user: test | |
239 | date: Mon Jan 12 13:46:40 1970 +0000 |
|
239 | date: Mon Jan 12 13:46:40 1970 +0000 | |
240 | summary: 1.2 |
|
240 | summary: 1.2 | |
241 |
|
241 | |||
242 | changeset: 6:1e3f6b843bd6 |
|
242 | changeset: 6:1e3f6b843bd6 | |
243 | user: test |
|
243 | user: test | |
244 | date: Mon Jan 12 13:46:40 1970 +0000 |
|
244 | date: Mon Jan 12 13:46:40 1970 +0000 | |
245 | summary: 1.3 |
|
245 | summary: 1.3 | |
246 |
|
246 | |||
247 | changeset: 7:80fe151401c2 |
|
247 | changeset: 7:80fe151401c2 | |
248 | user: test |
|
248 | user: test | |
249 | date: Mon Jan 12 13:46:40 1970 +0000 |
|
249 | date: Mon Jan 12 13:46:40 1970 +0000 | |
250 | summary: 1.3m |
|
250 | summary: 1.3m | |
251 |
|
251 | |||
252 | changeset: 8:836ac62537ab |
|
252 | changeset: 8:836ac62537ab | |
253 | tag: tip |
|
253 | tag: tip | |
254 | parent: 3:ac69c658229d |
|
254 | parent: 3:ac69c658229d | |
255 | user: test |
|
255 | user: test | |
256 | date: Mon Jan 12 13:46:40 1970 +0000 |
|
256 | date: Mon Jan 12 13:46:40 1970 +0000 | |
257 | summary: 0.3m |
|
257 | summary: 0.3m | |
258 |
|
258 | |||
259 | ====== Outgoing -R does-not-exist.hg vs partial2 in partial |
|
259 | ====== Outgoing -R does-not-exist.hg vs partial2 in partial | |
260 | abort: No such file or directory: ../does-not-exist.hg |
|
260 | abort: No such file or directory: ../does-not-exist.hg | |
261 | ====== Direct clone from bundle (all-history) |
|
261 | ====== Direct clone from bundle (all-history) | |
262 | requesting all changes |
|
262 | requesting all changes | |
263 | adding changesets |
|
263 | adding changesets | |
264 | adding manifests |
|
264 | adding manifests | |
265 | adding file changes |
|
265 | adding file changes | |
266 | added 9 changesets with 7 changes to 4 files (+1 heads) |
|
266 | added 9 changesets with 7 changes to 4 files (+1 heads) | |
267 | updating to branch default |
|
267 | updating to branch default | |
268 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
268 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
269 | changeset: 8:836ac62537ab |
|
269 | changeset: 8:836ac62537ab | |
270 | tag: tip |
|
270 | tag: tip | |
271 | parent: 3:ac69c658229d |
|
271 | parent: 3:ac69c658229d | |
272 | user: test |
|
272 | user: test | |
273 | date: Mon Jan 12 13:46:40 1970 +0000 |
|
273 | date: Mon Jan 12 13:46:40 1970 +0000 | |
274 | summary: 0.3m |
|
274 | summary: 0.3m | |
275 |
|
275 | |||
276 | changeset: 7:80fe151401c2 |
|
276 | changeset: 7:80fe151401c2 | |
277 | user: test |
|
277 | user: test | |
278 | date: Mon Jan 12 13:46:40 1970 +0000 |
|
278 | date: Mon Jan 12 13:46:40 1970 +0000 | |
279 | summary: 1.3m |
|
279 | summary: 1.3m | |
280 |
|
280 | |||
281 | ====== Unbundle incremental bundles into fresh empty in one go |
|
281 | ====== Unbundle incremental bundles into fresh empty in one go | |
282 | 1 changesets found |
|
282 | 1 changesets found | |
283 | 1 changesets found |
|
283 | 1 changesets found | |
284 | adding changesets |
|
284 | adding changesets | |
285 | adding manifests |
|
285 | adding manifests | |
286 | adding file changes |
|
286 | adding file changes | |
287 | added 1 changesets with 1 changes to 1 files |
|
287 | added 1 changesets with 1 changes to 1 files | |
288 | adding changesets |
|
288 | adding changesets | |
289 | adding manifests |
|
289 | adding manifests | |
290 | adding file changes |
|
290 | adding file changes | |
291 | added 1 changesets with 1 changes to 1 files |
|
291 | added 1 changesets with 1 changes to 1 files | |
292 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
292 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
293 | ====== test for 540d1059c802 |
|
293 | ====== test for 540d1059c802 | |
294 | updating to branch default |
|
294 | updating to branch default | |
295 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
295 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
296 | searching for changes |
|
296 | searching for changes | |
297 | 1 changesets found |
|
297 | 1 changesets found | |
298 | comparing with ../bundle.hg |
|
298 | comparing with ../bundle.hg | |
299 | searching for changes |
|
299 | searching for changes | |
300 | changeset: 2:ed1b79f46b9a |
|
300 | changeset: 2:ed1b79f46b9a | |
301 | tag: tip |
|
301 | tag: tip | |
302 | parent: 0:bbd179dfa0a7 |
|
302 | parent: 0:bbd179dfa0a7 | |
303 | user: test |
|
303 | user: test | |
304 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
304 | date: Thu Jan 01 00:00:00 1970 +0000 | |
305 | summary: change foo |
|
305 | summary: change foo | |
306 |
|
306 | |||
307 | ===== test that verify bundle does not traceback |
|
307 | ===== test that verify bundle does not traceback | |
308 | abort: 00changelog.i@bbd179dfa0a7: unknown parent! |
|
308 | abort: 00changelog.i@bbd179dfa0a7: unknown parent! | |
309 | abort: cannot verify bundle or remote repos |
|
309 | abort: cannot verify bundle or remote repos | |
310 | checking changesets |
|
310 | checking changesets | |
311 | checking manifests |
|
311 | checking manifests | |
312 | crosschecking files in changesets and manifests |
|
312 | crosschecking files in changesets and manifests | |
313 | checking files |
|
313 | checking files | |
314 | 2 files, 2 changesets, 2 total revisions |
|
314 | 2 files, 2 changesets, 2 total revisions | |
315 | ====== diff against bundle |
|
315 | ====== diff against bundle | |
316 | diff -r 836ac62537ab anotherfile |
|
316 | diff -r 836ac62537ab anotherfile | |
317 | --- a/anotherfile Mon Jan 12 13:46:40 1970 +0000 |
|
317 | --- a/anotherfile Mon Jan 12 13:46:40 1970 +0000 | |
318 | +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
318 | +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
319 | @@ -1,4 +0,0 @@ |
|
319 | @@ -1,4 +0,0 @@ | |
320 | -0 |
|
320 | -0 | |
321 | -1 |
|
321 | -1 | |
322 | -2 |
|
322 | -2 | |
323 | -3 |
|
323 | -3 | |
324 | ====== bundle single branch |
|
324 | ====== bundle single branch | |
325 | adding a |
|
325 | adding a | |
326 | adding b |
|
326 | adding b | |
327 | adding b1 |
|
327 | adding b1 | |
328 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
328 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved | |
329 | adding c |
|
329 | adding c | |
330 | created new head |
|
330 | created new head | |
331 | adding c1 |
|
331 | adding c1 | |
332 | == bundling via incoming |
|
332 | == bundling via incoming | |
333 | comparing with . |
|
333 | comparing with . | |
334 | searching for changes |
|
334 | searching for changes | |
335 | d2ae7f538514cd87c17547b0de4cea71fe1af9fb |
|
335 | d2ae7f538514cd87c17547b0de4cea71fe1af9fb | |
336 | 5ece8e77363e2b5269e27c66828b72da29e4341a |
|
336 | 5ece8e77363e2b5269e27c66828b72da29e4341a | |
337 | == bundling |
|
337 | == bundling | |
338 | searching for changes |
|
338 | searching for changes | |
339 | common changesets up to c0025332f9ed |
|
339 | common changesets up to c0025332f9ed | |
340 | 2 changesets found |
|
340 | 2 changesets found | |
341 | list of changesets: |
|
341 | list of changesets: | |
342 | d2ae7f538514cd87c17547b0de4cea71fe1af9fb |
|
342 | d2ae7f538514cd87c17547b0de4cea71fe1af9fb | |
343 | 5ece8e77363e2b5269e27c66828b72da29e4341a |
|
343 | 5ece8e77363e2b5269e27c66828b72da29e4341a | |
|
344 | bundle changes: 0 chunks | |||
|
345 | bundle changes: 1 chunks | |||
|
346 | bundle changes: 2 chunks | |||
|
347 | bundle changes: 3 chunks | |||
|
348 | bundle changes: 4 chunks | |||
|
349 | bundle changes: 5 chunks | |||
|
350 | bundle changes: 6 chunks | |||
|
351 | bundle manifests: 0 chunks | |||
|
352 | bundle manifests: 1 chunks | |||
|
353 | bundle manifests: 2 chunks | |||
|
354 | bundle manifests: 3 chunks | |||
|
355 | bundle manifests: 4 chunks | |||
|
356 | bundle manifests: 5 chunks | |||
|
357 | bundle manifests: 6 chunks | |||
|
358 | bundle files: b 0 chunks | |||
|
359 | bundle files: b 1 chunks | |||
|
360 | bundle files: b 2 chunks | |||
|
361 | bundle files: b 3 chunks | |||
|
362 | bundle files: b1 4 chunks | |||
|
363 | bundle files: b1 5 chunks | |||
|
364 | bundle files: b1 6 chunks | |||
|
365 | bundle files: b1 7 chunks |
General Comments 0
You need to be logged in to leave comments.
Login now