Show More
@@ -1,783 +1,800 b'' | |||
|
1 | 1 | # dirstate.py - working directory tracking for mercurial |
|
2 | 2 | # |
|
3 | 3 | # Copyright 2005-2007 Matt Mackall <mpm@selenic.com> |
|
4 | 4 | # |
|
5 | 5 | # This software may be used and distributed according to the terms of the |
|
6 | 6 | # GNU General Public License version 2 or any later version. |
|
7 | 7 | import errno |
|
8 | 8 | |
|
9 | 9 | from node import nullid |
|
10 | 10 | from i18n import _ |
|
11 | 11 | import scmutil, util, ignore, osutil, parsers, encoding |
|
12 | 12 | import os, stat, errno |
|
13 | 13 | |
|
14 | 14 | propertycache = util.propertycache |
|
15 | 15 | filecache = scmutil.filecache |
|
16 | 16 | _rangemask = 0x7fffffff |
|
17 | 17 | |
|
18 | 18 | class repocache(filecache): |
|
19 | 19 | """filecache for files in .hg/""" |
|
20 | 20 | def join(self, obj, fname): |
|
21 | 21 | return obj._opener.join(fname) |
|
22 | 22 | |
|
23 | 23 | class rootcache(filecache): |
|
24 | 24 | """filecache for files in the repository root""" |
|
25 | 25 | def join(self, obj, fname): |
|
26 | 26 | return obj._join(fname) |
|
27 | 27 | |
|
28 | 28 | def _finddirs(path): |
|
29 | 29 | pos = path.rfind('/') |
|
30 | 30 | while pos != -1: |
|
31 | 31 | yield path[:pos] |
|
32 | 32 | pos = path.rfind('/', 0, pos) |
|
33 | 33 | |
|
34 | 34 | def _incdirs(dirs, path): |
|
35 | 35 | for base in _finddirs(path): |
|
36 | 36 | if base in dirs: |
|
37 | 37 | dirs[base] += 1 |
|
38 | 38 | return |
|
39 | 39 | dirs[base] = 1 |
|
40 | 40 | |
|
41 | 41 | def _decdirs(dirs, path): |
|
42 | 42 | for base in _finddirs(path): |
|
43 | 43 | if dirs[base] > 1: |
|
44 | 44 | dirs[base] -= 1 |
|
45 | 45 | return |
|
46 | 46 | del dirs[base] |
|
47 | 47 | |
|
48 | 48 | class dirstate(object): |
|
49 | 49 | |
|
50 | 50 | def __init__(self, opener, ui, root, validate): |
|
51 | 51 | '''Create a new dirstate object. |
|
52 | 52 | |
|
53 | 53 | opener is an open()-like callable that can be used to open the |
|
54 | 54 | dirstate file; root is the root of the directory tracked by |
|
55 | 55 | the dirstate. |
|
56 | 56 | ''' |
|
57 | 57 | self._opener = opener |
|
58 | 58 | self._validate = validate |
|
59 | 59 | self._root = root |
|
60 | 60 | self._rootdir = os.path.join(root, '') |
|
61 | 61 | self._dirty = False |
|
62 | 62 | self._dirtypl = False |
|
63 | 63 | self._lastnormaltime = 0 |
|
64 | 64 | self._ui = ui |
|
65 | 65 | self._filecache = {} |
|
66 | 66 | |
|
67 | 67 | @propertycache |
|
68 | 68 | def _map(self): |
|
69 | 69 | '''Return the dirstate contents as a map from filename to |
|
70 | 70 | (state, mode, size, time).''' |
|
71 | 71 | self._read() |
|
72 | 72 | return self._map |
|
73 | 73 | |
|
74 | 74 | @propertycache |
|
75 | 75 | def _copymap(self): |
|
76 | 76 | self._read() |
|
77 | 77 | return self._copymap |
|
78 | 78 | |
|
79 | 79 | @propertycache |
|
80 | 80 | def _foldmap(self): |
|
81 | 81 | f = {} |
|
82 | 82 | for name in self._map: |
|
83 | 83 | f[util.normcase(name)] = name |
|
84 | 84 | for name in self._dirs: |
|
85 | 85 | f[util.normcase(name)] = name |
|
86 | 86 | f['.'] = '.' # prevents useless util.fspath() invocation |
|
87 | 87 | return f |
|
88 | 88 | |
|
89 | 89 | @repocache('branch') |
|
90 | 90 | def _branch(self): |
|
91 | 91 | try: |
|
92 | 92 | return self._opener.read("branch").strip() or "default" |
|
93 | 93 | except IOError, inst: |
|
94 | 94 | if inst.errno != errno.ENOENT: |
|
95 | 95 | raise |
|
96 | 96 | return "default" |
|
97 | 97 | |
|
98 | 98 | @propertycache |
|
99 | 99 | def _pl(self): |
|
100 | 100 | try: |
|
101 | 101 | fp = self._opener("dirstate") |
|
102 | 102 | st = fp.read(40) |
|
103 | 103 | fp.close() |
|
104 | 104 | l = len(st) |
|
105 | 105 | if l == 40: |
|
106 | 106 | return st[:20], st[20:40] |
|
107 | 107 | elif l > 0 and l < 40: |
|
108 | 108 | raise util.Abort(_('working directory state appears damaged!')) |
|
109 | 109 | except IOError, err: |
|
110 | 110 | if err.errno != errno.ENOENT: |
|
111 | 111 | raise |
|
112 | 112 | return [nullid, nullid] |
|
113 | 113 | |
|
114 | 114 | @propertycache |
|
115 | 115 | def _dirs(self): |
|
116 | 116 | dirs = {} |
|
117 | 117 | for f, s in self._map.iteritems(): |
|
118 | 118 | if s[0] != 'r': |
|
119 | 119 | _incdirs(dirs, f) |
|
120 | 120 | return dirs |
|
121 | 121 | |
|
122 | 122 | def dirs(self): |
|
123 | 123 | return self._dirs |
|
124 | 124 | |
|
125 | 125 | @rootcache('.hgignore') |
|
126 | 126 | def _ignore(self): |
|
127 | 127 | files = [self._join('.hgignore')] |
|
128 | 128 | for name, path in self._ui.configitems("ui"): |
|
129 | 129 | if name == 'ignore' or name.startswith('ignore.'): |
|
130 | 130 | files.append(util.expandpath(path)) |
|
131 | 131 | return ignore.ignore(self._root, files, self._ui.warn) |
|
132 | 132 | |
|
133 | 133 | @propertycache |
|
134 | 134 | def _slash(self): |
|
135 | 135 | return self._ui.configbool('ui', 'slash') and os.sep != '/' |
|
136 | 136 | |
|
137 | 137 | @propertycache |
|
138 | 138 | def _checklink(self): |
|
139 | 139 | return util.checklink(self._root) |
|
140 | 140 | |
|
141 | 141 | @propertycache |
|
142 | 142 | def _checkexec(self): |
|
143 | 143 | return util.checkexec(self._root) |
|
144 | 144 | |
|
145 | 145 | @propertycache |
|
146 | 146 | def _checkcase(self): |
|
147 | 147 | return not util.checkcase(self._join('.hg')) |
|
148 | 148 | |
|
149 | 149 | def _join(self, f): |
|
150 | 150 | # much faster than os.path.join() |
|
151 | 151 | # it's safe because f is always a relative path |
|
152 | 152 | return self._rootdir + f |
|
153 | 153 | |
|
154 | 154 | def flagfunc(self, buildfallback): |
|
155 | 155 | if self._checklink and self._checkexec: |
|
156 | 156 | def f(x): |
|
157 | 157 | p = self._join(x) |
|
158 | 158 | if os.path.islink(p): |
|
159 | 159 | return 'l' |
|
160 | 160 | if util.isexec(p): |
|
161 | 161 | return 'x' |
|
162 | 162 | return '' |
|
163 | 163 | return f |
|
164 | 164 | |
|
165 | 165 | fallback = buildfallback() |
|
166 | 166 | if self._checklink: |
|
167 | 167 | def f(x): |
|
168 | 168 | if os.path.islink(self._join(x)): |
|
169 | 169 | return 'l' |
|
170 | 170 | if 'x' in fallback(x): |
|
171 | 171 | return 'x' |
|
172 | 172 | return '' |
|
173 | 173 | return f |
|
174 | 174 | if self._checkexec: |
|
175 | 175 | def f(x): |
|
176 | 176 | if 'l' in fallback(x): |
|
177 | 177 | return 'l' |
|
178 | 178 | if util.isexec(self._join(x)): |
|
179 | 179 | return 'x' |
|
180 | 180 | return '' |
|
181 | 181 | return f |
|
182 | 182 | else: |
|
183 | 183 | return fallback |
|
184 | 184 | |
|
185 | 185 | def getcwd(self): |
|
186 | 186 | cwd = os.getcwd() |
|
187 | 187 | if cwd == self._root: |
|
188 | 188 | return '' |
|
189 | 189 | # self._root ends with a path separator if self._root is '/' or 'C:\' |
|
190 | 190 | rootsep = self._root |
|
191 | 191 | if not util.endswithsep(rootsep): |
|
192 | 192 | rootsep += os.sep |
|
193 | 193 | if cwd.startswith(rootsep): |
|
194 | 194 | return cwd[len(rootsep):] |
|
195 | 195 | else: |
|
196 | 196 | # we're outside the repo. return an absolute path. |
|
197 | 197 | return cwd |
|
198 | 198 | |
|
199 | 199 | def pathto(self, f, cwd=None): |
|
200 | 200 | if cwd is None: |
|
201 | 201 | cwd = self.getcwd() |
|
202 | 202 | path = util.pathto(self._root, cwd, f) |
|
203 | 203 | if self._slash: |
|
204 | 204 | return util.normpath(path) |
|
205 | 205 | return path |
|
206 | 206 | |
|
207 | 207 | def __getitem__(self, key): |
|
208 | 208 | '''Return the current state of key (a filename) in the dirstate. |
|
209 | 209 | |
|
210 | 210 | States are: |
|
211 | 211 | n normal |
|
212 | 212 | m needs merging |
|
213 | 213 | r marked for removal |
|
214 | 214 | a marked for addition |
|
215 | 215 | ? not tracked |
|
216 | 216 | ''' |
|
217 | 217 | return self._map.get(key, ("?",))[0] |
|
218 | 218 | |
|
219 | 219 | def __contains__(self, key): |
|
220 | 220 | return key in self._map |
|
221 | 221 | |
|
222 | 222 | def __iter__(self): |
|
223 | 223 | for x in sorted(self._map): |
|
224 | 224 | yield x |
|
225 | 225 | |
|
226 | 226 | def parents(self): |
|
227 | 227 | return [self._validate(p) for p in self._pl] |
|
228 | 228 | |
|
229 | 229 | def p1(self): |
|
230 | 230 | return self._validate(self._pl[0]) |
|
231 | 231 | |
|
232 | 232 | def p2(self): |
|
233 | 233 | return self._validate(self._pl[1]) |
|
234 | 234 | |
|
235 | 235 | def branch(self): |
|
236 | 236 | return encoding.tolocal(self._branch) |
|
237 | 237 | |
|
238 | 238 | def setparents(self, p1, p2=nullid): |
|
239 | 239 | """Set dirstate parents to p1 and p2. |
|
240 | 240 | |
|
241 | 241 | When moving from two parents to one, 'm' merged entries a |
|
242 | 242 | adjusted to normal and previous copy records discarded and |
|
243 | 243 | returned by the call. |
|
244 | 244 | |
|
245 | 245 | See localrepo.setparents() |
|
246 | 246 | """ |
|
247 | 247 | self._dirty = self._dirtypl = True |
|
248 | 248 | oldp2 = self._pl[1] |
|
249 | 249 | self._pl = p1, p2 |
|
250 | 250 | copies = {} |
|
251 | 251 | if oldp2 != nullid and p2 == nullid: |
|
252 | 252 | # Discard 'm' markers when moving away from a merge state |
|
253 | 253 | for f, s in self._map.iteritems(): |
|
254 | 254 | if s[0] == 'm': |
|
255 | 255 | if f in self._copymap: |
|
256 | 256 | copies[f] = self._copymap[f] |
|
257 | 257 | self.normallookup(f) |
|
258 | 258 | return copies |
|
259 | 259 | |
|
260 | 260 | def setbranch(self, branch): |
|
261 | 261 | self._branch = encoding.fromlocal(branch) |
|
262 | 262 | f = self._opener('branch', 'w', atomictemp=True) |
|
263 | 263 | try: |
|
264 | 264 | f.write(self._branch + '\n') |
|
265 | 265 | f.close() |
|
266 | 266 | |
|
267 | 267 | # make sure filecache has the correct stat info for _branch after |
|
268 | 268 | # replacing the underlying file |
|
269 | 269 | ce = self._filecache['_branch'] |
|
270 | 270 | if ce: |
|
271 | 271 | ce.refresh() |
|
272 | 272 | except: # re-raises |
|
273 | 273 | f.discard() |
|
274 | 274 | raise |
|
275 | 275 | |
|
276 | 276 | def _read(self): |
|
277 | 277 | self._map = {} |
|
278 | 278 | self._copymap = {} |
|
279 | 279 | try: |
|
280 | 280 | st = self._opener.read("dirstate") |
|
281 | 281 | except IOError, err: |
|
282 | 282 | if err.errno != errno.ENOENT: |
|
283 | 283 | raise |
|
284 | 284 | return |
|
285 | 285 | if not st: |
|
286 | 286 | return |
|
287 | 287 | |
|
288 | 288 | p = parsers.parse_dirstate(self._map, self._copymap, st) |
|
289 | 289 | if not self._dirtypl: |
|
290 | 290 | self._pl = p |
|
291 | 291 | |
|
292 | 292 | def invalidate(self): |
|
293 | 293 | for a in ("_map", "_copymap", "_foldmap", "_branch", "_pl", "_dirs", |
|
294 | 294 | "_ignore"): |
|
295 | 295 | if a in self.__dict__: |
|
296 | 296 | delattr(self, a) |
|
297 | 297 | self._lastnormaltime = 0 |
|
298 | 298 | self._dirty = False |
|
299 | 299 | |
|
300 | 300 | def copy(self, source, dest): |
|
301 | 301 | """Mark dest as a copy of source. Unmark dest if source is None.""" |
|
302 | 302 | if source == dest: |
|
303 | 303 | return |
|
304 | 304 | self._dirty = True |
|
305 | 305 | if source is not None: |
|
306 | 306 | self._copymap[dest] = source |
|
307 | 307 | elif dest in self._copymap: |
|
308 | 308 | del self._copymap[dest] |
|
309 | 309 | |
|
310 | 310 | def copied(self, file): |
|
311 | 311 | return self._copymap.get(file, None) |
|
312 | 312 | |
|
313 | 313 | def copies(self): |
|
314 | 314 | return self._copymap |
|
315 | 315 | |
|
316 | 316 | def _droppath(self, f): |
|
317 | 317 | if self[f] not in "?r" and "_dirs" in self.__dict__: |
|
318 | 318 | _decdirs(self._dirs, f) |
|
319 | 319 | |
|
320 | 320 | def _addpath(self, f, state, mode, size, mtime): |
|
321 | 321 | oldstate = self[f] |
|
322 | 322 | if state == 'a' or oldstate == 'r': |
|
323 | 323 | scmutil.checkfilename(f) |
|
324 | 324 | if f in self._dirs: |
|
325 | 325 | raise util.Abort(_('directory %r already in dirstate') % f) |
|
326 | 326 | # shadows |
|
327 | 327 | for d in _finddirs(f): |
|
328 | 328 | if d in self._dirs: |
|
329 | 329 | break |
|
330 | 330 | if d in self._map and self[d] != 'r': |
|
331 | 331 | raise util.Abort( |
|
332 | 332 | _('file %r in dirstate clashes with %r') % (d, f)) |
|
333 | 333 | if oldstate in "?r" and "_dirs" in self.__dict__: |
|
334 | 334 | _incdirs(self._dirs, f) |
|
335 | 335 | self._dirty = True |
|
336 | 336 | self._map[f] = (state, mode, size, mtime) |
|
337 | 337 | |
|
338 | 338 | def normal(self, f): |
|
339 | 339 | '''Mark a file normal and clean.''' |
|
340 | 340 | s = os.lstat(self._join(f)) |
|
341 | 341 | mtime = int(s.st_mtime) |
|
342 | 342 | self._addpath(f, 'n', s.st_mode, |
|
343 | 343 | s.st_size & _rangemask, mtime & _rangemask) |
|
344 | 344 | if f in self._copymap: |
|
345 | 345 | del self._copymap[f] |
|
346 | 346 | if mtime > self._lastnormaltime: |
|
347 | 347 | # Remember the most recent modification timeslot for status(), |
|
348 | 348 | # to make sure we won't miss future size-preserving file content |
|
349 | 349 | # modifications that happen within the same timeslot. |
|
350 | 350 | self._lastnormaltime = mtime |
|
351 | 351 | |
|
352 | 352 | def normallookup(self, f): |
|
353 | 353 | '''Mark a file normal, but possibly dirty.''' |
|
354 | 354 | if self._pl[1] != nullid and f in self._map: |
|
355 | 355 | # if there is a merge going on and the file was either |
|
356 | 356 | # in state 'm' (-1) or coming from other parent (-2) before |
|
357 | 357 | # being removed, restore that state. |
|
358 | 358 | entry = self._map[f] |
|
359 | 359 | if entry[0] == 'r' and entry[2] in (-1, -2): |
|
360 | 360 | source = self._copymap.get(f) |
|
361 | 361 | if entry[2] == -1: |
|
362 | 362 | self.merge(f) |
|
363 | 363 | elif entry[2] == -2: |
|
364 | 364 | self.otherparent(f) |
|
365 | 365 | if source: |
|
366 | 366 | self.copy(source, f) |
|
367 | 367 | return |
|
368 | 368 | if entry[0] == 'm' or entry[0] == 'n' and entry[2] == -2: |
|
369 | 369 | return |
|
370 | 370 | self._addpath(f, 'n', 0, -1, -1) |
|
371 | 371 | if f in self._copymap: |
|
372 | 372 | del self._copymap[f] |
|
373 | 373 | |
|
374 | 374 | def otherparent(self, f): |
|
375 | 375 | '''Mark as coming from the other parent, always dirty.''' |
|
376 | 376 | if self._pl[1] == nullid: |
|
377 | 377 | raise util.Abort(_("setting %r to other parent " |
|
378 | 378 | "only allowed in merges") % f) |
|
379 | 379 | self._addpath(f, 'n', 0, -2, -1) |
|
380 | 380 | if f in self._copymap: |
|
381 | 381 | del self._copymap[f] |
|
382 | 382 | |
|
383 | 383 | def add(self, f): |
|
384 | 384 | '''Mark a file added.''' |
|
385 | 385 | self._addpath(f, 'a', 0, -1, -1) |
|
386 | 386 | if f in self._copymap: |
|
387 | 387 | del self._copymap[f] |
|
388 | 388 | |
|
389 | 389 | def remove(self, f): |
|
390 | 390 | '''Mark a file removed.''' |
|
391 | 391 | self._dirty = True |
|
392 | 392 | self._droppath(f) |
|
393 | 393 | size = 0 |
|
394 | 394 | if self._pl[1] != nullid and f in self._map: |
|
395 | 395 | # backup the previous state |
|
396 | 396 | entry = self._map[f] |
|
397 | 397 | if entry[0] == 'm': # merge |
|
398 | 398 | size = -1 |
|
399 | 399 | elif entry[0] == 'n' and entry[2] == -2: # other parent |
|
400 | 400 | size = -2 |
|
401 | 401 | self._map[f] = ('r', 0, size, 0) |
|
402 | 402 | if size == 0 and f in self._copymap: |
|
403 | 403 | del self._copymap[f] |
|
404 | 404 | |
|
405 | 405 | def merge(self, f): |
|
406 | 406 | '''Mark a file merged.''' |
|
407 | 407 | if self._pl[1] == nullid: |
|
408 | 408 | return self.normallookup(f) |
|
409 | 409 | s = os.lstat(self._join(f)) |
|
410 | 410 | self._addpath(f, 'm', s.st_mode, |
|
411 | 411 | s.st_size & _rangemask, int(s.st_mtime) & _rangemask) |
|
412 | 412 | if f in self._copymap: |
|
413 | 413 | del self._copymap[f] |
|
414 | 414 | |
|
415 | 415 | def drop(self, f): |
|
416 | 416 | '''Drop a file from the dirstate''' |
|
417 | 417 | if f in self._map: |
|
418 | 418 | self._dirty = True |
|
419 | 419 | self._droppath(f) |
|
420 | 420 | del self._map[f] |
|
421 | 421 | |
|
422 | 422 | def _normalize(self, path, isknown, ignoremissing=False, exists=None): |
|
423 | 423 | normed = util.normcase(path) |
|
424 | 424 | folded = self._foldmap.get(normed, None) |
|
425 | 425 | if folded is None: |
|
426 | 426 | if isknown: |
|
427 | 427 | folded = path |
|
428 | 428 | else: |
|
429 | 429 | if exists is None: |
|
430 | 430 | exists = os.path.lexists(os.path.join(self._root, path)) |
|
431 | 431 | if not exists: |
|
432 | 432 | # Maybe a path component exists |
|
433 | 433 | if not ignoremissing and '/' in path: |
|
434 | 434 | d, f = path.rsplit('/', 1) |
|
435 | 435 | d = self._normalize(d, isknown, ignoremissing, None) |
|
436 | 436 | folded = d + "/" + f |
|
437 | 437 | else: |
|
438 | 438 | # No path components, preserve original case |
|
439 | 439 | folded = path |
|
440 | 440 | else: |
|
441 | 441 | # recursively normalize leading directory components |
|
442 | 442 | # against dirstate |
|
443 | 443 | if '/' in normed: |
|
444 | 444 | d, f = normed.rsplit('/', 1) |
|
445 | 445 | d = self._normalize(d, isknown, ignoremissing, True) |
|
446 | 446 | r = self._root + "/" + d |
|
447 | 447 | folded = d + "/" + util.fspath(f, r) |
|
448 | 448 | else: |
|
449 | 449 | folded = util.fspath(normed, self._root) |
|
450 | 450 | self._foldmap[normed] = folded |
|
451 | 451 | |
|
452 | 452 | return folded |
|
453 | 453 | |
|
454 | 454 | def normalize(self, path, isknown=False, ignoremissing=False): |
|
455 | 455 | ''' |
|
456 | 456 | normalize the case of a pathname when on a casefolding filesystem |
|
457 | 457 | |
|
458 | 458 | isknown specifies whether the filename came from walking the |
|
459 | 459 | disk, to avoid extra filesystem access. |
|
460 | 460 | |
|
461 | 461 | If ignoremissing is True, missing path are returned |
|
462 | 462 | unchanged. Otherwise, we try harder to normalize possibly |
|
463 | 463 | existing path components. |
|
464 | 464 | |
|
465 | 465 | The normalized case is determined based on the following precedence: |
|
466 | 466 | |
|
467 | 467 | - version of name already stored in the dirstate |
|
468 | 468 | - version of name stored on disk |
|
469 | 469 | - version provided via command arguments |
|
470 | 470 | ''' |
|
471 | 471 | |
|
472 | 472 | if self._checkcase: |
|
473 | 473 | return self._normalize(path, isknown, ignoremissing) |
|
474 | 474 | return path |
|
475 | 475 | |
|
476 | 476 | def clear(self): |
|
477 | 477 | self._map = {} |
|
478 | 478 | if "_dirs" in self.__dict__: |
|
479 | 479 | delattr(self, "_dirs") |
|
480 | 480 | self._copymap = {} |
|
481 | 481 | self._pl = [nullid, nullid] |
|
482 | 482 | self._lastnormaltime = 0 |
|
483 | 483 | self._dirty = True |
|
484 | 484 | |
|
485 | 485 | def rebuild(self, parent, files): |
|
486 | 486 | self.clear() |
|
487 | 487 | for f in files: |
|
488 | 488 | if 'x' in files.flags(f): |
|
489 | 489 | self._map[f] = ('n', 0777, -1, 0) |
|
490 | 490 | else: |
|
491 | 491 | self._map[f] = ('n', 0666, -1, 0) |
|
492 | 492 | self._pl = (parent, nullid) |
|
493 | 493 | self._dirty = True |
|
494 | 494 | |
|
495 | 495 | def write(self): |
|
496 | 496 | if not self._dirty: |
|
497 | 497 | return |
|
498 | 498 | st = self._opener("dirstate", "w", atomictemp=True) |
|
499 | 499 | |
|
500 | 500 | def finish(s): |
|
501 | 501 | st.write(s) |
|
502 | 502 | st.close() |
|
503 | 503 | self._lastnormaltime = 0 |
|
504 | 504 | self._dirty = self._dirtypl = False |
|
505 | 505 | |
|
506 | 506 | # use the modification time of the newly created temporary file as the |
|
507 | 507 | # filesystem's notion of 'now' |
|
508 | 508 | now = util.fstat(st).st_mtime |
|
509 | 509 | finish(parsers.pack_dirstate(self._map, self._copymap, self._pl, now)) |
|
510 | 510 | |
|
511 | 511 | def _dirignore(self, f): |
|
512 | 512 | if f == '.': |
|
513 | 513 | return False |
|
514 | 514 | if self._ignore(f): |
|
515 | 515 | return True |
|
516 | 516 | for p in _finddirs(f): |
|
517 | 517 | if self._ignore(p): |
|
518 | 518 | return True |
|
519 | 519 | return False |
|
520 | 520 | |
|
521 | 521 | def walk(self, match, subrepos, unknown, ignored): |
|
522 | 522 | ''' |
|
523 | 523 | Walk recursively through the directory tree, finding all files |
|
524 | 524 | matched by match. |
|
525 | 525 | |
|
526 | 526 | Return a dict mapping filename to stat-like object (either |
|
527 | 527 | mercurial.osutil.stat instance or return value of os.stat()). |
|
528 | 528 | ''' |
|
529 | 529 | |
|
530 | 530 | def fwarn(f, msg): |
|
531 | 531 | self._ui.warn('%s: %s\n' % (self.pathto(f), msg)) |
|
532 | 532 | return False |
|
533 | 533 | |
|
534 | 534 | def badtype(mode): |
|
535 | 535 | kind = _('unknown') |
|
536 | 536 | if stat.S_ISCHR(mode): |
|
537 | 537 | kind = _('character device') |
|
538 | 538 | elif stat.S_ISBLK(mode): |
|
539 | 539 | kind = _('block device') |
|
540 | 540 | elif stat.S_ISFIFO(mode): |
|
541 | 541 | kind = _('fifo') |
|
542 | 542 | elif stat.S_ISSOCK(mode): |
|
543 | 543 | kind = _('socket') |
|
544 | 544 | elif stat.S_ISDIR(mode): |
|
545 | 545 | kind = _('directory') |
|
546 | 546 | return _('unsupported file type (type is %s)') % kind |
|
547 | 547 | |
|
548 | 548 | ignore = self._ignore |
|
549 | 549 | dirignore = self._dirignore |
|
550 | 550 | if ignored: |
|
551 | 551 | ignore = util.never |
|
552 | 552 | dirignore = util.never |
|
553 | 553 | elif not unknown: |
|
554 | 554 | # if unknown and ignored are False, skip step 2 |
|
555 | 555 | ignore = util.always |
|
556 | 556 | dirignore = util.always |
|
557 | 557 | |
|
558 | 558 | matchfn = match.matchfn |
|
559 | 559 | badfn = match.bad |
|
560 | 560 | dmap = self._map |
|
561 | 561 | normpath = util.normpath |
|
562 | 562 | listdir = osutil.listdir |
|
563 | 563 | lstat = os.lstat |
|
564 | 564 | getkind = stat.S_IFMT |
|
565 | 565 | dirkind = stat.S_IFDIR |
|
566 | 566 | regkind = stat.S_IFREG |
|
567 | 567 | lnkkind = stat.S_IFLNK |
|
568 | 568 | join = self._join |
|
569 | 569 | work = [] |
|
570 | 570 | wadd = work.append |
|
571 | 571 | |
|
572 | 572 | exact = skipstep3 = False |
|
573 | 573 | if matchfn == match.exact: # match.exact |
|
574 | 574 | exact = True |
|
575 | 575 | dirignore = util.always # skip step 2 |
|
576 | 576 | elif match.files() and not match.anypats(): # match.match, no patterns |
|
577 | 577 | skipstep3 = True |
|
578 | 578 | |
|
579 | 579 | if not exact and self._checkcase: |
|
580 | 580 | normalize = self._normalize |
|
581 | 581 | skipstep3 = False |
|
582 | 582 | else: |
|
583 | 583 | normalize = None |
|
584 | 584 | |
|
585 | 585 | files = sorted(match.files()) |
|
586 | 586 | subrepos.sort() |
|
587 | 587 | i, j = 0, 0 |
|
588 | 588 | while i < len(files) and j < len(subrepos): |
|
589 | 589 | subpath = subrepos[j] + "/" |
|
590 | 590 | if files[i] < subpath: |
|
591 | 591 | i += 1 |
|
592 | 592 | continue |
|
593 | 593 | while i < len(files) and files[i].startswith(subpath): |
|
594 | 594 | del files[i] |
|
595 | 595 | j += 1 |
|
596 | 596 | |
|
597 | 597 | if not files or '.' in files: |
|
598 | 598 | files = [''] |
|
599 | 599 | results = dict.fromkeys(subrepos) |
|
600 | 600 | results['.hg'] = None |
|
601 | 601 | |
|
602 | 602 | # step 1: find all explicit files |
|
603 | 603 | for ff in files: |
|
604 | 604 | if normalize: |
|
605 | 605 | nf = normalize(normpath(ff), False, True) |
|
606 | 606 | else: |
|
607 | 607 | nf = normpath(ff) |
|
608 | 608 | if nf in results: |
|
609 | 609 | continue |
|
610 | 610 | |
|
611 | 611 | try: |
|
612 | 612 | st = lstat(join(nf)) |
|
613 | 613 | kind = getkind(st.st_mode) |
|
614 | 614 | if kind == dirkind: |
|
615 | 615 | skipstep3 = False |
|
616 | 616 | if nf in dmap: |
|
617 | 617 | #file deleted on disk but still in dirstate |
|
618 | 618 | results[nf] = None |
|
619 | 619 | match.dir(nf) |
|
620 | 620 | if not dirignore(nf): |
|
621 | 621 | wadd(nf) |
|
622 | 622 | elif kind == regkind or kind == lnkkind: |
|
623 | 623 | results[nf] = st |
|
624 | 624 | else: |
|
625 | 625 | badfn(ff, badtype(kind)) |
|
626 | 626 | if nf in dmap: |
|
627 | 627 | results[nf] = None |
|
628 | 628 | except OSError, inst: |
|
629 | 629 | if nf in dmap: # does it exactly match a file? |
|
630 | 630 | results[nf] = None |
|
631 | 631 | else: # does it match a directory? |
|
632 | 632 | prefix = nf + "/" |
|
633 | 633 | for fn in dmap: |
|
634 | 634 | if fn.startswith(prefix): |
|
635 | 635 | match.dir(nf) |
|
636 | 636 | skipstep3 = False |
|
637 | 637 | break |
|
638 | 638 | else: |
|
639 | 639 | badfn(ff, inst.strerror) |
|
640 | 640 | |
|
641 | 641 | # step 2: visit subdirectories |
|
642 | 642 | while work: |
|
643 | 643 | nd = work.pop() |
|
644 | 644 | skip = None |
|
645 | 645 | if nd == '.': |
|
646 | 646 | nd = '' |
|
647 | 647 | else: |
|
648 | 648 | skip = '.hg' |
|
649 | 649 | try: |
|
650 | 650 | entries = listdir(join(nd), stat=True, skip=skip) |
|
651 | 651 | except OSError, inst: |
|
652 | 652 | if inst.errno in (errno.EACCES, errno.ENOENT): |
|
653 | 653 | fwarn(nd, inst.strerror) |
|
654 | 654 | continue |
|
655 | 655 | raise |
|
656 | 656 | for f, kind, st in entries: |
|
657 | 657 | if normalize: |
|
658 | 658 | nf = normalize(nd and (nd + "/" + f) or f, True, True) |
|
659 | 659 | else: |
|
660 | 660 | nf = nd and (nd + "/" + f) or f |
|
661 | 661 | if nf not in results: |
|
662 | 662 | if kind == dirkind: |
|
663 | 663 | if not ignore(nf): |
|
664 | 664 | match.dir(nf) |
|
665 | 665 | wadd(nf) |
|
666 | 666 | if nf in dmap and matchfn(nf): |
|
667 | 667 | results[nf] = None |
|
668 | 668 | elif kind == regkind or kind == lnkkind: |
|
669 | 669 | if nf in dmap: |
|
670 | 670 | if matchfn(nf): |
|
671 | 671 | results[nf] = st |
|
672 | 672 | elif matchfn(nf) and not ignore(nf): |
|
673 | 673 | results[nf] = st |
|
674 | 674 | elif nf in dmap and matchfn(nf): |
|
675 | 675 | results[nf] = None |
|
676 | 676 | |
|
677 | 677 | # step 3: report unseen items in the dmap hash |
|
678 | 678 | if not skipstep3 and not exact: |
|
679 | 679 | visit = sorted([f for f in dmap if f not in results and matchfn(f)]) |
|
680 | nf = iter(visit).next | |
|
681 | for st in util.statfiles([join(i) for i in visit]): | |
|
682 | results[nf()] = st | |
|
680 | if unknown: | |
|
681 | # unknown == True means we walked the full directory tree above. | |
|
682 | # So if a file is not seen it was either a) not matching matchfn | |
|
683 | # b) ignored, c) missing, or d) under a symlink directory. | |
|
684 | audit_path = scmutil.pathauditor(self._root) | |
|
685 | ||
|
686 | for nf in iter(visit): | |
|
687 | # Report ignored items in the dmap as long as they are not | |
|
688 | # under a symlink directory. | |
|
689 | if ignore(nf) and audit_path.check(nf): | |
|
690 | results[nf] = util.statfiles([join(nf)])[0] | |
|
691 | else: | |
|
692 | # It's either missing or under a symlink directory | |
|
693 | results[nf] = None | |
|
694 | else: | |
|
695 | # We may not have walked the full directory tree above, | |
|
696 | # so stat everything we missed. | |
|
697 | nf = iter(visit).next | |
|
698 | for st in util.statfiles([join(i) for i in visit]): | |
|
699 | results[nf()] = st | |
|
683 | 700 | for s in subrepos: |
|
684 | 701 | del results[s] |
|
685 | 702 | del results['.hg'] |
|
686 | 703 | return results |
|
687 | 704 | |
|
688 | 705 | def status(self, match, subrepos, ignored, clean, unknown): |
|
689 | 706 | '''Determine the status of the working copy relative to the |
|
690 | 707 | dirstate and return a tuple of lists (unsure, modified, added, |
|
691 | 708 | removed, deleted, unknown, ignored, clean), where: |
|
692 | 709 | |
|
693 | 710 | unsure: |
|
694 | 711 | files that might have been modified since the dirstate was |
|
695 | 712 | written, but need to be read to be sure (size is the same |
|
696 | 713 | but mtime differs) |
|
697 | 714 | modified: |
|
698 | 715 | files that have definitely been modified since the dirstate |
|
699 | 716 | was written (different size or mode) |
|
700 | 717 | added: |
|
701 | 718 | files that have been explicitly added with hg add |
|
702 | 719 | removed: |
|
703 | 720 | files that have been explicitly removed with hg remove |
|
704 | 721 | deleted: |
|
705 | 722 | files that have been deleted through other means ("missing") |
|
706 | 723 | unknown: |
|
707 | 724 | files not in the dirstate that are not ignored |
|
708 | 725 | ignored: |
|
709 | 726 | files not in the dirstate that are ignored |
|
710 | 727 | (by _dirignore()) |
|
711 | 728 | clean: |
|
712 | 729 | files that have definitely not been modified since the |
|
713 | 730 | dirstate was written |
|
714 | 731 | ''' |
|
715 | 732 | listignored, listclean, listunknown = ignored, clean, unknown |
|
716 | 733 | lookup, modified, added, unknown, ignored = [], [], [], [], [] |
|
717 | 734 | removed, deleted, clean = [], [], [] |
|
718 | 735 | |
|
719 | 736 | dmap = self._map |
|
720 | 737 | ladd = lookup.append # aka "unsure" |
|
721 | 738 | madd = modified.append |
|
722 | 739 | aadd = added.append |
|
723 | 740 | uadd = unknown.append |
|
724 | 741 | iadd = ignored.append |
|
725 | 742 | radd = removed.append |
|
726 | 743 | dadd = deleted.append |
|
727 | 744 | cadd = clean.append |
|
728 | 745 | mexact = match.exact |
|
729 | 746 | dirignore = self._dirignore |
|
730 | 747 | checkexec = self._checkexec |
|
731 | 748 | checklink = self._checklink |
|
732 | 749 | copymap = self._copymap |
|
733 | 750 | lastnormaltime = self._lastnormaltime |
|
734 | 751 | |
|
735 | 752 | lnkkind = stat.S_IFLNK |
|
736 | 753 | |
|
737 | 754 | for fn, st in self.walk(match, subrepos, listunknown, |
|
738 | 755 | listignored).iteritems(): |
|
739 | 756 | if fn not in dmap: |
|
740 | 757 | if (listignored or mexact(fn)) and dirignore(fn): |
|
741 | 758 | if listignored: |
|
742 | 759 | iadd(fn) |
|
743 | 760 | elif listunknown: |
|
744 | 761 | uadd(fn) |
|
745 | 762 | continue |
|
746 | 763 | |
|
747 | 764 | state, mode, size, time = dmap[fn] |
|
748 | 765 | |
|
749 | 766 | if not st and state in "nma": |
|
750 | 767 | dadd(fn) |
|
751 | 768 | elif state == 'n': |
|
752 | 769 | # The "mode & lnkkind != lnkkind or self._checklink" |
|
753 | 770 | # lines are an expansion of "islink => checklink" |
|
754 | 771 | # where islink means "is this a link?" and checklink |
|
755 | 772 | # means "can we check links?". |
|
756 | 773 | mtime = int(st.st_mtime) |
|
757 | 774 | if (size >= 0 and |
|
758 | 775 | ((size != st.st_size and size != st.st_size & _rangemask) |
|
759 | 776 | or ((mode ^ st.st_mode) & 0100 and checkexec)) |
|
760 | 777 | and (mode & lnkkind != lnkkind or checklink) |
|
761 | 778 | or size == -2 # other parent |
|
762 | 779 | or fn in copymap): |
|
763 | 780 | madd(fn) |
|
764 | 781 | elif ((time != mtime and time != mtime & _rangemask) |
|
765 | 782 | and (mode & lnkkind != lnkkind or checklink)): |
|
766 | 783 | ladd(fn) |
|
767 | 784 | elif mtime == lastnormaltime: |
|
768 | 785 | # fn may have been changed in the same timeslot without |
|
769 | 786 | # changing its size. This can happen if we quickly do |
|
770 | 787 | # multiple commits in a single transaction. |
|
771 | 788 | # Force lookup, so we don't miss such a racy file change. |
|
772 | 789 | ladd(fn) |
|
773 | 790 | elif listclean: |
|
774 | 791 | cadd(fn) |
|
775 | 792 | elif state == 'm': |
|
776 | 793 | madd(fn) |
|
777 | 794 | elif state == 'a': |
|
778 | 795 | aadd(fn) |
|
779 | 796 | elif state == 'r': |
|
780 | 797 | radd(fn) |
|
781 | 798 | |
|
782 | 799 | return (lookup, modified, added, removed, deleted, unknown, ignored, |
|
783 | 800 | clean) |
@@ -1,361 +1,361 b'' | |||
|
1 | 1 | # extensions.py - extension handling for mercurial |
|
2 | 2 | # |
|
3 | 3 | # Copyright 2005-2007 Matt Mackall <mpm@selenic.com> |
|
4 | 4 | # |
|
5 | 5 | # This software may be used and distributed according to the terms of the |
|
6 | 6 | # GNU General Public License version 2 or any later version. |
|
7 | 7 | |
|
8 | 8 | import imp, os |
|
9 | 9 | import util, cmdutil, error |
|
10 | 10 | from i18n import _, gettext |
|
11 | 11 | |
|
12 | 12 | _extensions = {} |
|
13 | 13 | _order = [] |
|
14 | _ignore = ['hbisect', 'bookmarks', 'parentrevspec'] | |
|
14 | _ignore = ['hbisect', 'bookmarks', 'parentrevspec', 'interhg'] | |
|
15 | 15 | |
|
16 | 16 | def extensions(): |
|
17 | 17 | for name in _order: |
|
18 | 18 | module = _extensions[name] |
|
19 | 19 | if module: |
|
20 | 20 | yield name, module |
|
21 | 21 | |
|
22 | 22 | def find(name): |
|
23 | 23 | '''return module with given extension name''' |
|
24 | 24 | mod = None |
|
25 | 25 | try: |
|
26 | 26 | mod = _extensions[name] |
|
27 | 27 | except KeyError: |
|
28 | 28 | for k, v in _extensions.iteritems(): |
|
29 | 29 | if k.endswith('.' + name) or k.endswith('/' + name): |
|
30 | 30 | mod = v |
|
31 | 31 | break |
|
32 | 32 | if not mod: |
|
33 | 33 | raise KeyError(name) |
|
34 | 34 | return mod |
|
35 | 35 | |
|
36 | 36 | def loadpath(path, module_name): |
|
37 | 37 | module_name = module_name.replace('.', '_') |
|
38 | 38 | path = util.expandpath(path) |
|
39 | 39 | if os.path.isdir(path): |
|
40 | 40 | # module/__init__.py style |
|
41 | 41 | d, f = os.path.split(path.rstrip('/')) |
|
42 | 42 | fd, fpath, desc = imp.find_module(f, [d]) |
|
43 | 43 | return imp.load_module(module_name, fd, fpath, desc) |
|
44 | 44 | else: |
|
45 | 45 | try: |
|
46 | 46 | return imp.load_source(module_name, path) |
|
47 | 47 | except IOError, exc: |
|
48 | 48 | if not exc.filename: |
|
49 | 49 | exc.filename = path # python does not fill this |
|
50 | 50 | raise |
|
51 | 51 | |
|
52 | 52 | def load(ui, name, path): |
|
53 | 53 | # unused ui argument kept for backwards compatibility |
|
54 | 54 | if name.startswith('hgext.') or name.startswith('hgext/'): |
|
55 | 55 | shortname = name[6:] |
|
56 | 56 | else: |
|
57 | 57 | shortname = name |
|
58 | 58 | if shortname in _ignore: |
|
59 | 59 | return None |
|
60 | 60 | if shortname in _extensions: |
|
61 | 61 | return _extensions[shortname] |
|
62 | 62 | _extensions[shortname] = None |
|
63 | 63 | if path: |
|
64 | 64 | # the module will be loaded in sys.modules |
|
65 | 65 | # choose an unique name so that it doesn't |
|
66 | 66 | # conflicts with other modules |
|
67 | 67 | mod = loadpath(path, 'hgext.%s' % name) |
|
68 | 68 | else: |
|
69 | 69 | def importh(name): |
|
70 | 70 | mod = __import__(name) |
|
71 | 71 | components = name.split('.') |
|
72 | 72 | for comp in components[1:]: |
|
73 | 73 | mod = getattr(mod, comp) |
|
74 | 74 | return mod |
|
75 | 75 | try: |
|
76 | 76 | mod = importh("hgext.%s" % name) |
|
77 | 77 | except ImportError, err: |
|
78 | 78 | ui.debug('could not import hgext.%s (%s): trying %s\n' |
|
79 | 79 | % (name, err, name)) |
|
80 | 80 | mod = importh(name) |
|
81 | 81 | _extensions[shortname] = mod |
|
82 | 82 | _order.append(shortname) |
|
83 | 83 | return mod |
|
84 | 84 | |
|
85 | 85 | def loadall(ui): |
|
86 | 86 | result = ui.configitems("extensions") |
|
87 | 87 | newindex = len(_order) |
|
88 | 88 | for (name, path) in result: |
|
89 | 89 | if path: |
|
90 | 90 | if path[0] == '!': |
|
91 | 91 | continue |
|
92 | 92 | try: |
|
93 | 93 | load(ui, name, path) |
|
94 | 94 | except KeyboardInterrupt: |
|
95 | 95 | raise |
|
96 | 96 | except Exception, inst: |
|
97 | 97 | if path: |
|
98 | 98 | ui.warn(_("*** failed to import extension %s from %s: %s\n") |
|
99 | 99 | % (name, path, inst)) |
|
100 | 100 | else: |
|
101 | 101 | ui.warn(_("*** failed to import extension %s: %s\n") |
|
102 | 102 | % (name, inst)) |
|
103 | 103 | if ui.traceback(): |
|
104 | 104 | return 1 |
|
105 | 105 | |
|
106 | 106 | for name in _order[newindex:]: |
|
107 | 107 | uisetup = getattr(_extensions[name], 'uisetup', None) |
|
108 | 108 | if uisetup: |
|
109 | 109 | uisetup(ui) |
|
110 | 110 | |
|
111 | 111 | for name in _order[newindex:]: |
|
112 | 112 | extsetup = getattr(_extensions[name], 'extsetup', None) |
|
113 | 113 | if extsetup: |
|
114 | 114 | try: |
|
115 | 115 | extsetup(ui) |
|
116 | 116 | except TypeError: |
|
117 | 117 | if extsetup.func_code.co_argcount != 0: |
|
118 | 118 | raise |
|
119 | 119 | extsetup() # old extsetup with no ui argument |
|
120 | 120 | |
|
121 | 121 | def wrapcommand(table, command, wrapper): |
|
122 | 122 | '''Wrap the command named `command' in table |
|
123 | 123 | |
|
124 | 124 | Replace command in the command table with wrapper. The wrapped command will |
|
125 | 125 | be inserted into the command table specified by the table argument. |
|
126 | 126 | |
|
127 | 127 | The wrapper will be called like |
|
128 | 128 | |
|
129 | 129 | wrapper(orig, *args, **kwargs) |
|
130 | 130 | |
|
131 | 131 | where orig is the original (wrapped) function, and *args, **kwargs |
|
132 | 132 | are the arguments passed to it. |
|
133 | 133 | ''' |
|
134 | 134 | assert util.safehasattr(wrapper, '__call__') |
|
135 | 135 | aliases, entry = cmdutil.findcmd(command, table) |
|
136 | 136 | for alias, e in table.iteritems(): |
|
137 | 137 | if e is entry: |
|
138 | 138 | key = alias |
|
139 | 139 | break |
|
140 | 140 | |
|
141 | 141 | origfn = entry[0] |
|
142 | 142 | def wrap(*args, **kwargs): |
|
143 | 143 | return util.checksignature(wrapper)( |
|
144 | 144 | util.checksignature(origfn), *args, **kwargs) |
|
145 | 145 | |
|
146 | 146 | wrap.__doc__ = getattr(origfn, '__doc__') |
|
147 | 147 | wrap.__module__ = getattr(origfn, '__module__') |
|
148 | 148 | |
|
149 | 149 | newentry = list(entry) |
|
150 | 150 | newentry[0] = wrap |
|
151 | 151 | table[key] = tuple(newentry) |
|
152 | 152 | return entry |
|
153 | 153 | |
|
154 | 154 | def wrapfunction(container, funcname, wrapper): |
|
155 | 155 | '''Wrap the function named funcname in container |
|
156 | 156 | |
|
157 | 157 | Replace the funcname member in the given container with the specified |
|
158 | 158 | wrapper. The container is typically a module, class, or instance. |
|
159 | 159 | |
|
160 | 160 | The wrapper will be called like |
|
161 | 161 | |
|
162 | 162 | wrapper(orig, *args, **kwargs) |
|
163 | 163 | |
|
164 | 164 | where orig is the original (wrapped) function, and *args, **kwargs |
|
165 | 165 | are the arguments passed to it. |
|
166 | 166 | |
|
167 | 167 | Wrapping methods of the repository object is not recommended since |
|
168 | 168 | it conflicts with extensions that extend the repository by |
|
169 | 169 | subclassing. All extensions that need to extend methods of |
|
170 | 170 | localrepository should use this subclassing trick: namely, |
|
171 | 171 | reposetup() should look like |
|
172 | 172 | |
|
173 | 173 | def reposetup(ui, repo): |
|
174 | 174 | class myrepo(repo.__class__): |
|
175 | 175 | def whatever(self, *args, **kwargs): |
|
176 | 176 | [...extension stuff...] |
|
177 | 177 | super(myrepo, self).whatever(*args, **kwargs) |
|
178 | 178 | [...extension stuff...] |
|
179 | 179 | |
|
180 | 180 | repo.__class__ = myrepo |
|
181 | 181 | |
|
182 | 182 | In general, combining wrapfunction() with subclassing does not |
|
183 | 183 | work. Since you cannot control what other extensions are loaded by |
|
184 | 184 | your end users, you should play nicely with others by using the |
|
185 | 185 | subclass trick. |
|
186 | 186 | ''' |
|
187 | 187 | assert util.safehasattr(wrapper, '__call__') |
|
188 | 188 | def wrap(*args, **kwargs): |
|
189 | 189 | return wrapper(origfn, *args, **kwargs) |
|
190 | 190 | |
|
191 | 191 | origfn = getattr(container, funcname) |
|
192 | 192 | assert util.safehasattr(origfn, '__call__') |
|
193 | 193 | setattr(container, funcname, wrap) |
|
194 | 194 | return origfn |
|
195 | 195 | |
|
196 | 196 | def _disabledpaths(strip_init=False): |
|
197 | 197 | '''find paths of disabled extensions. returns a dict of {name: path} |
|
198 | 198 | removes /__init__.py from packages if strip_init is True''' |
|
199 | 199 | import hgext |
|
200 | 200 | extpath = os.path.dirname(os.path.abspath(hgext.__file__)) |
|
201 | 201 | try: # might not be a filesystem path |
|
202 | 202 | files = os.listdir(extpath) |
|
203 | 203 | except OSError: |
|
204 | 204 | return {} |
|
205 | 205 | |
|
206 | 206 | exts = {} |
|
207 | 207 | for e in files: |
|
208 | 208 | if e.endswith('.py'): |
|
209 | 209 | name = e.rsplit('.', 1)[0] |
|
210 | 210 | path = os.path.join(extpath, e) |
|
211 | 211 | else: |
|
212 | 212 | name = e |
|
213 | 213 | path = os.path.join(extpath, e, '__init__.py') |
|
214 | 214 | if not os.path.exists(path): |
|
215 | 215 | continue |
|
216 | 216 | if strip_init: |
|
217 | 217 | path = os.path.dirname(path) |
|
218 | 218 | if name in exts or name in _order or name == '__init__': |
|
219 | 219 | continue |
|
220 | 220 | exts[name] = path |
|
221 | 221 | return exts |
|
222 | 222 | |
|
223 | 223 | def _moduledoc(file): |
|
224 | 224 | '''return the top-level python documentation for the given file |
|
225 | 225 | |
|
226 | 226 | Loosely inspired by pydoc.source_synopsis(), but rewritten to |
|
227 | 227 | handle triple quotes and to return the whole text instead of just |
|
228 | 228 | the synopsis''' |
|
229 | 229 | result = [] |
|
230 | 230 | |
|
231 | 231 | line = file.readline() |
|
232 | 232 | while line[:1] == '#' or not line.strip(): |
|
233 | 233 | line = file.readline() |
|
234 | 234 | if not line: |
|
235 | 235 | break |
|
236 | 236 | |
|
237 | 237 | start = line[:3] |
|
238 | 238 | if start == '"""' or start == "'''": |
|
239 | 239 | line = line[3:] |
|
240 | 240 | while line: |
|
241 | 241 | if line.rstrip().endswith(start): |
|
242 | 242 | line = line.split(start)[0] |
|
243 | 243 | if line: |
|
244 | 244 | result.append(line) |
|
245 | 245 | break |
|
246 | 246 | elif not line: |
|
247 | 247 | return None # unmatched delimiter |
|
248 | 248 | result.append(line) |
|
249 | 249 | line = file.readline() |
|
250 | 250 | else: |
|
251 | 251 | return None |
|
252 | 252 | |
|
253 | 253 | return ''.join(result) |
|
254 | 254 | |
|
255 | 255 | def _disabledhelp(path): |
|
256 | 256 | '''retrieve help synopsis of a disabled extension (without importing)''' |
|
257 | 257 | try: |
|
258 | 258 | file = open(path) |
|
259 | 259 | except IOError: |
|
260 | 260 | return |
|
261 | 261 | else: |
|
262 | 262 | doc = _moduledoc(file) |
|
263 | 263 | file.close() |
|
264 | 264 | |
|
265 | 265 | if doc: # extracting localized synopsis |
|
266 | 266 | return gettext(doc).splitlines()[0] |
|
267 | 267 | else: |
|
268 | 268 | return _('(no help text available)') |
|
269 | 269 | |
|
270 | 270 | def disabled(): |
|
271 | 271 | '''find disabled extensions from hgext. returns a dict of {name: desc}''' |
|
272 | 272 | try: |
|
273 | 273 | from hgext import __index__ |
|
274 | 274 | return dict((name, gettext(desc)) |
|
275 | 275 | for name, desc in __index__.docs.iteritems() |
|
276 | 276 | if name not in _order) |
|
277 | 277 | except ImportError: |
|
278 | 278 | pass |
|
279 | 279 | |
|
280 | 280 | paths = _disabledpaths() |
|
281 | 281 | if not paths: |
|
282 | 282 | return {} |
|
283 | 283 | |
|
284 | 284 | exts = {} |
|
285 | 285 | for name, path in paths.iteritems(): |
|
286 | 286 | doc = _disabledhelp(path) |
|
287 | 287 | if doc: |
|
288 | 288 | exts[name] = doc |
|
289 | 289 | |
|
290 | 290 | return exts |
|
291 | 291 | |
|
292 | 292 | def disabledext(name): |
|
293 | 293 | '''find a specific disabled extension from hgext. returns desc''' |
|
294 | 294 | try: |
|
295 | 295 | from hgext import __index__ |
|
296 | 296 | if name in _order: # enabled |
|
297 | 297 | return |
|
298 | 298 | else: |
|
299 | 299 | return gettext(__index__.docs.get(name)) |
|
300 | 300 | except ImportError: |
|
301 | 301 | pass |
|
302 | 302 | |
|
303 | 303 | paths = _disabledpaths() |
|
304 | 304 | if name in paths: |
|
305 | 305 | return _disabledhelp(paths[name]) |
|
306 | 306 | |
|
307 | 307 | def disabledcmd(ui, cmd, strict=False): |
|
308 | 308 | '''import disabled extensions until cmd is found. |
|
309 | 309 | returns (cmdname, extname, module)''' |
|
310 | 310 | |
|
311 | 311 | paths = _disabledpaths(strip_init=True) |
|
312 | 312 | if not paths: |
|
313 | 313 | raise error.UnknownCommand(cmd) |
|
314 | 314 | |
|
315 | 315 | def findcmd(cmd, name, path): |
|
316 | 316 | try: |
|
317 | 317 | mod = loadpath(path, 'hgext.%s' % name) |
|
318 | 318 | except Exception: |
|
319 | 319 | return |
|
320 | 320 | try: |
|
321 | 321 | aliases, entry = cmdutil.findcmd(cmd, |
|
322 | 322 | getattr(mod, 'cmdtable', {}), strict) |
|
323 | 323 | except (error.AmbiguousCommand, error.UnknownCommand): |
|
324 | 324 | return |
|
325 | 325 | except Exception: |
|
326 | 326 | ui.warn(_('warning: error finding commands in %s\n') % path) |
|
327 | 327 | ui.traceback() |
|
328 | 328 | return |
|
329 | 329 | for c in aliases: |
|
330 | 330 | if c.startswith(cmd): |
|
331 | 331 | cmd = c |
|
332 | 332 | break |
|
333 | 333 | else: |
|
334 | 334 | cmd = aliases[0] |
|
335 | 335 | return (cmd, name, mod) |
|
336 | 336 | |
|
337 | 337 | ext = None |
|
338 | 338 | # first, search for an extension with the same name as the command |
|
339 | 339 | path = paths.pop(cmd, None) |
|
340 | 340 | if path: |
|
341 | 341 | ext = findcmd(cmd, cmd, path) |
|
342 | 342 | if not ext: |
|
343 | 343 | # otherwise, interrogate each extension until there's a match |
|
344 | 344 | for name, path in paths.iteritems(): |
|
345 | 345 | ext = findcmd(cmd, name, path) |
|
346 | 346 | if ext: |
|
347 | 347 | break |
|
348 | 348 | if ext and 'DEPRECATED' not in ext.__doc__: |
|
349 | 349 | return ext |
|
350 | 350 | |
|
351 | 351 | raise error.UnknownCommand(cmd) |
|
352 | 352 | |
|
353 | 353 | def enabled(): |
|
354 | 354 | '''return a dict of {name: desc} of extensions''' |
|
355 | 355 | exts = {} |
|
356 | 356 | for ename, ext in extensions(): |
|
357 | 357 | doc = (gettext(ext.__doc__) or _('(no help text available)')) |
|
358 | 358 | ename = ename.split('.')[-1] |
|
359 | 359 | exts[ename] = doc.splitlines()[0].strip() |
|
360 | 360 | |
|
361 | 361 | return exts |
@@ -1,1476 +1,1509 b'' | |||
|
1 | 1 | The Mercurial system uses a set of configuration files to control |
|
2 | 2 | aspects of its behavior. |
|
3 | 3 | |
|
4 | 4 | The configuration files use a simple ini-file format. A configuration |
|
5 | 5 | file consists of sections, led by a ``[section]`` header and followed |
|
6 | 6 | by ``name = value`` entries:: |
|
7 | 7 | |
|
8 | 8 | [ui] |
|
9 | 9 | username = Firstname Lastname <firstname.lastname@example.net> |
|
10 | 10 | verbose = True |
|
11 | 11 | |
|
12 | 12 | The above entries will be referred to as ``ui.username`` and |
|
13 | 13 | ``ui.verbose``, respectively. See the Syntax section below. |
|
14 | 14 | |
|
15 | 15 | Files |
|
16 | 16 | ===== |
|
17 | 17 | |
|
18 | 18 | Mercurial reads configuration data from several files, if they exist. |
|
19 | 19 | These files do not exist by default and you will have to create the |
|
20 | 20 | appropriate configuration files yourself: global configuration like |
|
21 | 21 | the username setting is typically put into |
|
22 | 22 | ``%USERPROFILE%\mercurial.ini`` or ``$HOME/.hgrc`` and local |
|
23 | 23 | configuration is put into the per-repository ``<repo>/.hg/hgrc`` file. |
|
24 | 24 | |
|
25 | 25 | The names of these files depend on the system on which Mercurial is |
|
26 | 26 | installed. ``*.rc`` files from a single directory are read in |
|
27 | 27 | alphabetical order, later ones overriding earlier ones. Where multiple |
|
28 | 28 | paths are given below, settings from earlier paths override later |
|
29 | 29 | ones. |
|
30 | 30 | |
|
31 | 31 | | (All) ``<repo>/.hg/hgrc`` |
|
32 | 32 | |
|
33 | 33 | Per-repository configuration options that only apply in a |
|
34 | 34 | particular repository. This file is not version-controlled, and |
|
35 | 35 | will not get transferred during a "clone" operation. Options in |
|
36 | 36 | this file override options in all other configuration files. On |
|
37 | 37 | Plan 9 and Unix, most of this file will be ignored if it doesn't |
|
38 | 38 | belong to a trusted user or to a trusted group. See the documentation |
|
39 | 39 | for the ``[trusted]`` section below for more details. |
|
40 | 40 | |
|
41 | 41 | | (Plan 9) ``$home/lib/hgrc`` |
|
42 | 42 | | (Unix) ``$HOME/.hgrc`` |
|
43 | 43 | | (Windows) ``%USERPROFILE%\.hgrc`` |
|
44 | 44 | | (Windows) ``%USERPROFILE%\Mercurial.ini`` |
|
45 | 45 | | (Windows) ``%HOME%\.hgrc`` |
|
46 | 46 | | (Windows) ``%HOME%\Mercurial.ini`` |
|
47 | 47 | |
|
48 | 48 | Per-user configuration file(s), for the user running Mercurial. On |
|
49 | 49 | Windows 9x, ``%HOME%`` is replaced by ``%APPDATA%``. Options in these |
|
50 | 50 | files apply to all Mercurial commands executed by this user in any |
|
51 | 51 | directory. Options in these files override per-system and per-installation |
|
52 | 52 | options. |
|
53 | 53 | |
|
54 | 54 | | (Plan 9) ``/lib/mercurial/hgrc`` |
|
55 | 55 | | (Plan 9) ``/lib/mercurial/hgrc.d/*.rc`` |
|
56 | 56 | | (Unix) ``/etc/mercurial/hgrc`` |
|
57 | 57 | | (Unix) ``/etc/mercurial/hgrc.d/*.rc`` |
|
58 | 58 | |
|
59 | 59 | Per-system configuration files, for the system on which Mercurial |
|
60 | 60 | is running. Options in these files apply to all Mercurial commands |
|
61 | 61 | executed by any user in any directory. Options in these files |
|
62 | 62 | override per-installation options. |
|
63 | 63 | |
|
64 | 64 | | (Plan 9) ``<install-root>/lib/mercurial/hgrc`` |
|
65 | 65 | | (Plan 9) ``<install-root>/lib/mercurial/hgrc.d/*.rc`` |
|
66 | 66 | | (Unix) ``<install-root>/etc/mercurial/hgrc`` |
|
67 | 67 | | (Unix) ``<install-root>/etc/mercurial/hgrc.d/*.rc`` |
|
68 | 68 | |
|
69 | 69 | Per-installation configuration files, searched for in the |
|
70 | 70 | directory where Mercurial is installed. ``<install-root>`` is the |
|
71 | 71 | parent directory of the **hg** executable (or symlink) being run. For |
|
72 | 72 | example, if installed in ``/shared/tools/bin/hg``, Mercurial will look |
|
73 | 73 | in ``/shared/tools/etc/mercurial/hgrc``. Options in these files apply |
|
74 | 74 | to all Mercurial commands executed by any user in any directory. |
|
75 | 75 | |
|
76 | 76 | | (Windows) ``<install-dir>\Mercurial.ini`` **or** |
|
77 | 77 | | (Windows) ``<install-dir>\hgrc.d\*.rc`` **or** |
|
78 | 78 | | (Windows) ``HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial`` |
|
79 | 79 | |
|
80 | 80 | Per-installation/system configuration files, for the system on |
|
81 | 81 | which Mercurial is running. Options in these files apply to all |
|
82 | 82 | Mercurial commands executed by any user in any directory. Registry |
|
83 | 83 | keys contain PATH-like strings, every part of which must reference |
|
84 | 84 | a ``Mercurial.ini`` file or be a directory where ``*.rc`` files will |
|
85 | 85 | be read. Mercurial checks each of these locations in the specified |
|
86 | 86 | order until one or more configuration files are detected. |
|
87 | 87 | |
|
88 | 88 | Syntax |
|
89 | 89 | ====== |
|
90 | 90 | |
|
91 | 91 | A configuration file consists of sections, led by a ``[section]`` header |
|
92 | 92 | and followed by ``name = value`` entries (sometimes called |
|
93 | 93 | ``configuration keys``):: |
|
94 | 94 | |
|
95 | 95 | [spam] |
|
96 | 96 | eggs=ham |
|
97 | 97 | green= |
|
98 | 98 | eggs |
|
99 | 99 | |
|
100 | 100 | Each line contains one entry. If the lines that follow are indented, |
|
101 | 101 | they are treated as continuations of that entry. Leading whitespace is |
|
102 | 102 | removed from values. Empty lines are skipped. Lines beginning with |
|
103 | 103 | ``#`` or ``;`` are ignored and may be used to provide comments. |
|
104 | 104 | |
|
105 | 105 | Configuration keys can be set multiple times, in which case Mercurial |
|
106 | 106 | will use the value that was configured last. As an example:: |
|
107 | 107 | |
|
108 | 108 | [spam] |
|
109 | 109 | eggs=large |
|
110 | 110 | ham=serrano |
|
111 | 111 | eggs=small |
|
112 | 112 | |
|
113 | 113 | This would set the configuration key named ``eggs`` to ``small``. |
|
114 | 114 | |
|
115 | 115 | It is also possible to define a section multiple times. A section can |
|
116 | 116 | be redefined on the same and/or on different configuration files. For |
|
117 | 117 | example:: |
|
118 | 118 | |
|
119 | 119 | [foo] |
|
120 | 120 | eggs=large |
|
121 | 121 | ham=serrano |
|
122 | 122 | eggs=small |
|
123 | 123 | |
|
124 | 124 | [bar] |
|
125 | 125 | eggs=ham |
|
126 | 126 | green= |
|
127 | 127 | eggs |
|
128 | 128 | |
|
129 | 129 | [foo] |
|
130 | 130 | ham=prosciutto |
|
131 | 131 | eggs=medium |
|
132 | 132 | bread=toasted |
|
133 | 133 | |
|
134 | 134 | This would set the ``eggs``, ``ham``, and ``bread`` configuration keys |
|
135 | 135 | of the ``foo`` section to ``medium``, ``prosciutto``, and ``toasted``, |
|
136 | 136 | respectively. As you can see there only thing that matters is the last |
|
137 | 137 | value that was set for each of the configuration keys. |
|
138 | 138 | |
|
139 | 139 | If a configuration key is set multiple times in different |
|
140 | 140 | configuration files the final value will depend on the order in which |
|
141 | 141 | the different configuration files are read, with settings from earlier |
|
142 | 142 | paths overriding later ones as described on the ``Files`` section |
|
143 | 143 | above. |
|
144 | 144 | |
|
145 | 145 | A line of the form ``%include file`` will include ``file`` into the |
|
146 | 146 | current configuration file. The inclusion is recursive, which means |
|
147 | 147 | that included files can include other files. Filenames are relative to |
|
148 | 148 | the configuration file in which the ``%include`` directive is found. |
|
149 | 149 | Environment variables and ``~user`` constructs are expanded in |
|
150 | 150 | ``file``. This lets you do something like:: |
|
151 | 151 | |
|
152 | 152 | %include ~/.hgrc.d/$HOST.rc |
|
153 | 153 | |
|
154 | 154 | to include a different configuration file on each computer you use. |
|
155 | 155 | |
|
156 | 156 | A line with ``%unset name`` will remove ``name`` from the current |
|
157 | 157 | section, if it has been set previously. |
|
158 | 158 | |
|
159 | 159 | The values are either free-form text strings, lists of text strings, |
|
160 | 160 | or Boolean values. Boolean values can be set to true using any of "1", |
|
161 | 161 | "yes", "true", or "on" and to false using "0", "no", "false", or "off" |
|
162 | 162 | (all case insensitive). |
|
163 | 163 | |
|
164 | 164 | List values are separated by whitespace or comma, except when values are |
|
165 | 165 | placed in double quotation marks:: |
|
166 | 166 | |
|
167 | 167 | allow_read = "John Doe, PhD", brian, betty |
|
168 | 168 | |
|
169 | 169 | Quotation marks can be escaped by prefixing them with a backslash. Only |
|
170 | 170 | quotation marks at the beginning of a word is counted as a quotation |
|
171 | 171 | (e.g., ``foo"bar baz`` is the list of ``foo"bar`` and ``baz``). |
|
172 | 172 | |
|
173 | 173 | Sections |
|
174 | 174 | ======== |
|
175 | 175 | |
|
176 | 176 | This section describes the different sections that may appear in a |
|
177 | 177 | Mercurial configuration file, the purpose of each section, its possible |
|
178 | 178 | keys, and their possible values. |
|
179 | 179 | |
|
180 | 180 | ``alias`` |
|
181 | 181 | --------- |
|
182 | 182 | |
|
183 | 183 | Defines command aliases. |
|
184 | 184 | Aliases allow you to define your own commands in terms of other |
|
185 | 185 | commands (or aliases), optionally including arguments. Positional |
|
186 | 186 | arguments in the form of ``$1``, ``$2``, etc in the alias definition |
|
187 | 187 | are expanded by Mercurial before execution. Positional arguments not |
|
188 | 188 | already used by ``$N`` in the definition are put at the end of the |
|
189 | 189 | command to be executed. |
|
190 | 190 | |
|
191 | 191 | Alias definitions consist of lines of the form:: |
|
192 | 192 | |
|
193 | 193 | <alias> = <command> [<argument>]... |
|
194 | 194 | |
|
195 | 195 | For example, this definition:: |
|
196 | 196 | |
|
197 | 197 | latest = log --limit 5 |
|
198 | 198 | |
|
199 | 199 | creates a new command ``latest`` that shows only the five most recent |
|
200 | 200 | changesets. You can define subsequent aliases using earlier ones:: |
|
201 | 201 | |
|
202 | 202 | stable5 = latest -b stable |
|
203 | 203 | |
|
204 | 204 | .. note:: It is possible to create aliases with the same names as |
|
205 | 205 | existing commands, which will then override the original |
|
206 | 206 | definitions. This is almost always a bad idea! |
|
207 | 207 | |
|
208 | 208 | An alias can start with an exclamation point (``!``) to make it a |
|
209 | 209 | shell alias. A shell alias is executed with the shell and will let you |
|
210 | 210 | run arbitrary commands. As an example, :: |
|
211 | 211 | |
|
212 | 212 | echo = !echo $@ |
|
213 | 213 | |
|
214 | 214 | will let you do ``hg echo foo`` to have ``foo`` printed in your |
|
215 | 215 | terminal. A better example might be:: |
|
216 | 216 | |
|
217 | 217 | purge = !$HG status --no-status --unknown -0 | xargs -0 rm |
|
218 | 218 | |
|
219 | 219 | which will make ``hg purge`` delete all unknown files in the |
|
220 | 220 | repository in the same manner as the purge extension. |
|
221 | 221 | |
|
222 | 222 | Positional arguments like ``$1``, ``$2``, etc. in the alias definition |
|
223 | 223 | expand to the command arguments. Unmatched arguments are |
|
224 | 224 | removed. ``$0`` expands to the alias name and ``$@`` expands to all |
|
225 | 225 | arguments separated by a space. These expansions happen before the |
|
226 | 226 | command is passed to the shell. |
|
227 | 227 | |
|
228 | 228 | Shell aliases are executed in an environment where ``$HG`` expands to |
|
229 | 229 | the path of the Mercurial that was used to execute the alias. This is |
|
230 | 230 | useful when you want to call further Mercurial commands in a shell |
|
231 | 231 | alias, as was done above for the purge alias. In addition, |
|
232 | 232 | ``$HG_ARGS`` expands to the arguments given to Mercurial. In the ``hg |
|
233 | 233 | echo foo`` call above, ``$HG_ARGS`` would expand to ``echo foo``. |
|
234 | 234 | |
|
235 | 235 | .. note:: Some global configuration options such as ``-R`` are |
|
236 | 236 | processed before shell aliases and will thus not be passed to |
|
237 | 237 | aliases. |
|
238 | 238 | |
|
239 | 239 | |
|
240 | 240 | ``annotate`` |
|
241 | 241 | ------------ |
|
242 | 242 | |
|
243 | 243 | Settings used when displaying file annotations. All values are |
|
244 | 244 | Booleans and default to False. See ``diff`` section for related |
|
245 | 245 | options for the diff command. |
|
246 | 246 | |
|
247 | 247 | ``ignorews`` |
|
248 | 248 | Ignore white space when comparing lines. |
|
249 | 249 | |
|
250 | 250 | ``ignorewsamount`` |
|
251 | 251 | Ignore changes in the amount of white space. |
|
252 | 252 | |
|
253 | 253 | ``ignoreblanklines`` |
|
254 | 254 | Ignore changes whose lines are all blank. |
|
255 | 255 | |
|
256 | 256 | |
|
257 | 257 | ``auth`` |
|
258 | 258 | -------- |
|
259 | 259 | |
|
260 | 260 | Authentication credentials for HTTP authentication. This section |
|
261 | 261 | allows you to store usernames and passwords for use when logging |
|
262 | 262 | *into* HTTP servers. See the ``[web]`` configuration section if |
|
263 | 263 | you want to configure *who* can login to your HTTP server. |
|
264 | 264 | |
|
265 | 265 | Each line has the following format:: |
|
266 | 266 | |
|
267 | 267 | <name>.<argument> = <value> |
|
268 | 268 | |
|
269 | 269 | where ``<name>`` is used to group arguments into authentication |
|
270 | 270 | entries. Example:: |
|
271 | 271 | |
|
272 | 272 | foo.prefix = hg.intevation.org/mercurial |
|
273 | 273 | foo.username = foo |
|
274 | 274 | foo.password = bar |
|
275 | 275 | foo.schemes = http https |
|
276 | 276 | |
|
277 | 277 | bar.prefix = secure.example.org |
|
278 | 278 | bar.key = path/to/file.key |
|
279 | 279 | bar.cert = path/to/file.cert |
|
280 | 280 | bar.schemes = https |
|
281 | 281 | |
|
282 | 282 | Supported arguments: |
|
283 | 283 | |
|
284 | 284 | ``prefix`` |
|
285 | 285 | Either ``*`` or a URI prefix with or without the scheme part. |
|
286 | 286 | The authentication entry with the longest matching prefix is used |
|
287 | 287 | (where ``*`` matches everything and counts as a match of length |
|
288 | 288 | 1). If the prefix doesn't include a scheme, the match is performed |
|
289 | 289 | against the URI with its scheme stripped as well, and the schemes |
|
290 | 290 | argument, q.v., is then subsequently consulted. |
|
291 | 291 | |
|
292 | 292 | ``username`` |
|
293 | 293 | Optional. Username to authenticate with. If not given, and the |
|
294 | 294 | remote site requires basic or digest authentication, the user will |
|
295 | 295 | be prompted for it. Environment variables are expanded in the |
|
296 | 296 | username letting you do ``foo.username = $USER``. If the URI |
|
297 | 297 | includes a username, only ``[auth]`` entries with a matching |
|
298 | 298 | username or without a username will be considered. |
|
299 | 299 | |
|
300 | 300 | ``password`` |
|
301 | 301 | Optional. Password to authenticate with. If not given, and the |
|
302 | 302 | remote site requires basic or digest authentication, the user |
|
303 | 303 | will be prompted for it. |
|
304 | 304 | |
|
305 | 305 | ``key`` |
|
306 | 306 | Optional. PEM encoded client certificate key file. Environment |
|
307 | 307 | variables are expanded in the filename. |
|
308 | 308 | |
|
309 | 309 | ``cert`` |
|
310 | 310 | Optional. PEM encoded client certificate chain file. Environment |
|
311 | 311 | variables are expanded in the filename. |
|
312 | 312 | |
|
313 | 313 | ``schemes`` |
|
314 | 314 | Optional. Space separated list of URI schemes to use this |
|
315 | 315 | authentication entry with. Only used if the prefix doesn't include |
|
316 | 316 | a scheme. Supported schemes are http and https. They will match |
|
317 | 317 | static-http and static-https respectively, as well. |
|
318 | 318 | Default: https. |
|
319 | 319 | |
|
320 | 320 | If no suitable authentication entry is found, the user is prompted |
|
321 | 321 | for credentials as usual if required by the remote. |
|
322 | 322 | |
|
323 | 323 | |
|
324 | 324 | ``decode/encode`` |
|
325 | 325 | ----------------- |
|
326 | 326 | |
|
327 | 327 | Filters for transforming files on checkout/checkin. This would |
|
328 | 328 | typically be used for newline processing or other |
|
329 | 329 | localization/canonicalization of files. |
|
330 | 330 | |
|
331 | 331 | Filters consist of a filter pattern followed by a filter command. |
|
332 | 332 | Filter patterns are globs by default, rooted at the repository root. |
|
333 | 333 | For example, to match any file ending in ``.txt`` in the root |
|
334 | 334 | directory only, use the pattern ``*.txt``. To match any file ending |
|
335 | 335 | in ``.c`` anywhere in the repository, use the pattern ``**.c``. |
|
336 | 336 | For each file only the first matching filter applies. |
|
337 | 337 | |
|
338 | 338 | The filter command can start with a specifier, either ``pipe:`` or |
|
339 | 339 | ``tempfile:``. If no specifier is given, ``pipe:`` is used by default. |
|
340 | 340 | |
|
341 | 341 | A ``pipe:`` command must accept data on stdin and return the transformed |
|
342 | 342 | data on stdout. |
|
343 | 343 | |
|
344 | 344 | Pipe example:: |
|
345 | 345 | |
|
346 | 346 | [encode] |
|
347 | 347 | # uncompress gzip files on checkin to improve delta compression |
|
348 | 348 | # note: not necessarily a good idea, just an example |
|
349 | 349 | *.gz = pipe: gunzip |
|
350 | 350 | |
|
351 | 351 | [decode] |
|
352 | 352 | # recompress gzip files when writing them to the working dir (we |
|
353 | 353 | # can safely omit "pipe:", because it's the default) |
|
354 | 354 | *.gz = gzip |
|
355 | 355 | |
|
356 | 356 | A ``tempfile:`` command is a template. The string ``INFILE`` is replaced |
|
357 | 357 | with the name of a temporary file that contains the data to be |
|
358 | 358 | filtered by the command. The string ``OUTFILE`` is replaced with the name |
|
359 | 359 | of an empty temporary file, where the filtered data must be written by |
|
360 | 360 | the command. |
|
361 | 361 | |
|
362 | 362 | .. note:: The tempfile mechanism is recommended for Windows systems, |
|
363 | 363 | where the standard shell I/O redirection operators often have |
|
364 | 364 | strange effects and may corrupt the contents of your files. |
|
365 | 365 | |
|
366 | 366 | This filter mechanism is used internally by the ``eol`` extension to |
|
367 | 367 | translate line ending characters between Windows (CRLF) and Unix (LF) |
|
368 | 368 | format. We suggest you use the ``eol`` extension for convenience. |
|
369 | 369 | |
|
370 | 370 | |
|
371 | 371 | ``defaults`` |
|
372 | 372 | ------------ |
|
373 | 373 | |
|
374 | 374 | (defaults are deprecated. Don't use them. Use aliases instead) |
|
375 | 375 | |
|
376 | 376 | Use the ``[defaults]`` section to define command defaults, i.e. the |
|
377 | 377 | default options/arguments to pass to the specified commands. |
|
378 | 378 | |
|
379 | 379 | The following example makes :hg:`log` run in verbose mode, and |
|
380 | 380 | :hg:`status` show only the modified files, by default:: |
|
381 | 381 | |
|
382 | 382 | [defaults] |
|
383 | 383 | log = -v |
|
384 | 384 | status = -m |
|
385 | 385 | |
|
386 | 386 | The actual commands, instead of their aliases, must be used when |
|
387 | 387 | defining command defaults. The command defaults will also be applied |
|
388 | 388 | to the aliases of the commands defined. |
|
389 | 389 | |
|
390 | 390 | |
|
391 | 391 | ``diff`` |
|
392 | 392 | -------- |
|
393 | 393 | |
|
394 | 394 | Settings used when displaying diffs. Everything except for ``unified`` |
|
395 | 395 | is a Boolean and defaults to False. See ``annotate`` section for |
|
396 | 396 | related options for the annotate command. |
|
397 | 397 | |
|
398 | 398 | ``git`` |
|
399 | 399 | Use git extended diff format. |
|
400 | 400 | |
|
401 | 401 | ``nodates`` |
|
402 | 402 | Don't include dates in diff headers. |
|
403 | 403 | |
|
404 | 404 | ``showfunc`` |
|
405 | 405 | Show which function each change is in. |
|
406 | 406 | |
|
407 | 407 | ``ignorews`` |
|
408 | 408 | Ignore white space when comparing lines. |
|
409 | 409 | |
|
410 | 410 | ``ignorewsamount`` |
|
411 | 411 | Ignore changes in the amount of white space. |
|
412 | 412 | |
|
413 | 413 | ``ignoreblanklines`` |
|
414 | 414 | Ignore changes whose lines are all blank. |
|
415 | 415 | |
|
416 | 416 | ``unified`` |
|
417 | 417 | Number of lines of context to show. |
|
418 | 418 | |
|
419 | 419 | ``email`` |
|
420 | 420 | --------- |
|
421 | 421 | |
|
422 | 422 | Settings for extensions that send email messages. |
|
423 | 423 | |
|
424 | 424 | ``from`` |
|
425 | 425 | Optional. Email address to use in "From" header and SMTP envelope |
|
426 | 426 | of outgoing messages. |
|
427 | 427 | |
|
428 | 428 | ``to`` |
|
429 | 429 | Optional. Comma-separated list of recipients' email addresses. |
|
430 | 430 | |
|
431 | 431 | ``cc`` |
|
432 | 432 | Optional. Comma-separated list of carbon copy recipients' |
|
433 | 433 | email addresses. |
|
434 | 434 | |
|
435 | 435 | ``bcc`` |
|
436 | 436 | Optional. Comma-separated list of blind carbon copy recipients' |
|
437 | 437 | email addresses. |
|
438 | 438 | |
|
439 | 439 | ``method`` |
|
440 | 440 | Optional. Method to use to send email messages. If value is ``smtp`` |
|
441 | 441 | (default), use SMTP (see the ``[smtp]`` section for configuration). |
|
442 | 442 | Otherwise, use as name of program to run that acts like sendmail |
|
443 | 443 | (takes ``-f`` option for sender, list of recipients on command line, |
|
444 | 444 | message on stdin). Normally, setting this to ``sendmail`` or |
|
445 | 445 | ``/usr/sbin/sendmail`` is enough to use sendmail to send messages. |
|
446 | 446 | |
|
447 | 447 | ``charsets`` |
|
448 | 448 | Optional. Comma-separated list of character sets considered |
|
449 | 449 | convenient for recipients. Addresses, headers, and parts not |
|
450 | 450 | containing patches of outgoing messages will be encoded in the |
|
451 | 451 | first character set to which conversion from local encoding |
|
452 | 452 | (``$HGENCODING``, ``ui.fallbackencoding``) succeeds. If correct |
|
453 | 453 | conversion fails, the text in question is sent as is. Defaults to |
|
454 | 454 | empty (explicit) list. |
|
455 | 455 | |
|
456 | 456 | Order of outgoing email character sets: |
|
457 | 457 | |
|
458 | 458 | 1. ``us-ascii``: always first, regardless of settings |
|
459 | 459 | 2. ``email.charsets``: in order given by user |
|
460 | 460 | 3. ``ui.fallbackencoding``: if not in email.charsets |
|
461 | 461 | 4. ``$HGENCODING``: if not in email.charsets |
|
462 | 462 | 5. ``utf-8``: always last, regardless of settings |
|
463 | 463 | |
|
464 | 464 | Email example:: |
|
465 | 465 | |
|
466 | 466 | [email] |
|
467 | 467 | from = Joseph User <joe.user@example.com> |
|
468 | 468 | method = /usr/sbin/sendmail |
|
469 | 469 | # charsets for western Europeans |
|
470 | 470 | # us-ascii, utf-8 omitted, as they are tried first and last |
|
471 | 471 | charsets = iso-8859-1, iso-8859-15, windows-1252 |
|
472 | 472 | |
|
473 | 473 | |
|
474 | 474 | ``extensions`` |
|
475 | 475 | -------------- |
|
476 | 476 | |
|
477 | 477 | Mercurial has an extension mechanism for adding new features. To |
|
478 | 478 | enable an extension, create an entry for it in this section. |
|
479 | 479 | |
|
480 | 480 | If you know that the extension is already in Python's search path, |
|
481 | 481 | you can give the name of the module, followed by ``=``, with nothing |
|
482 | 482 | after the ``=``. |
|
483 | 483 | |
|
484 | 484 | Otherwise, give a name that you choose, followed by ``=``, followed by |
|
485 | 485 | the path to the ``.py`` file (including the file name extension) that |
|
486 | 486 | defines the extension. |
|
487 | 487 | |
|
488 | 488 | To explicitly disable an extension that is enabled in an hgrc of |
|
489 | 489 | broader scope, prepend its path with ``!``, as in ``foo = !/ext/path`` |
|
490 | 490 | or ``foo = !`` when path is not supplied. |
|
491 | 491 | |
|
492 | 492 | Example for ``~/.hgrc``:: |
|
493 | 493 | |
|
494 | 494 | [extensions] |
|
495 | 495 | # (the mq extension will get loaded from Mercurial's path) |
|
496 | 496 | mq = |
|
497 | 497 | # (this extension will get loaded from the file specified) |
|
498 | 498 | myfeature = ~/.hgext/myfeature.py |
|
499 | 499 | |
|
500 | 500 | |
|
501 | 501 | ``format`` |
|
502 | 502 | ---------- |
|
503 | 503 | |
|
504 | 504 | ``usestore`` |
|
505 | 505 | Enable or disable the "store" repository format which improves |
|
506 | 506 | compatibility with systems that fold case or otherwise mangle |
|
507 | 507 | filenames. Enabled by default. Disabling this option will allow |
|
508 | 508 | you to store longer filenames in some situations at the expense of |
|
509 | 509 | compatibility and ensures that the on-disk format of newly created |
|
510 | 510 | repositories will be compatible with Mercurial before version 0.9.4. |
|
511 | 511 | |
|
512 | 512 | ``usefncache`` |
|
513 | 513 | Enable or disable the "fncache" repository format which enhances |
|
514 | 514 | the "store" repository format (which has to be enabled to use |
|
515 | 515 | fncache) to allow longer filenames and avoids using Windows |
|
516 | 516 | reserved names, e.g. "nul". Enabled by default. Disabling this |
|
517 | 517 | option ensures that the on-disk format of newly created |
|
518 | 518 | repositories will be compatible with Mercurial before version 1.1. |
|
519 | 519 | |
|
520 | 520 | ``dotencode`` |
|
521 | 521 | Enable or disable the "dotencode" repository format which enhances |
|
522 | 522 | the "fncache" repository format (which has to be enabled to use |
|
523 | 523 | dotencode) to avoid issues with filenames starting with ._ on |
|
524 | 524 | Mac OS X and spaces on Windows. Enabled by default. Disabling this |
|
525 | 525 | option ensures that the on-disk format of newly created |
|
526 | 526 | repositories will be compatible with Mercurial before version 1.7. |
|
527 | 527 | |
|
528 | 528 | ``graph`` |
|
529 | 529 | --------- |
|
530 | 530 | |
|
531 | 531 | Web graph view configuration. This section let you change graph |
|
532 | 532 | elements display properties by branches, for instance to make the |
|
533 | 533 | ``default`` branch stand out. |
|
534 | 534 | |
|
535 | 535 | Each line has the following format:: |
|
536 | 536 | |
|
537 | 537 | <branch>.<argument> = <value> |
|
538 | 538 | |
|
539 | 539 | where ``<branch>`` is the name of the branch being |
|
540 | 540 | customized. Example:: |
|
541 | 541 | |
|
542 | 542 | [graph] |
|
543 | 543 | # 2px width |
|
544 | 544 | default.width = 2 |
|
545 | 545 | # red color |
|
546 | 546 | default.color = FF0000 |
|
547 | 547 | |
|
548 | 548 | Supported arguments: |
|
549 | 549 | |
|
550 | 550 | ``width`` |
|
551 | 551 | Set branch edges width in pixels. |
|
552 | 552 | |
|
553 | 553 | ``color`` |
|
554 | 554 | Set branch edges color in hexadecimal RGB notation. |
|
555 | 555 | |
|
556 | 556 | ``hooks`` |
|
557 | 557 | --------- |
|
558 | 558 | |
|
559 | 559 | Commands or Python functions that get automatically executed by |
|
560 | 560 | various actions such as starting or finishing a commit. Multiple |
|
561 | 561 | hooks can be run for the same action by appending a suffix to the |
|
562 | 562 | action. Overriding a site-wide hook can be done by changing its |
|
563 | 563 | value or setting it to an empty string. Hooks can be prioritized |
|
564 | 564 | by adding a prefix of ``priority`` to the hook name on a new line |
|
565 | 565 | and setting the priority. The default priority is 0 if |
|
566 | 566 | not specified. |
|
567 | 567 | |
|
568 | 568 | Example ``.hg/hgrc``:: |
|
569 | 569 | |
|
570 | 570 | [hooks] |
|
571 | 571 | # update working directory after adding changesets |
|
572 | 572 | changegroup.update = hg update |
|
573 | 573 | # do not use the site-wide hook |
|
574 | 574 | incoming = |
|
575 | 575 | incoming.email = /my/email/hook |
|
576 | 576 | incoming.autobuild = /my/build/hook |
|
577 | 577 | # force autobuild hook to run before other incoming hooks |
|
578 | 578 | priority.incoming.autobuild = 1 |
|
579 | 579 | |
|
580 | 580 | Most hooks are run with environment variables set that give useful |
|
581 | 581 | additional information. For each hook below, the environment |
|
582 | 582 | variables it is passed are listed with names of the form ``$HG_foo``. |
|
583 | 583 | |
|
584 | 584 | ``changegroup`` |
|
585 | 585 | Run after a changegroup has been added via push, pull or unbundle. |
|
586 | 586 | ID of the first new changeset is in ``$HG_NODE``. URL from which |
|
587 | 587 | changes came is in ``$HG_URL``. |
|
588 | 588 | |
|
589 | 589 | ``commit`` |
|
590 | 590 | Run after a changeset has been created in the local repository. ID |
|
591 | 591 | of the newly created changeset is in ``$HG_NODE``. Parent changeset |
|
592 | 592 | IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. |
|
593 | 593 | |
|
594 | 594 | ``incoming`` |
|
595 | 595 | Run after a changeset has been pulled, pushed, or unbundled into |
|
596 | 596 | the local repository. The ID of the newly arrived changeset is in |
|
597 | 597 | ``$HG_NODE``. URL that was source of changes came is in ``$HG_URL``. |
|
598 | 598 | |
|
599 | 599 | ``outgoing`` |
|
600 | 600 | Run after sending changes from local repository to another. ID of |
|
601 | 601 | first changeset sent is in ``$HG_NODE``. Source of operation is in |
|
602 | 602 | ``$HG_SOURCE``; see "preoutgoing" hook for description. |
|
603 | 603 | |
|
604 | 604 | ``post-<command>`` |
|
605 | 605 | Run after successful invocations of the associated command. The |
|
606 | 606 | contents of the command line are passed as ``$HG_ARGS`` and the result |
|
607 | 607 | code in ``$HG_RESULT``. Parsed command line arguments are passed as |
|
608 | 608 | ``$HG_PATS`` and ``$HG_OPTS``. These contain string representations of |
|
609 | 609 | the python data internally passed to <command>. ``$HG_OPTS`` is a |
|
610 | 610 | dictionary of options (with unspecified options set to their defaults). |
|
611 | 611 | ``$HG_PATS`` is a list of arguments. Hook failure is ignored. |
|
612 | 612 | |
|
613 | 613 | ``pre-<command>`` |
|
614 | 614 | Run before executing the associated command. The contents of the |
|
615 | 615 | command line are passed as ``$HG_ARGS``. Parsed command line arguments |
|
616 | 616 | are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain string |
|
617 | 617 | representations of the data internally passed to <command>. ``$HG_OPTS`` |
|
618 | 618 | is a dictionary of options (with unspecified options set to their |
|
619 | 619 | defaults). ``$HG_PATS`` is a list of arguments. If the hook returns |
|
620 | 620 | failure, the command doesn't execute and Mercurial returns the failure |
|
621 | 621 | code. |
|
622 | 622 | |
|
623 | 623 | ``prechangegroup`` |
|
624 | 624 | Run before a changegroup is added via push, pull or unbundle. Exit |
|
625 | 625 | status 0 allows the changegroup to proceed. Non-zero status will |
|
626 | 626 | cause the push, pull or unbundle to fail. URL from which changes |
|
627 | 627 | will come is in ``$HG_URL``. |
|
628 | 628 | |
|
629 | 629 | ``precommit`` |
|
630 | 630 | Run before starting a local commit. Exit status 0 allows the |
|
631 | 631 | commit to proceed. Non-zero status will cause the commit to fail. |
|
632 | 632 | Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. |
|
633 | 633 | |
|
634 | 634 | ``prelistkeys`` |
|
635 | 635 | Run before listing pushkeys (like bookmarks) in the |
|
636 | 636 | repository. Non-zero status will cause failure. The key namespace is |
|
637 | 637 | in ``$HG_NAMESPACE``. |
|
638 | 638 | |
|
639 | 639 | ``preoutgoing`` |
|
640 | 640 | Run before collecting changes to send from the local repository to |
|
641 | 641 | another. Non-zero status will cause failure. This lets you prevent |
|
642 | 642 | pull over HTTP or SSH. Also prevents against local pull, push |
|
643 | 643 | (outbound) or bundle commands, but not effective, since you can |
|
644 | 644 | just copy files instead then. Source of operation is in |
|
645 | 645 | ``$HG_SOURCE``. If "serve", operation is happening on behalf of remote |
|
646 | 646 | SSH or HTTP repository. If "push", "pull" or "bundle", operation |
|
647 | 647 | is happening on behalf of repository on same system. |
|
648 | 648 | |
|
649 | 649 | ``prepushkey`` |
|
650 | 650 | Run before a pushkey (like a bookmark) is added to the |
|
651 | 651 | repository. Non-zero status will cause the key to be rejected. The |
|
652 | 652 | key namespace is in ``$HG_NAMESPACE``, the key is in ``$HG_KEY``, |
|
653 | 653 | the old value (if any) is in ``$HG_OLD``, and the new value is in |
|
654 | 654 | ``$HG_NEW``. |
|
655 | 655 | |
|
656 | 656 | ``pretag`` |
|
657 | 657 | Run before creating a tag. Exit status 0 allows the tag to be |
|
658 | 658 | created. Non-zero status will cause the tag to fail. ID of |
|
659 | 659 | changeset to tag is in ``$HG_NODE``. Name of tag is in ``$HG_TAG``. Tag is |
|
660 | 660 | local if ``$HG_LOCAL=1``, in repository if ``$HG_LOCAL=0``. |
|
661 | 661 | |
|
662 | 662 | ``pretxnchangegroup`` |
|
663 | 663 | Run after a changegroup has been added via push, pull or unbundle, |
|
664 | 664 | but before the transaction has been committed. Changegroup is |
|
665 | 665 | visible to hook program. This lets you validate incoming changes |
|
666 | 666 | before accepting them. Passed the ID of the first new changeset in |
|
667 | 667 | ``$HG_NODE``. Exit status 0 allows the transaction to commit. Non-zero |
|
668 | 668 | status will cause the transaction to be rolled back and the push, |
|
669 | 669 | pull or unbundle will fail. URL that was source of changes is in |
|
670 | 670 | ``$HG_URL``. |
|
671 | 671 | |
|
672 | 672 | ``pretxncommit`` |
|
673 | 673 | Run after a changeset has been created but the transaction not yet |
|
674 | 674 | committed. Changeset is visible to hook program. This lets you |
|
675 | 675 | validate commit message and changes. Exit status 0 allows the |
|
676 | 676 | commit to proceed. Non-zero status will cause the transaction to |
|
677 | 677 | be rolled back. ID of changeset is in ``$HG_NODE``. Parent changeset |
|
678 | 678 | IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. |
|
679 | 679 | |
|
680 | 680 | ``preupdate`` |
|
681 | 681 | Run before updating the working directory. Exit status 0 allows |
|
682 | 682 | the update to proceed. Non-zero status will prevent the update. |
|
683 | 683 | Changeset ID of first new parent is in ``$HG_PARENT1``. If merge, ID |
|
684 | 684 | of second new parent is in ``$HG_PARENT2``. |
|
685 | 685 | |
|
686 | 686 | ``listkeys`` |
|
687 | 687 | Run after listing pushkeys (like bookmarks) in the repository. The |
|
688 | 688 | key namespace is in ``$HG_NAMESPACE``. ``$HG_VALUES`` is a |
|
689 | 689 | dictionary containing the keys and values. |
|
690 | 690 | |
|
691 | 691 | ``pushkey`` |
|
692 | 692 | Run after a pushkey (like a bookmark) is added to the |
|
693 | 693 | repository. The key namespace is in ``$HG_NAMESPACE``, the key is in |
|
694 | 694 | ``$HG_KEY``, the old value (if any) is in ``$HG_OLD``, and the new |
|
695 | 695 | value is in ``$HG_NEW``. |
|
696 | 696 | |
|
697 | 697 | ``tag`` |
|
698 | 698 | Run after a tag is created. ID of tagged changeset is in ``$HG_NODE``. |
|
699 | 699 | Name of tag is in ``$HG_TAG``. Tag is local if ``$HG_LOCAL=1``, in |
|
700 | 700 | repository if ``$HG_LOCAL=0``. |
|
701 | 701 | |
|
702 | 702 | ``update`` |
|
703 | 703 | Run after updating the working directory. Changeset ID of first |
|
704 | 704 | new parent is in ``$HG_PARENT1``. If merge, ID of second new parent is |
|
705 | 705 | in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the |
|
706 | 706 | update failed (e.g. because conflicts not resolved), ``$HG_ERROR=1``. |
|
707 | 707 | |
|
708 | 708 | .. note:: It is generally better to use standard hooks rather than the |
|
709 | 709 | generic pre- and post- command hooks as they are guaranteed to be |
|
710 | 710 | called in the appropriate contexts for influencing transactions. |
|
711 | 711 | Also, hooks like "commit" will be called in all contexts that |
|
712 | 712 | generate a commit (e.g. tag) and not just the commit command. |
|
713 | 713 | |
|
714 | 714 | .. note:: Environment variables with empty values may not be passed to |
|
715 | 715 | hooks on platforms such as Windows. As an example, ``$HG_PARENT2`` |
|
716 | 716 | will have an empty value under Unix-like platforms for non-merge |
|
717 | 717 | changesets, while it will not be available at all under Windows. |
|
718 | 718 | |
|
719 | 719 | The syntax for Python hooks is as follows:: |
|
720 | 720 | |
|
721 | 721 | hookname = python:modulename.submodule.callable |
|
722 | 722 | hookname = python:/path/to/python/module.py:callable |
|
723 | 723 | |
|
724 | 724 | Python hooks are run within the Mercurial process. Each hook is |
|
725 | 725 | called with at least three keyword arguments: a ui object (keyword |
|
726 | 726 | ``ui``), a repository object (keyword ``repo``), and a ``hooktype`` |
|
727 | 727 | keyword that tells what kind of hook is used. Arguments listed as |
|
728 | 728 | environment variables above are passed as keyword arguments, with no |
|
729 | 729 | ``HG_`` prefix, and names in lower case. |
|
730 | 730 | |
|
731 | 731 | If a Python hook returns a "true" value or raises an exception, this |
|
732 | 732 | is treated as a failure. |
|
733 | 733 | |
|
734 | 734 | |
|
735 | 735 | ``hostfingerprints`` |
|
736 | 736 | -------------------- |
|
737 | 737 | |
|
738 | 738 | Fingerprints of the certificates of known HTTPS servers. |
|
739 | 739 | A HTTPS connection to a server with a fingerprint configured here will |
|
740 | 740 | only succeed if the servers certificate matches the fingerprint. |
|
741 | 741 | This is very similar to how ssh known hosts works. |
|
742 | 742 | The fingerprint is the SHA-1 hash value of the DER encoded certificate. |
|
743 | 743 | The CA chain and web.cacerts is not used for servers with a fingerprint. |
|
744 | 744 | |
|
745 | 745 | For example:: |
|
746 | 746 | |
|
747 | 747 | [hostfingerprints] |
|
748 | 748 | hg.intevation.org = 38:76:52:7c:87:26:9a:8f:4a:f8:d3:de:08:45:3b:ea:d6:4b:ee:cc |
|
749 | 749 | |
|
750 | 750 | This feature is only supported when using Python 2.6 or later. |
|
751 | 751 | |
|
752 | 752 | |
|
753 | 753 | ``http_proxy`` |
|
754 | 754 | -------------- |
|
755 | 755 | |
|
756 | 756 | Used to access web-based Mercurial repositories through a HTTP |
|
757 | 757 | proxy. |
|
758 | 758 | |
|
759 | 759 | ``host`` |
|
760 | 760 | Host name and (optional) port of the proxy server, for example |
|
761 | 761 | "myproxy:8000". |
|
762 | 762 | |
|
763 | 763 | ``no`` |
|
764 | 764 | Optional. Comma-separated list of host names that should bypass |
|
765 | 765 | the proxy. |
|
766 | 766 | |
|
767 | 767 | ``passwd`` |
|
768 | 768 | Optional. Password to authenticate with at the proxy server. |
|
769 | 769 | |
|
770 | 770 | ``user`` |
|
771 | 771 | Optional. User name to authenticate with at the proxy server. |
|
772 | 772 | |
|
773 | 773 | ``always`` |
|
774 | 774 | Optional. Always use the proxy, even for localhost and any entries |
|
775 | 775 | in ``http_proxy.no``. True or False. Default: False. |
|
776 | 776 | |
|
777 | 777 | ``merge-patterns`` |
|
778 | 778 | ------------------ |
|
779 | 779 | |
|
780 | 780 | This section specifies merge tools to associate with particular file |
|
781 | 781 | patterns. Tools matched here will take precedence over the default |
|
782 | 782 | merge tool. Patterns are globs by default, rooted at the repository |
|
783 | 783 | root. |
|
784 | 784 | |
|
785 | 785 | Example:: |
|
786 | 786 | |
|
787 | 787 | [merge-patterns] |
|
788 | 788 | **.c = kdiff3 |
|
789 | 789 | **.jpg = myimgmerge |
|
790 | 790 | |
|
791 | 791 | ``merge-tools`` |
|
792 | 792 | --------------- |
|
793 | 793 | |
|
794 | 794 | This section configures external merge tools to use for file-level |
|
795 | 795 | merges. |
|
796 | 796 | |
|
797 | 797 | Example ``~/.hgrc``:: |
|
798 | 798 | |
|
799 | 799 | [merge-tools] |
|
800 | 800 | # Override stock tool location |
|
801 | 801 | kdiff3.executable = ~/bin/kdiff3 |
|
802 | 802 | # Specify command line |
|
803 | 803 | kdiff3.args = $base $local $other -o $output |
|
804 | 804 | # Give higher priority |
|
805 | 805 | kdiff3.priority = 1 |
|
806 | 806 | |
|
807 | 807 | # Define new tool |
|
808 | 808 | myHtmlTool.args = -m $local $other $base $output |
|
809 | 809 | myHtmlTool.regkey = Software\FooSoftware\HtmlMerge |
|
810 | 810 | myHtmlTool.priority = 1 |
|
811 | 811 | |
|
812 | 812 | Supported arguments: |
|
813 | 813 | |
|
814 | 814 | ``priority`` |
|
815 | 815 | The priority in which to evaluate this tool. |
|
816 | 816 | Default: 0. |
|
817 | 817 | |
|
818 | 818 | ``executable`` |
|
819 | 819 | Either just the name of the executable or its pathname. On Windows, |
|
820 | 820 | the path can use environment variables with ${ProgramFiles} syntax. |
|
821 | 821 | Default: the tool name. |
|
822 | 822 | |
|
823 | 823 | ``args`` |
|
824 | 824 | The arguments to pass to the tool executable. You can refer to the |
|
825 | 825 | files being merged as well as the output file through these |
|
826 | 826 | variables: ``$base``, ``$local``, ``$other``, ``$output``. |
|
827 | 827 | Default: ``$local $base $other`` |
|
828 | 828 | |
|
829 | 829 | ``premerge`` |
|
830 | 830 | Attempt to run internal non-interactive 3-way merge tool before |
|
831 | 831 | launching external tool. Options are ``true``, ``false``, or ``keep`` |
|
832 | 832 | to leave markers in the file if the premerge fails. |
|
833 | 833 | Default: True |
|
834 | 834 | |
|
835 | 835 | ``binary`` |
|
836 | 836 | This tool can merge binary files. Defaults to False, unless tool |
|
837 | 837 | was selected by file pattern match. |
|
838 | 838 | |
|
839 | 839 | ``symlink`` |
|
840 | 840 | This tool can merge symlinks. Defaults to False, even if tool was |
|
841 | 841 | selected by file pattern match. |
|
842 | 842 | |
|
843 | 843 | ``check`` |
|
844 | 844 | A list of merge success-checking options: |
|
845 | 845 | |
|
846 | 846 | ``changed`` |
|
847 | 847 | Ask whether merge was successful when the merged file shows no changes. |
|
848 | 848 | ``conflicts`` |
|
849 | 849 | Check whether there are conflicts even though the tool reported success. |
|
850 | 850 | ``prompt`` |
|
851 | 851 | Always prompt for merge success, regardless of success reported by tool. |
|
852 | 852 | |
|
853 | 853 | ``fixeol`` |
|
854 | 854 | Attempt to fix up EOL changes caused by the merge tool. |
|
855 | 855 | Default: False |
|
856 | 856 | |
|
857 | 857 | ``gui`` |
|
858 | 858 | This tool requires a graphical interface to run. Default: False |
|
859 | 859 | |
|
860 | 860 | ``regkey`` |
|
861 | 861 | Windows registry key which describes install location of this |
|
862 | 862 | tool. Mercurial will search for this key first under |
|
863 | 863 | ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``. |
|
864 | 864 | Default: None |
|
865 | 865 | |
|
866 | 866 | ``regkeyalt`` |
|
867 | 867 | An alternate Windows registry key to try if the first key is not |
|
868 | 868 | found. The alternate key uses the same ``regname`` and ``regappend`` |
|
869 | 869 | semantics of the primary key. The most common use for this key |
|
870 | 870 | is to search for 32bit applications on 64bit operating systems. |
|
871 | 871 | Default: None |
|
872 | 872 | |
|
873 | 873 | ``regname`` |
|
874 | 874 | Name of value to read from specified registry key. Defaults to the |
|
875 | 875 | unnamed (default) value. |
|
876 | 876 | |
|
877 | 877 | ``regappend`` |
|
878 | 878 | String to append to the value read from the registry, typically |
|
879 | 879 | the executable name of the tool. |
|
880 | 880 | Default: None |
|
881 | 881 | |
|
882 | 882 | |
|
883 | 883 | ``patch`` |
|
884 | 884 | --------- |
|
885 | 885 | |
|
886 | 886 | Settings used when applying patches, for instance through the 'import' |
|
887 | 887 | command or with Mercurial Queues extension. |
|
888 | 888 | |
|
889 | 889 | ``eol`` |
|
890 | 890 | When set to 'strict' patch content and patched files end of lines |
|
891 | 891 | are preserved. When set to ``lf`` or ``crlf``, both files end of |
|
892 | 892 | lines are ignored when patching and the result line endings are |
|
893 | 893 | normalized to either LF (Unix) or CRLF (Windows). When set to |
|
894 | 894 | ``auto``, end of lines are again ignored while patching but line |
|
895 | 895 | endings in patched files are normalized to their original setting |
|
896 | 896 | on a per-file basis. If target file does not exist or has no end |
|
897 | 897 | of line, patch line endings are preserved. |
|
898 | 898 | Default: strict. |
|
899 | 899 | |
|
900 | 900 | |
|
901 | 901 | ``paths`` |
|
902 | 902 | --------- |
|
903 | 903 | |
|
904 | 904 | Assigns symbolic names to repositories. The left side is the |
|
905 | 905 | symbolic name, and the right gives the directory or URL that is the |
|
906 | 906 | location of the repository. Default paths can be declared by setting |
|
907 | 907 | the following entries. |
|
908 | 908 | |
|
909 | 909 | ``default`` |
|
910 | 910 | Directory or URL to use when pulling if no source is specified. |
|
911 | 911 | Default is set to repository from which the current repository was |
|
912 | 912 | cloned. |
|
913 | 913 | |
|
914 | 914 | ``default-push`` |
|
915 | 915 | Optional. Directory or URL to use when pushing if no destination |
|
916 | 916 | is specified. |
|
917 | 917 | |
|
918 | 918 | Custom paths can be defined by assigning the path to a name that later can be |
|
919 | 919 | used from the command line. Example:: |
|
920 | 920 | |
|
921 | 921 | [paths] |
|
922 | 922 | my_path = http://example.com/path |
|
923 | 923 | |
|
924 | 924 | To push to the path defined in ``my_path`` run the command:: |
|
925 | 925 | |
|
926 | 926 | hg push my_path |
|
927 | 927 | |
|
928 | 928 | |
|
929 | 929 | ``phases`` |
|
930 | 930 | ---------- |
|
931 | 931 | |
|
932 | 932 | Specifies default handling of phases. See :hg:`help phases` for more |
|
933 | 933 | information about working with phases. |
|
934 | 934 | |
|
935 | 935 | ``publish`` |
|
936 | 936 | Controls draft phase behavior when working as a server. When true, |
|
937 | 937 | pushed changesets are set to public in both client and server and |
|
938 | 938 | pulled or cloned changesets are set to public in the client. |
|
939 | 939 | Default: True |
|
940 | 940 | |
|
941 | 941 | ``new-commit`` |
|
942 | 942 | Phase of newly-created commits. |
|
943 | 943 | Default: draft |
|
944 | 944 | |
|
945 | 945 | ``profiling`` |
|
946 | 946 | ------------- |
|
947 | 947 | |
|
948 | 948 | Specifies profiling type, format, and file output. Two profilers are |
|
949 | 949 | supported: an instrumenting profiler (named ``ls``), and a sampling |
|
950 | 950 | profiler (named ``stat``). |
|
951 | 951 | |
|
952 | 952 | In this section description, 'profiling data' stands for the raw data |
|
953 | 953 | collected during profiling, while 'profiling report' stands for a |
|
954 | 954 | statistical text report generated from the profiling data. The |
|
955 | 955 | profiling is done using lsprof. |
|
956 | 956 | |
|
957 | 957 | ``type`` |
|
958 | 958 | The type of profiler to use. |
|
959 | 959 | Default: ls. |
|
960 | 960 | |
|
961 | 961 | ``ls`` |
|
962 | 962 | Use Python's built-in instrumenting profiler. This profiler |
|
963 | 963 | works on all platforms, but each line number it reports is the |
|
964 | 964 | first line of a function. This restriction makes it difficult to |
|
965 | 965 | identify the expensive parts of a non-trivial function. |
|
966 | 966 | ``stat`` |
|
967 | 967 | Use a third-party statistical profiler, statprof. This profiler |
|
968 | 968 | currently runs only on Unix systems, and is most useful for |
|
969 | 969 | profiling commands that run for longer than about 0.1 seconds. |
|
970 | 970 | |
|
971 | 971 | ``format`` |
|
972 | 972 | Profiling format. Specific to the ``ls`` instrumenting profiler. |
|
973 | 973 | Default: text. |
|
974 | 974 | |
|
975 | 975 | ``text`` |
|
976 | 976 | Generate a profiling report. When saving to a file, it should be |
|
977 | 977 | noted that only the report is saved, and the profiling data is |
|
978 | 978 | not kept. |
|
979 | 979 | ``kcachegrind`` |
|
980 | 980 | Format profiling data for kcachegrind use: when saving to a |
|
981 | 981 | file, the generated file can directly be loaded into |
|
982 | 982 | kcachegrind. |
|
983 | 983 | |
|
984 | 984 | ``frequency`` |
|
985 | 985 | Sampling frequency. Specific to the ``stat`` sampling profiler. |
|
986 | 986 | Default: 1000. |
|
987 | 987 | |
|
988 | 988 | ``output`` |
|
989 | 989 | File path where profiling data or report should be saved. If the |
|
990 | 990 | file exists, it is replaced. Default: None, data is printed on |
|
991 | 991 | stderr |
|
992 | 992 | |
|
993 | 993 | ``sort`` |
|
994 | 994 | Sort field. Specific to the ``ls`` instrumenting profiler. |
|
995 | 995 | One of ``callcount``, ``reccallcount``, ``totaltime`` and |
|
996 | 996 | ``inlinetime``. |
|
997 | 997 | Default: inlinetime. |
|
998 | 998 | |
|
999 | 999 | ``limit`` |
|
1000 | 1000 | Number of lines to show. Specific to the ``ls`` instrumenting profiler. |
|
1001 | 1001 | Default: 30. |
|
1002 | 1002 | |
|
1003 | 1003 | ``nested`` |
|
1004 | 1004 | Show at most this number of lines of drill-down info after each main entry. |
|
1005 | 1005 | This can help explain the difference between Total and Inline. |
|
1006 | 1006 | Specific to the ``ls`` instrumenting profiler. |
|
1007 | 1007 | Default: 5. |
|
1008 | 1008 | |
|
1009 | 1009 | ``revsetalias`` |
|
1010 | 1010 | --------------- |
|
1011 | 1011 | |
|
1012 | 1012 | Alias definitions for revsets. See :hg:`help revsets` for details. |
|
1013 | 1013 | |
|
1014 | 1014 | ``server`` |
|
1015 | 1015 | ---------- |
|
1016 | 1016 | |
|
1017 | 1017 | Controls generic server settings. |
|
1018 | 1018 | |
|
1019 | 1019 | ``uncompressed`` |
|
1020 | 1020 | Whether to allow clients to clone a repository using the |
|
1021 | 1021 | uncompressed streaming protocol. This transfers about 40% more |
|
1022 | 1022 | data than a regular clone, but uses less memory and CPU on both |
|
1023 | 1023 | server and client. Over a LAN (100 Mbps or better) or a very fast |
|
1024 | 1024 | WAN, an uncompressed streaming clone is a lot faster (~10x) than a |
|
1025 | 1025 | regular clone. Over most WAN connections (anything slower than |
|
1026 | 1026 | about 6 Mbps), uncompressed streaming is slower, because of the |
|
1027 | 1027 | extra data transfer overhead. This mode will also temporarily hold |
|
1028 | 1028 | the write lock while determining what data to transfer. |
|
1029 | 1029 | Default is True. |
|
1030 | 1030 | |
|
1031 | 1031 | ``preferuncompressed`` |
|
1032 | 1032 | When set, clients will try to use the uncompressed streaming |
|
1033 | 1033 | protocol. Default is False. |
|
1034 | 1034 | |
|
1035 | 1035 | ``validate`` |
|
1036 | 1036 | Whether to validate the completeness of pushed changesets by |
|
1037 | 1037 | checking that all new file revisions specified in manifests are |
|
1038 | 1038 | present. Default is False. |
|
1039 | 1039 | |
|
1040 | 1040 | ``smtp`` |
|
1041 | 1041 | -------- |
|
1042 | 1042 | |
|
1043 | 1043 | Configuration for extensions that need to send email messages. |
|
1044 | 1044 | |
|
1045 | 1045 | ``host`` |
|
1046 | 1046 | Host name of mail server, e.g. "mail.example.com". |
|
1047 | 1047 | |
|
1048 | 1048 | ``port`` |
|
1049 | 1049 | Optional. Port to connect to on mail server. Default: 25. |
|
1050 | 1050 | |
|
1051 | 1051 | ``tls`` |
|
1052 | 1052 | Optional. Method to enable TLS when connecting to mail server: starttls, |
|
1053 | 1053 | smtps or none. Default: none. |
|
1054 | 1054 | |
|
1055 | 1055 | ``username`` |
|
1056 | 1056 | Optional. User name for authenticating with the SMTP server. |
|
1057 | 1057 | Default: none. |
|
1058 | 1058 | |
|
1059 | 1059 | ``password`` |
|
1060 | 1060 | Optional. Password for authenticating with the SMTP server. If not |
|
1061 | 1061 | specified, interactive sessions will prompt the user for a |
|
1062 | 1062 | password; non-interactive sessions will fail. Default: none. |
|
1063 | 1063 | |
|
1064 | 1064 | ``local_hostname`` |
|
1065 | 1065 | Optional. It's the hostname that the sender can use to identify |
|
1066 | 1066 | itself to the MTA. |
|
1067 | 1067 | |
|
1068 | 1068 | |
|
1069 | 1069 | ``subpaths`` |
|
1070 | 1070 | ------------ |
|
1071 | 1071 | |
|
1072 | 1072 | Subrepository source URLs can go stale if a remote server changes name |
|
1073 | 1073 | or becomes temporarily unavailable. This section lets you define |
|
1074 | 1074 | rewrite rules of the form:: |
|
1075 | 1075 | |
|
1076 | 1076 | <pattern> = <replacement> |
|
1077 | 1077 | |
|
1078 | 1078 | where ``pattern`` is a regular expression matching a subrepository |
|
1079 | 1079 | source URL and ``replacement`` is the replacement string used to |
|
1080 | 1080 | rewrite it. Groups can be matched in ``pattern`` and referenced in |
|
1081 | 1081 | ``replacements``. For instance:: |
|
1082 | 1082 | |
|
1083 | 1083 | http://server/(.*)-hg/ = http://hg.server/\1/ |
|
1084 | 1084 | |
|
1085 | 1085 | rewrites ``http://server/foo-hg/`` into ``http://hg.server/foo/``. |
|
1086 | 1086 | |
|
1087 | 1087 | Relative subrepository paths are first made absolute, and the |
|
1088 | 1088 | rewrite rules are then applied on the full (absolute) path. The rules |
|
1089 | 1089 | are applied in definition order. |
|
1090 | 1090 | |
|
1091 | 1091 | ``trusted`` |
|
1092 | 1092 | ----------- |
|
1093 | 1093 | |
|
1094 | 1094 | Mercurial will not use the settings in the |
|
1095 | 1095 | ``.hg/hgrc`` file from a repository if it doesn't belong to a trusted |
|
1096 | 1096 | user or to a trusted group, as various hgrc features allow arbitrary |
|
1097 | 1097 | commands to be run. This issue is often encountered when configuring |
|
1098 | 1098 | hooks or extensions for shared repositories or servers. However, |
|
1099 | 1099 | the web interface will use some safe settings from the ``[web]`` |
|
1100 | 1100 | section. |
|
1101 | 1101 | |
|
1102 | 1102 | This section specifies what users and groups are trusted. The |
|
1103 | 1103 | current user is always trusted. To trust everybody, list a user or a |
|
1104 | 1104 | group with name ``*``. These settings must be placed in an |
|
1105 | 1105 | *already-trusted file* to take effect, such as ``$HOME/.hgrc`` of the |
|
1106 | 1106 | user or service running Mercurial. |
|
1107 | 1107 | |
|
1108 | 1108 | ``users`` |
|
1109 | 1109 | Comma-separated list of trusted users. |
|
1110 | 1110 | |
|
1111 | 1111 | ``groups`` |
|
1112 | 1112 | Comma-separated list of trusted groups. |
|
1113 | 1113 | |
|
1114 | 1114 | |
|
1115 | 1115 | ``ui`` |
|
1116 | 1116 | ------ |
|
1117 | 1117 | |
|
1118 | 1118 | User interface controls. |
|
1119 | 1119 | |
|
1120 | 1120 | ``archivemeta`` |
|
1121 | 1121 | Whether to include the .hg_archival.txt file containing meta data |
|
1122 | 1122 | (hashes for the repository base and for tip) in archives created |
|
1123 | 1123 | by the :hg:`archive` command or downloaded via hgweb. |
|
1124 | 1124 | Default is True. |
|
1125 | 1125 | |
|
1126 | 1126 | ``askusername`` |
|
1127 | 1127 | Whether to prompt for a username when committing. If True, and |
|
1128 | 1128 | neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will |
|
1129 | 1129 | be prompted to enter a username. If no username is entered, the |
|
1130 | 1130 | default ``USER@HOST`` is used instead. |
|
1131 | 1131 | Default is False. |
|
1132 | 1132 | |
|
1133 | 1133 | ``commitsubrepos`` |
|
1134 | 1134 | Whether to commit modified subrepositories when committing the |
|
1135 | 1135 | parent repository. If False and one subrepository has uncommitted |
|
1136 | 1136 | changes, abort the commit. |
|
1137 | 1137 | Default is False. |
|
1138 | 1138 | |
|
1139 | 1139 | ``debug`` |
|
1140 | 1140 | Print debugging information. True or False. Default is False. |
|
1141 | 1141 | |
|
1142 | 1142 | ``editor`` |
|
1143 | 1143 | The editor to use during a commit. Default is ``$EDITOR`` or ``vi``. |
|
1144 | 1144 | |
|
1145 | 1145 | ``fallbackencoding`` |
|
1146 | 1146 | Encoding to try if it's not possible to decode the changelog using |
|
1147 | 1147 | UTF-8. Default is ISO-8859-1. |
|
1148 | 1148 | |
|
1149 | 1149 | ``ignore`` |
|
1150 | 1150 | A file to read per-user ignore patterns from. This file should be |
|
1151 | 1151 | in the same format as a repository-wide .hgignore file. This |
|
1152 | 1152 | option supports hook syntax, so if you want to specify multiple |
|
1153 | 1153 | ignore files, you can do so by setting something like |
|
1154 | 1154 | ``ignore.other = ~/.hgignore2``. For details of the ignore file |
|
1155 | 1155 | format, see the ``hgignore(5)`` man page. |
|
1156 | 1156 | |
|
1157 | 1157 | ``interactive`` |
|
1158 | 1158 | Allow to prompt the user. True or False. Default is True. |
|
1159 | 1159 | |
|
1160 | 1160 | ``logtemplate`` |
|
1161 | 1161 | Template string for commands that print changesets. |
|
1162 | 1162 | |
|
1163 | 1163 | ``merge`` |
|
1164 | 1164 | The conflict resolution program to use during a manual merge. |
|
1165 | 1165 | For more information on merge tools see :hg:`help merge-tools`. |
|
1166 | 1166 | For configuring merge tools see the ``[merge-tools]`` section. |
|
1167 | 1167 | |
|
1168 | 1168 | ``portablefilenames`` |
|
1169 | 1169 | Check for portable filenames. Can be ``warn``, ``ignore`` or ``abort``. |
|
1170 | 1170 | Default is ``warn``. |
|
1171 | 1171 | If set to ``warn`` (or ``true``), a warning message is printed on POSIX |
|
1172 | 1172 | platforms, if a file with a non-portable filename is added (e.g. a file |
|
1173 | 1173 | with a name that can't be created on Windows because it contains reserved |
|
1174 | 1174 | parts like ``AUX``, reserved characters like ``:``, or would cause a case |
|
1175 | 1175 | collision with an existing file). |
|
1176 | 1176 | If set to ``ignore`` (or ``false``), no warning is printed. |
|
1177 | 1177 | If set to ``abort``, the command is aborted. |
|
1178 | 1178 | On Windows, this configuration option is ignored and the command aborted. |
|
1179 | 1179 | |
|
1180 | 1180 | ``quiet`` |
|
1181 | 1181 | Reduce the amount of output printed. True or False. Default is False. |
|
1182 | 1182 | |
|
1183 | 1183 | ``remotecmd`` |
|
1184 | 1184 | remote command to use for clone/push/pull operations. Default is ``hg``. |
|
1185 | 1185 | |
|
1186 | 1186 | ``reportoldssl`` |
|
1187 | 1187 | Warn if an SSL certificate is unable to be due to using Python |
|
1188 | 1188 | 2.5 or earlier. True or False. Default is True. |
|
1189 | 1189 | |
|
1190 | 1190 | ``report_untrusted`` |
|
1191 | 1191 | Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a |
|
1192 | 1192 | trusted user or group. True or False. Default is True. |
|
1193 | 1193 | |
|
1194 | 1194 | ``slash`` |
|
1195 | 1195 | Display paths using a slash (``/``) as the path separator. This |
|
1196 | 1196 | only makes a difference on systems where the default path |
|
1197 | 1197 | separator is not the slash character (e.g. Windows uses the |
|
1198 | 1198 | backslash character (``\``)). |
|
1199 | 1199 | Default is False. |
|
1200 | 1200 | |
|
1201 | 1201 | ``ssh`` |
|
1202 | 1202 | command to use for SSH connections. Default is ``ssh``. |
|
1203 | 1203 | |
|
1204 | 1204 | ``strict`` |
|
1205 | 1205 | Require exact command names, instead of allowing unambiguous |
|
1206 | 1206 | abbreviations. True or False. Default is False. |
|
1207 | 1207 | |
|
1208 | 1208 | ``style`` |
|
1209 | 1209 | Name of style to use for command output. |
|
1210 | 1210 | |
|
1211 | 1211 | ``timeout`` |
|
1212 | 1212 | The timeout used when a lock is held (in seconds), a negative value |
|
1213 | 1213 | means no timeout. Default is 600. |
|
1214 | 1214 | |
|
1215 | 1215 | ``traceback`` |
|
1216 | 1216 | Mercurial always prints a traceback when an unknown exception |
|
1217 | 1217 | occurs. Setting this to True will make Mercurial print a traceback |
|
1218 | 1218 | on all exceptions, even those recognized by Mercurial (such as |
|
1219 | 1219 | IOError or MemoryError). Default is False. |
|
1220 | 1220 | |
|
1221 | 1221 | ``username`` |
|
1222 | 1222 | The committer of a changeset created when running "commit". |
|
1223 | 1223 | Typically a person's name and email address, e.g. ``Fred Widget |
|
1224 | 1224 | <fred@example.com>``. Default is ``$EMAIL`` or ``username@hostname``. If |
|
1225 | 1225 | the username in hgrc is empty, it has to be specified manually or |
|
1226 | 1226 | in a different hgrc file (e.g. ``$HOME/.hgrc``, if the admin set |
|
1227 | 1227 | ``username =`` in the system hgrc). Environment variables in the |
|
1228 | 1228 | username are expanded. |
|
1229 | 1229 | |
|
1230 | 1230 | ``verbose`` |
|
1231 | 1231 | Increase the amount of output printed. True or False. Default is False. |
|
1232 | 1232 | |
|
1233 | 1233 | |
|
1234 | 1234 | ``web`` |
|
1235 | 1235 | ------- |
|
1236 | 1236 | |
|
1237 | 1237 | Web interface configuration. The settings in this section apply to |
|
1238 | 1238 | both the builtin webserver (started by :hg:`serve`) and the script you |
|
1239 | 1239 | run through a webserver (``hgweb.cgi`` and the derivatives for FastCGI |
|
1240 | 1240 | and WSGI). |
|
1241 | 1241 | |
|
1242 | 1242 | The Mercurial webserver does no authentication (it does not prompt for |
|
1243 | 1243 | usernames and passwords to validate *who* users are), but it does do |
|
1244 | 1244 | authorization (it grants or denies access for *authenticated users* |
|
1245 | 1245 | based on settings in this section). You must either configure your |
|
1246 | 1246 | webserver to do authentication for you, or disable the authorization |
|
1247 | 1247 | checks. |
|
1248 | 1248 | |
|
1249 | 1249 | For a quick setup in a trusted environment, e.g., a private LAN, where |
|
1250 | 1250 | you want it to accept pushes from anybody, you can use the following |
|
1251 | 1251 | command line:: |
|
1252 | 1252 | |
|
1253 | 1253 | $ hg --config web.allow_push=* --config web.push_ssl=False serve |
|
1254 | 1254 | |
|
1255 | 1255 | Note that this will allow anybody to push anything to the server and |
|
1256 | 1256 | that this should not be used for public servers. |
|
1257 | 1257 | |
|
1258 | 1258 | The full set of options is: |
|
1259 | 1259 | |
|
1260 | 1260 | ``accesslog`` |
|
1261 | 1261 | Where to output the access log. Default is stdout. |
|
1262 | 1262 | |
|
1263 | 1263 | ``address`` |
|
1264 | 1264 | Interface address to bind to. Default is all. |
|
1265 | 1265 | |
|
1266 | 1266 | ``allow_archive`` |
|
1267 | 1267 | List of archive format (bz2, gz, zip) allowed for downloading. |
|
1268 | 1268 | Default is empty. |
|
1269 | 1269 | |
|
1270 | 1270 | ``allowbz2`` |
|
1271 | 1271 | (DEPRECATED) Whether to allow .tar.bz2 downloading of repository |
|
1272 | 1272 | revisions. |
|
1273 | 1273 | Default is False. |
|
1274 | 1274 | |
|
1275 | 1275 | ``allowgz`` |
|
1276 | 1276 | (DEPRECATED) Whether to allow .tar.gz downloading of repository |
|
1277 | 1277 | revisions. |
|
1278 | 1278 | Default is False. |
|
1279 | 1279 | |
|
1280 | 1280 | ``allowpull`` |
|
1281 | 1281 | Whether to allow pulling from the repository. Default is True. |
|
1282 | 1282 | |
|
1283 | 1283 | ``allow_push`` |
|
1284 | 1284 | Whether to allow pushing to the repository. If empty or not set, |
|
1285 | 1285 | push is not allowed. If the special value ``*``, any remote user can |
|
1286 | 1286 | push, including unauthenticated users. Otherwise, the remote user |
|
1287 | 1287 | must have been authenticated, and the authenticated user name must |
|
1288 | 1288 | be present in this list. The contents of the allow_push list are |
|
1289 | 1289 | examined after the deny_push list. |
|
1290 | 1290 | |
|
1291 | 1291 | ``allow_read`` |
|
1292 | 1292 | If the user has not already been denied repository access due to |
|
1293 | 1293 | the contents of deny_read, this list determines whether to grant |
|
1294 | 1294 | repository access to the user. If this list is not empty, and the |
|
1295 | 1295 | user is unauthenticated or not present in the list, then access is |
|
1296 | 1296 | denied for the user. If the list is empty or not set, then access |
|
1297 | 1297 | is permitted to all users by default. Setting allow_read to the |
|
1298 | 1298 | special value ``*`` is equivalent to it not being set (i.e. access |
|
1299 | 1299 | is permitted to all users). The contents of the allow_read list are |
|
1300 | 1300 | examined after the deny_read list. |
|
1301 | 1301 | |
|
1302 | 1302 | ``allowzip`` |
|
1303 | 1303 | (DEPRECATED) Whether to allow .zip downloading of repository |
|
1304 | 1304 | revisions. Default is False. This feature creates temporary files. |
|
1305 | 1305 | |
|
1306 | 1306 | ``archivesubrepos`` |
|
1307 | 1307 | Whether to recurse into subrepositories when archiving. Default is |
|
1308 | 1308 | False. |
|
1309 | 1309 | |
|
1310 | 1310 | ``baseurl`` |
|
1311 | 1311 | Base URL to use when publishing URLs in other locations, so |
|
1312 | 1312 | third-party tools like email notification hooks can construct |
|
1313 | 1313 | URLs. Example: ``http://hgserver/repos/``. |
|
1314 | 1314 | |
|
1315 | 1315 | ``cacerts`` |
|
1316 | 1316 | Path to file containing a list of PEM encoded certificate |
|
1317 | 1317 | authority certificates. Environment variables and ``~user`` |
|
1318 | 1318 | constructs are expanded in the filename. If specified on the |
|
1319 | 1319 | client, then it will verify the identity of remote HTTPS servers |
|
1320 | 1320 | with these certificates. |
|
1321 | 1321 | |
|
1322 | 1322 | This feature is only supported when using Python 2.6 or later. If you wish |
|
1323 | 1323 | to use it with earlier versions of Python, install the backported |
|
1324 | 1324 | version of the ssl library that is available from |
|
1325 | 1325 | ``http://pypi.python.org``. |
|
1326 | 1326 | |
|
1327 | 1327 | To disable SSL verification temporarily, specify ``--insecure`` from |
|
1328 | 1328 | command line. |
|
1329 | 1329 | |
|
1330 | 1330 | You can use OpenSSL's CA certificate file if your platform has |
|
1331 | 1331 | one. On most Linux systems this will be |
|
1332 | 1332 | ``/etc/ssl/certs/ca-certificates.crt``. Otherwise you will have to |
|
1333 | 1333 | generate this file manually. The form must be as follows:: |
|
1334 | 1334 | |
|
1335 | 1335 | -----BEGIN CERTIFICATE----- |
|
1336 | 1336 | ... (certificate in base64 PEM encoding) ... |
|
1337 | 1337 | -----END CERTIFICATE----- |
|
1338 | 1338 | -----BEGIN CERTIFICATE----- |
|
1339 | 1339 | ... (certificate in base64 PEM encoding) ... |
|
1340 | 1340 | -----END CERTIFICATE----- |
|
1341 | 1341 | |
|
1342 | 1342 | ``cache`` |
|
1343 | 1343 | Whether to support caching in hgweb. Defaults to True. |
|
1344 | 1344 | |
|
1345 | 1345 | ``collapse`` |
|
1346 | 1346 | With ``descend`` enabled, repositories in subdirectories are shown at |
|
1347 | 1347 | a single level alongside repositories in the current path. With |
|
1348 | 1348 | ``collapse`` also enabled, repositories residing at a deeper level than |
|
1349 | 1349 | the current path are grouped behind navigable directory entries that |
|
1350 | 1350 | lead to the locations of these repositories. In effect, this setting |
|
1351 | 1351 | collapses each collection of repositories found within a subdirectory |
|
1352 | 1352 | into a single entry for that subdirectory. Default is False. |
|
1353 | 1353 | |
|
1354 | 1354 | ``comparisoncontext`` |
|
1355 | 1355 | Number of lines of context to show in side-by-side file comparison. If |
|
1356 | 1356 | negative or the value ``full``, whole files are shown. Default is 5. |
|
1357 | 1357 | This setting can be overridden by a ``context`` request parameter to the |
|
1358 | 1358 | ``comparison`` command, taking the same values. |
|
1359 | 1359 | |
|
1360 | 1360 | ``contact`` |
|
1361 | 1361 | Name or email address of the person in charge of the repository. |
|
1362 | 1362 | Defaults to ui.username or ``$EMAIL`` or "unknown" if unset or empty. |
|
1363 | 1363 | |
|
1364 | 1364 | ``deny_push`` |
|
1365 | 1365 | Whether to deny pushing to the repository. If empty or not set, |
|
1366 | 1366 | push is not denied. If the special value ``*``, all remote users are |
|
1367 | 1367 | denied push. Otherwise, unauthenticated users are all denied, and |
|
1368 | 1368 | any authenticated user name present in this list is also denied. The |
|
1369 | 1369 | contents of the deny_push list are examined before the allow_push list. |
|
1370 | 1370 | |
|
1371 | 1371 | ``deny_read`` |
|
1372 | 1372 | Whether to deny reading/viewing of the repository. If this list is |
|
1373 | 1373 | not empty, unauthenticated users are all denied, and any |
|
1374 | 1374 | authenticated user name present in this list is also denied access to |
|
1375 | 1375 | the repository. If set to the special value ``*``, all remote users |
|
1376 | 1376 | are denied access (rarely needed ;). If deny_read is empty or not set, |
|
1377 | 1377 | the determination of repository access depends on the presence and |
|
1378 | 1378 | content of the allow_read list (see description). If both |
|
1379 | 1379 | deny_read and allow_read are empty or not set, then access is |
|
1380 | 1380 | permitted to all users by default. If the repository is being |
|
1381 | 1381 | served via hgwebdir, denied users will not be able to see it in |
|
1382 | 1382 | the list of repositories. The contents of the deny_read list have |
|
1383 | 1383 | priority over (are examined before) the contents of the allow_read |
|
1384 | 1384 | list. |
|
1385 | 1385 | |
|
1386 | 1386 | ``descend`` |
|
1387 | 1387 | hgwebdir indexes will not descend into subdirectories. Only repositories |
|
1388 | 1388 | directly in the current path will be shown (other repositories are still |
|
1389 | 1389 | available from the index corresponding to their containing path). |
|
1390 | 1390 | |
|
1391 | 1391 | ``description`` |
|
1392 | 1392 | Textual description of the repository's purpose or contents. |
|
1393 | 1393 | Default is "unknown". |
|
1394 | 1394 | |
|
1395 | 1395 | ``encoding`` |
|
1396 | 1396 | Character encoding name. Default is the current locale charset. |
|
1397 | 1397 | Example: "UTF-8" |
|
1398 | 1398 | |
|
1399 | 1399 | ``errorlog`` |
|
1400 | 1400 | Where to output the error log. Default is stderr. |
|
1401 | 1401 | |
|
1402 | 1402 | ``guessmime`` |
|
1403 | 1403 | Control MIME types for raw download of file content. |
|
1404 | 1404 | Set to True to let hgweb guess the content type from the file |
|
1405 | 1405 | extension. This will serve HTML files as ``text/html`` and might |
|
1406 | 1406 | allow cross-site scripting attacks when serving untrusted |
|
1407 | 1407 | repositories. Default is False. |
|
1408 | 1408 | |
|
1409 | 1409 | ``hidden`` |
|
1410 | 1410 | Whether to hide the repository in the hgwebdir index. |
|
1411 | 1411 | Default is False. |
|
1412 | 1412 | |
|
1413 | 1413 | ``ipv6`` |
|
1414 | 1414 | Whether to use IPv6. Default is False. |
|
1415 | 1415 | |
|
1416 | 1416 | ``logoimg`` |
|
1417 | 1417 | File name of the logo image that some templates display on each page. |
|
1418 | 1418 | The file name is relative to ``staticurl``. That is, the full path to |
|
1419 | 1419 | the logo image is "staticurl/logoimg". |
|
1420 | 1420 | If unset, ``hglogo.png`` will be used. |
|
1421 | 1421 | |
|
1422 | 1422 | ``logourl`` |
|
1423 | 1423 | Base URL to use for logos. If unset, ``http://mercurial.selenic.com/`` |
|
1424 | 1424 | will be used. |
|
1425 | 1425 | |
|
1426 | 1426 | ``maxchanges`` |
|
1427 | 1427 | Maximum number of changes to list on the changelog. Default is 10. |
|
1428 | 1428 | |
|
1429 | 1429 | ``maxfiles`` |
|
1430 | 1430 | Maximum number of files to list per changeset. Default is 10. |
|
1431 | 1431 | |
|
1432 | 1432 | ``maxshortchanges`` |
|
1433 | 1433 | Maximum number of changes to list on the shortlog, graph or filelog |
|
1434 | 1434 | pages. Default is 60. |
|
1435 | 1435 | |
|
1436 | 1436 | ``name`` |
|
1437 | 1437 | Repository name to use in the web interface. Default is current |
|
1438 | 1438 | working directory. |
|
1439 | 1439 | |
|
1440 | 1440 | ``port`` |
|
1441 | 1441 | Port to listen on. Default is 8000. |
|
1442 | 1442 | |
|
1443 | 1443 | ``prefix`` |
|
1444 | 1444 | Prefix path to serve from. Default is '' (server root). |
|
1445 | 1445 | |
|
1446 | 1446 | ``push_ssl`` |
|
1447 | 1447 | Whether to require that inbound pushes be transported over SSL to |
|
1448 | 1448 | prevent password sniffing. Default is True. |
|
1449 | 1449 | |
|
1450 | 1450 | ``staticurl`` |
|
1451 | 1451 | Base URL to use for static files. If unset, static files (e.g. the |
|
1452 | 1452 | hgicon.png favicon) will be served by the CGI script itself. Use |
|
1453 | 1453 | this setting to serve them directly with the HTTP server. |
|
1454 | 1454 | Example: ``http://hgserver/static/``. |
|
1455 | 1455 | |
|
1456 | 1456 | ``stripes`` |
|
1457 | 1457 | How many lines a "zebra stripe" should span in multi-line output. |
|
1458 | 1458 | Default is 1; set to 0 to disable. |
|
1459 | 1459 | |
|
1460 | 1460 | ``style`` |
|
1461 | 1461 | Which template map style to use. |
|
1462 | 1462 | |
|
1463 | 1463 | ``templates`` |
|
1464 | 1464 | Where to find the HTML templates. Default is install path. |
|
1465 | 1465 | |
|
1466 | ``websub`` | |
|
1467 | ---------- | |
|
1468 | ||
|
1469 | Web substitution filter definition. You can use this section to | |
|
1470 | define a set of regular expression substitution patterns which | |
|
1471 | let you automatically modify the hgweb server output. | |
|
1472 | ||
|
1473 | The default hgweb templates only apply these substitution patterns | |
|
1474 | on the revision description fields. You can apply them anywhere | |
|
1475 | you want when you create your own templates by adding calls to the | |
|
1476 | "websub" filter (usually after calling the "escape" filter). | |
|
1477 | ||
|
1478 | This can be used, for example, to convert issue references to links | |
|
1479 | to your issue tracker, or to convert "markdown-like" syntax into | |
|
1480 | HTML (see the examples below). | |
|
1481 | ||
|
1482 | Each entry in this section names a substitution filter. | |
|
1483 | The value of each entry defines the substitution expression itself. | |
|
1484 | The websub expressions follow the old interhg extension syntax, | |
|
1485 | which in turn imitates the Unix sed replacement syntax:: | |
|
1486 | ||
|
1487 | pattername = s/SEARCH_REGEX/REPLACE_EXPRESSION/[i] | |
|
1488 | ||
|
1489 | You can use any separator other than "/". The final "i" is optional | |
|
1490 | and indicates that the search must be case insensitive. | |
|
1491 | ||
|
1492 | Examples:: | |
|
1493 | ||
|
1494 | [websub] | |
|
1495 | issues = s|issue(\d+)|<a href="http://bts.example.org/issue\1">issue\1</a>|i | |
|
1496 | italic = s/\b_(\S+)_\b/<i>\1<\/i>/ | |
|
1497 | bold = s/\*\b(\S+)\b\*/<b>\1<\/b>/ | |
|
1498 | ||
|
1466 | 1499 | ``worker`` |
|
1467 | 1500 | ---------- |
|
1468 | 1501 | |
|
1469 | 1502 | Parallel master/worker configuration. We currently perform working |
|
1470 | 1503 | directory updates in parallel on Unix-like systems, which greatly |
|
1471 | 1504 | helps performance. |
|
1472 | 1505 | |
|
1473 | 1506 | ``numcpus`` |
|
1474 | 1507 | Number of CPUs to use for parallel operations. Default is 4 or the |
|
1475 | 1508 | number of CPUs on the system, whichever is larger. A zero or |
|
1476 | 1509 | negative value is treated as ``use the default``. |
@@ -1,345 +1,393 b'' | |||
|
1 | 1 | # hgweb/hgweb_mod.py - Web interface for a repository. |
|
2 | 2 | # |
|
3 | 3 | # Copyright 21 May 2005 - (c) 2005 Jake Edge <jake@edge2.net> |
|
4 | 4 | # Copyright 2005-2007 Matt Mackall <mpm@selenic.com> |
|
5 | 5 | # |
|
6 | 6 | # This software may be used and distributed according to the terms of the |
|
7 | 7 | # GNU General Public License version 2 or any later version. |
|
8 | 8 | |
|
9 | 9 | import os |
|
10 | 10 | from mercurial import ui, hg, hook, error, encoding, templater, util, repoview |
|
11 | from mercurial.templatefilters import websub | |
|
12 | from mercurial.i18n import _ | |
|
11 | 13 | from common import get_stat, ErrorResponse, permhooks, caching |
|
12 | 14 | from common import HTTP_OK, HTTP_NOT_MODIFIED, HTTP_BAD_REQUEST |
|
13 | 15 | from common import HTTP_NOT_FOUND, HTTP_SERVER_ERROR |
|
14 | 16 | from request import wsgirequest |
|
15 | import webcommands, protocol, webutil | |
|
17 | import webcommands, protocol, webutil, re | |
|
16 | 18 | |
|
17 | 19 | perms = { |
|
18 | 20 | 'changegroup': 'pull', |
|
19 | 21 | 'changegroupsubset': 'pull', |
|
20 | 22 | 'getbundle': 'pull', |
|
21 | 23 | 'stream_out': 'pull', |
|
22 | 24 | 'listkeys': 'pull', |
|
23 | 25 | 'unbundle': 'push', |
|
24 | 26 | 'pushkey': 'push', |
|
25 | 27 | } |
|
26 | 28 | |
|
27 | 29 | def makebreadcrumb(url, prefix=''): |
|
28 | 30 | '''Return a 'URL breadcrumb' list |
|
29 | 31 | |
|
30 | 32 | A 'URL breadcrumb' is a list of URL-name pairs, |
|
31 | 33 | corresponding to each of the path items on a URL. |
|
32 | 34 | This can be used to create path navigation entries. |
|
33 | 35 | ''' |
|
34 | 36 | if url.endswith('/'): |
|
35 | 37 | url = url[:-1] |
|
36 | 38 | if prefix: |
|
37 | 39 | url = '/' + prefix + url |
|
38 | 40 | relpath = url |
|
39 | 41 | if relpath.startswith('/'): |
|
40 | 42 | relpath = relpath[1:] |
|
41 | 43 | |
|
42 | 44 | breadcrumb = [] |
|
43 | 45 | urlel = url |
|
44 | 46 | pathitems = [''] + relpath.split('/') |
|
45 | 47 | for pathel in reversed(pathitems): |
|
46 | 48 | if not pathel or not urlel: |
|
47 | 49 | break |
|
48 | 50 | breadcrumb.append({'url': urlel, 'name': pathel}) |
|
49 | 51 | urlel = os.path.dirname(urlel) |
|
50 | 52 | return reversed(breadcrumb) |
|
51 | 53 | |
|
52 | 54 | |
|
53 | 55 | class hgweb(object): |
|
54 | 56 | def __init__(self, repo, name=None, baseui=None): |
|
55 | 57 | if isinstance(repo, str): |
|
56 | 58 | if baseui: |
|
57 | 59 | u = baseui.copy() |
|
58 | 60 | else: |
|
59 | 61 | u = ui.ui() |
|
60 | 62 | self.repo = hg.repository(u, repo) |
|
61 | 63 | else: |
|
62 | 64 | self.repo = repo |
|
63 | 65 | |
|
64 | 66 | self.repo = self._getview(self.repo) |
|
65 | 67 | self.repo.ui.setconfig('ui', 'report_untrusted', 'off') |
|
66 | 68 | self.repo.ui.setconfig('ui', 'nontty', 'true') |
|
67 | 69 | hook.redirect(True) |
|
68 | 70 | self.mtime = -1 |
|
69 | 71 | self.size = -1 |
|
70 | 72 | self.reponame = name |
|
71 | 73 | self.archives = 'zip', 'gz', 'bz2' |
|
72 | 74 | self.stripecount = 1 |
|
73 | 75 | # a repo owner may set web.templates in .hg/hgrc to get any file |
|
74 | 76 | # readable by the user running the CGI script |
|
75 | 77 | self.templatepath = self.config('web', 'templates') |
|
78 | self.websubtable = self.loadwebsub() | |
|
76 | 79 | |
|
77 | 80 | # The CGI scripts are often run by a user different from the repo owner. |
|
78 | 81 | # Trust the settings from the .hg/hgrc files by default. |
|
79 | 82 | def config(self, section, name, default=None, untrusted=True): |
|
80 | 83 | return self.repo.ui.config(section, name, default, |
|
81 | 84 | untrusted=untrusted) |
|
82 | 85 | |
|
83 | 86 | def configbool(self, section, name, default=False, untrusted=True): |
|
84 | 87 | return self.repo.ui.configbool(section, name, default, |
|
85 | 88 | untrusted=untrusted) |
|
86 | 89 | |
|
87 | 90 | def configlist(self, section, name, default=None, untrusted=True): |
|
88 | 91 | return self.repo.ui.configlist(section, name, default, |
|
89 | 92 | untrusted=untrusted) |
|
90 | 93 | |
|
91 | 94 | def _getview(self, repo): |
|
92 | 95 | viewconfig = self.config('web', 'view', 'served') |
|
93 | 96 | if viewconfig == 'all': |
|
94 | 97 | return repo.unfiltered() |
|
95 | 98 | elif viewconfig in repoview.filtertable: |
|
96 | 99 | return repo.filtered(viewconfig) |
|
97 | 100 | else: |
|
98 | 101 | return repo.filtered('served') |
|
99 | 102 | |
|
100 | 103 | def refresh(self, request=None): |
|
101 | 104 | if request: |
|
102 | 105 | self.repo.ui.environ = request.env |
|
103 | 106 | st = get_stat(self.repo.spath) |
|
104 | 107 | # compare changelog size in addition to mtime to catch |
|
105 | 108 | # rollbacks made less than a second ago |
|
106 | 109 | if st.st_mtime != self.mtime or st.st_size != self.size: |
|
107 | 110 | self.mtime = st.st_mtime |
|
108 | 111 | self.size = st.st_size |
|
109 | 112 | self.repo = hg.repository(self.repo.ui, self.repo.root) |
|
110 | 113 | self.repo = self._getview(self.repo) |
|
111 | 114 | self.maxchanges = int(self.config("web", "maxchanges", 10)) |
|
112 | 115 | self.stripecount = int(self.config("web", "stripes", 1)) |
|
113 | 116 | self.maxshortchanges = int(self.config("web", "maxshortchanges", |
|
114 | 117 | 60)) |
|
115 | 118 | self.maxfiles = int(self.config("web", "maxfiles", 10)) |
|
116 | 119 | self.allowpull = self.configbool("web", "allowpull", True) |
|
117 | 120 | encoding.encoding = self.config("web", "encoding", |
|
118 | 121 | encoding.encoding) |
|
119 | 122 | |
|
120 | 123 | def run(self): |
|
121 | 124 | if not os.environ.get('GATEWAY_INTERFACE', '').startswith("CGI/1."): |
|
122 | 125 | raise RuntimeError("This function is only intended to be " |
|
123 | 126 | "called while running as a CGI script.") |
|
124 | 127 | import mercurial.hgweb.wsgicgi as wsgicgi |
|
125 | 128 | wsgicgi.launch(self) |
|
126 | 129 | |
|
127 | 130 | def __call__(self, env, respond): |
|
128 | 131 | req = wsgirequest(env, respond) |
|
129 | 132 | return self.run_wsgi(req) |
|
130 | 133 | |
|
131 | 134 | def run_wsgi(self, req): |
|
132 | 135 | |
|
133 | 136 | self.refresh(req) |
|
134 | 137 | |
|
135 | 138 | # work with CGI variables to create coherent structure |
|
136 | 139 | # use SCRIPT_NAME, PATH_INFO and QUERY_STRING as well as our REPO_NAME |
|
137 | 140 | |
|
138 | 141 | req.url = req.env['SCRIPT_NAME'] |
|
139 | 142 | if not req.url.endswith('/'): |
|
140 | 143 | req.url += '/' |
|
141 | 144 | if 'REPO_NAME' in req.env: |
|
142 | 145 | req.url += req.env['REPO_NAME'] + '/' |
|
143 | 146 | |
|
144 | 147 | if 'PATH_INFO' in req.env: |
|
145 | 148 | parts = req.env['PATH_INFO'].strip('/').split('/') |
|
146 | 149 | repo_parts = req.env.get('REPO_NAME', '').split('/') |
|
147 | 150 | if parts[:len(repo_parts)] == repo_parts: |
|
148 | 151 | parts = parts[len(repo_parts):] |
|
149 | 152 | query = '/'.join(parts) |
|
150 | 153 | else: |
|
151 | 154 | query = req.env['QUERY_STRING'].split('&', 1)[0] |
|
152 | 155 | query = query.split(';', 1)[0] |
|
153 | 156 | |
|
154 | 157 | # process this if it's a protocol request |
|
155 | 158 | # protocol bits don't need to create any URLs |
|
156 | 159 | # and the clients always use the old URL structure |
|
157 | 160 | |
|
158 | 161 | cmd = req.form.get('cmd', [''])[0] |
|
159 | 162 | if protocol.iscmd(cmd): |
|
160 | 163 | try: |
|
161 | 164 | if query: |
|
162 | 165 | raise ErrorResponse(HTTP_NOT_FOUND) |
|
163 | 166 | if cmd in perms: |
|
164 | 167 | self.check_perm(req, perms[cmd]) |
|
165 | 168 | return protocol.call(self.repo, req, cmd) |
|
166 | 169 | except ErrorResponse, inst: |
|
167 | 170 | # A client that sends unbundle without 100-continue will |
|
168 | 171 | # break if we respond early. |
|
169 | 172 | if (cmd == 'unbundle' and |
|
170 | 173 | (req.env.get('HTTP_EXPECT', |
|
171 | 174 | '').lower() != '100-continue') or |
|
172 | 175 | req.env.get('X-HgHttp2', '')): |
|
173 | 176 | req.drain() |
|
174 | 177 | req.respond(inst, protocol.HGTYPE, |
|
175 | 178 | body='0\n%s\n' % inst.message) |
|
176 | 179 | return '' |
|
177 | 180 | |
|
178 | 181 | # translate user-visible url structure to internal structure |
|
179 | 182 | |
|
180 | 183 | args = query.split('/', 2) |
|
181 | 184 | if 'cmd' not in req.form and args and args[0]: |
|
182 | 185 | |
|
183 | 186 | cmd = args.pop(0) |
|
184 | 187 | style = cmd.rfind('-') |
|
185 | 188 | if style != -1: |
|
186 | 189 | req.form['style'] = [cmd[:style]] |
|
187 | 190 | cmd = cmd[style + 1:] |
|
188 | 191 | |
|
189 | 192 | # avoid accepting e.g. style parameter as command |
|
190 | 193 | if util.safehasattr(webcommands, cmd): |
|
191 | 194 | req.form['cmd'] = [cmd] |
|
192 | 195 | else: |
|
193 | 196 | cmd = '' |
|
194 | 197 | |
|
195 | 198 | if cmd == 'static': |
|
196 | 199 | req.form['file'] = ['/'.join(args)] |
|
197 | 200 | else: |
|
198 | 201 | if args and args[0]: |
|
199 | 202 | node = args.pop(0) |
|
200 | 203 | req.form['node'] = [node] |
|
201 | 204 | if args: |
|
202 | 205 | req.form['file'] = args |
|
203 | 206 | |
|
204 | 207 | ua = req.env.get('HTTP_USER_AGENT', '') |
|
205 | 208 | if cmd == 'rev' and 'mercurial' in ua: |
|
206 | 209 | req.form['style'] = ['raw'] |
|
207 | 210 | |
|
208 | 211 | if cmd == 'archive': |
|
209 | 212 | fn = req.form['node'][0] |
|
210 | 213 | for type_, spec in self.archive_specs.iteritems(): |
|
211 | 214 | ext = spec[2] |
|
212 | 215 | if fn.endswith(ext): |
|
213 | 216 | req.form['node'] = [fn[:-len(ext)]] |
|
214 | 217 | req.form['type'] = [type_] |
|
215 | 218 | |
|
216 | 219 | # process the web interface request |
|
217 | 220 | |
|
218 | 221 | try: |
|
219 | 222 | tmpl = self.templater(req) |
|
220 | 223 | ctype = tmpl('mimetype', encoding=encoding.encoding) |
|
221 | 224 | ctype = templater.stringify(ctype) |
|
222 | 225 | |
|
223 | 226 | # check read permissions non-static content |
|
224 | 227 | if cmd != 'static': |
|
225 | 228 | self.check_perm(req, None) |
|
226 | 229 | |
|
227 | 230 | if cmd == '': |
|
228 | 231 | req.form['cmd'] = [tmpl.cache['default']] |
|
229 | 232 | cmd = req.form['cmd'][0] |
|
230 | 233 | |
|
231 | 234 | if self.configbool('web', 'cache', True): |
|
232 | 235 | caching(self, req) # sets ETag header or raises NOT_MODIFIED |
|
233 | 236 | if cmd not in webcommands.__all__: |
|
234 | 237 | msg = 'no such method: %s' % cmd |
|
235 | 238 | raise ErrorResponse(HTTP_BAD_REQUEST, msg) |
|
236 | 239 | elif cmd == 'file' and 'raw' in req.form.get('style', []): |
|
237 | 240 | self.ctype = ctype |
|
238 | 241 | content = webcommands.rawfile(self, req, tmpl) |
|
239 | 242 | else: |
|
240 | 243 | content = getattr(webcommands, cmd)(self, req, tmpl) |
|
241 | 244 | req.respond(HTTP_OK, ctype) |
|
242 | 245 | |
|
243 | 246 | return content |
|
244 | 247 | |
|
245 | 248 | except (error.LookupError, error.RepoLookupError), err: |
|
246 | 249 | req.respond(HTTP_NOT_FOUND, ctype) |
|
247 | 250 | msg = str(err) |
|
248 | 251 | if util.safehasattr(err, 'name') and 'manifest' not in msg: |
|
249 | 252 | msg = 'revision not found: %s' % err.name |
|
250 | 253 | return tmpl('error', error=msg) |
|
251 | 254 | except (error.RepoError, error.RevlogError), inst: |
|
252 | 255 | req.respond(HTTP_SERVER_ERROR, ctype) |
|
253 | 256 | return tmpl('error', error=str(inst)) |
|
254 | 257 | except ErrorResponse, inst: |
|
255 | 258 | req.respond(inst, ctype) |
|
256 | 259 | if inst.code == HTTP_NOT_MODIFIED: |
|
257 | 260 | # Not allowed to return a body on a 304 |
|
258 | 261 | return [''] |
|
259 | 262 | return tmpl('error', error=inst.message) |
|
260 | 263 | |
|
264 | def loadwebsub(self): | |
|
265 | websubtable = [] | |
|
266 | websubdefs = self.repo.ui.configitems('websub') | |
|
267 | # we must maintain interhg backwards compatibility | |
|
268 | websubdefs += self.repo.ui.configitems('interhg') | |
|
269 | for key, pattern in websubdefs: | |
|
270 | # grab the delimiter from the character after the "s" | |
|
271 | unesc = pattern[1] | |
|
272 | delim = re.escape(unesc) | |
|
273 | ||
|
274 | # identify portions of the pattern, taking care to avoid escaped | |
|
275 | # delimiters. the replace format and flags are optional, but | |
|
276 | # delimiters are required. | |
|
277 | match = re.match( | |
|
278 | r'^s%s(.+)(?:(?<=\\\\)|(?<!\\))%s(.*)%s([ilmsux])*$' | |
|
279 | % (delim, delim, delim), pattern) | |
|
280 | if not match: | |
|
281 | self.repo.ui.warn(_("websub: invalid pattern for %s: %s\n") | |
|
282 | % (key, pattern)) | |
|
283 | continue | |
|
284 | ||
|
285 | # we need to unescape the delimiter for regexp and format | |
|
286 | delim_re = re.compile(r'(?<!\\)\\%s' % delim) | |
|
287 | regexp = delim_re.sub(unesc, match.group(1)) | |
|
288 | format = delim_re.sub(unesc, match.group(2)) | |
|
289 | ||
|
290 | # the pattern allows for 6 regexp flags, so set them if necessary | |
|
291 | flagin = match.group(3) | |
|
292 | flags = 0 | |
|
293 | if flagin: | |
|
294 | for flag in flagin.upper(): | |
|
295 | flags |= re.__dict__[flag] | |
|
296 | ||
|
297 | try: | |
|
298 | regexp = re.compile(regexp, flags) | |
|
299 | websubtable.append((regexp, format)) | |
|
300 | except re.error: | |
|
301 | self.repo.ui.warn(_("websub: invalid regexp for %s: %s\n") | |
|
302 | % (key, regexp)) | |
|
303 | return websubtable | |
|
304 | ||
|
261 | 305 | def templater(self, req): |
|
262 | 306 | |
|
263 | 307 | # determine scheme, port and server name |
|
264 | 308 | # this is needed to create absolute urls |
|
265 | 309 | |
|
266 | 310 | proto = req.env.get('wsgi.url_scheme') |
|
267 | 311 | if proto == 'https': |
|
268 | 312 | proto = 'https' |
|
269 | 313 | default_port = "443" |
|
270 | 314 | else: |
|
271 | 315 | proto = 'http' |
|
272 | 316 | default_port = "80" |
|
273 | 317 | |
|
274 | 318 | port = req.env["SERVER_PORT"] |
|
275 | 319 | port = port != default_port and (":" + port) or "" |
|
276 | 320 | urlbase = '%s://%s%s' % (proto, req.env['SERVER_NAME'], port) |
|
277 | 321 | logourl = self.config("web", "logourl", "http://mercurial.selenic.com/") |
|
278 | 322 | logoimg = self.config("web", "logoimg", "hglogo.png") |
|
279 | 323 | staticurl = self.config("web", "staticurl") or req.url + 'static/' |
|
280 | 324 | if not staticurl.endswith('/'): |
|
281 | 325 | staticurl += '/' |
|
282 | 326 | |
|
283 | 327 | # some functions for the templater |
|
284 | 328 | |
|
285 | 329 | def header(**map): |
|
286 | 330 | yield tmpl('header', encoding=encoding.encoding, **map) |
|
287 | 331 | |
|
288 | 332 | def footer(**map): |
|
289 | 333 | yield tmpl("footer", **map) |
|
290 | 334 | |
|
291 | 335 | def motd(**map): |
|
292 | 336 | yield self.config("web", "motd", "") |
|
293 | 337 | |
|
294 | 338 | # figure out which style to use |
|
295 | 339 | |
|
296 | 340 | vars = {} |
|
297 | 341 | styles = ( |
|
298 | 342 | req.form.get('style', [None])[0], |
|
299 | 343 | self.config('web', 'style'), |
|
300 | 344 | 'paper', |
|
301 | 345 | ) |
|
302 | 346 | style, mapfile = templater.stylemap(styles, self.templatepath) |
|
303 | 347 | if style == styles[0]: |
|
304 | 348 | vars['style'] = style |
|
305 | 349 | |
|
306 | 350 | start = req.url[-1] == '?' and '&' or '?' |
|
307 | 351 | sessionvars = webutil.sessionvars(vars, start) |
|
308 | 352 | |
|
309 | 353 | if not self.reponame: |
|
310 | 354 | self.reponame = (self.config("web", "name") |
|
311 | 355 | or req.env.get('REPO_NAME') |
|
312 | 356 | or req.url.strip('/') or self.repo.root) |
|
313 | 357 | |
|
358 | def websubfilter(text): | |
|
359 | return websub(text, self.websubtable) | |
|
360 | ||
|
314 | 361 | # create the templater |
|
315 | 362 | |
|
316 | 363 | tmpl = templater.templater(mapfile, |
|
364 | filters={"websub": websubfilter}, | |
|
317 | 365 | defaults={"url": req.url, |
|
318 | 366 | "logourl": logourl, |
|
319 | 367 | "logoimg": logoimg, |
|
320 | 368 | "staticurl": staticurl, |
|
321 | 369 | "urlbase": urlbase, |
|
322 | 370 | "repo": self.reponame, |
|
323 | 371 | "header": header, |
|
324 | 372 | "footer": footer, |
|
325 | 373 | "motd": motd, |
|
326 | 374 | "sessionvars": sessionvars, |
|
327 | 375 | "pathdef": makebreadcrumb(req.url), |
|
328 | 376 | }) |
|
329 | 377 | return tmpl |
|
330 | 378 | |
|
331 | 379 | def archivelist(self, nodeid): |
|
332 | 380 | allowed = self.configlist("web", "allow_archive") |
|
333 | 381 | for i, spec in self.archive_specs.iteritems(): |
|
334 | 382 | if i in allowed or self.configbool("web", "allow" + i): |
|
335 | 383 | yield {"type" : i, "extension" : spec[2], "node" : nodeid} |
|
336 | 384 | |
|
337 | 385 | archive_specs = { |
|
338 | 386 | 'bz2': ('application/x-bzip2', 'tbz2', '.tar.bz2', None), |
|
339 | 387 | 'gz': ('application/x-gzip', 'tgz', '.tar.gz', None), |
|
340 | 388 | 'zip': ('application/zip', 'zip', '.zip', None), |
|
341 | 389 | } |
|
342 | 390 | |
|
343 | 391 | def check_perm(self, req, op): |
|
344 | 392 | for hook in permhooks: |
|
345 | 393 | hook(self, req, op) |
@@ -1,1003 +1,1003 b'' | |||
|
1 | 1 | # scmutil.py - Mercurial core utility functions |
|
2 | 2 | # |
|
3 | 3 | # Copyright Matt Mackall <mpm@selenic.com> |
|
4 | 4 | # |
|
5 | 5 | # This software may be used and distributed according to the terms of the |
|
6 | 6 | # GNU General Public License version 2 or any later version. |
|
7 | 7 | |
|
8 | 8 | from i18n import _ |
|
9 | 9 | from mercurial.node import nullrev |
|
10 | 10 | import util, error, osutil, revset, similar, encoding, phases |
|
11 | 11 | import match as matchmod |
|
12 | 12 | import os, errno, re, stat, sys, glob |
|
13 | 13 | |
|
14 | 14 | def nochangesfound(ui, repo, excluded=None): |
|
15 | 15 | '''Report no changes for push/pull, excluded is None or a list of |
|
16 | 16 | nodes excluded from the push/pull. |
|
17 | 17 | ''' |
|
18 | 18 | secretlist = [] |
|
19 | 19 | if excluded: |
|
20 | 20 | for n in excluded: |
|
21 | 21 | if n not in repo: |
|
22 | 22 | # discovery should not have included the filtered revision, |
|
23 | 23 | # we have to explicitly exclude it until discovery is cleanup. |
|
24 | 24 | continue |
|
25 | 25 | ctx = repo[n] |
|
26 | 26 | if ctx.phase() >= phases.secret and not ctx.extinct(): |
|
27 | 27 | secretlist.append(n) |
|
28 | 28 | |
|
29 | 29 | if secretlist: |
|
30 | 30 | ui.status(_("no changes found (ignored %d secret changesets)\n") |
|
31 | 31 | % len(secretlist)) |
|
32 | 32 | else: |
|
33 | 33 | ui.status(_("no changes found\n")) |
|
34 | 34 | |
|
35 | 35 | def checknewlabel(repo, lbl, kind): |
|
36 | 36 | if lbl in ['tip', '.', 'null']: |
|
37 | 37 | raise util.Abort(_("the name '%s' is reserved") % lbl) |
|
38 | 38 | for c in (':', '\0', '\n', '\r'): |
|
39 | 39 | if c in lbl: |
|
40 | 40 | raise util.Abort(_("%r cannot be used in a name") % c) |
|
41 | 41 | try: |
|
42 | 42 | int(lbl) |
|
43 | 43 | raise util.Abort(_("a %s cannot have an integer as its name") % kind) |
|
44 | 44 | except ValueError: |
|
45 | 45 | pass |
|
46 | 46 | |
|
47 | 47 | def checkfilename(f): |
|
48 | 48 | '''Check that the filename f is an acceptable filename for a tracked file''' |
|
49 | 49 | if '\r' in f or '\n' in f: |
|
50 | 50 | raise util.Abort(_("'\\n' and '\\r' disallowed in filenames: %r") % f) |
|
51 | 51 | |
|
52 | 52 | def checkportable(ui, f): |
|
53 | 53 | '''Check if filename f is portable and warn or abort depending on config''' |
|
54 | 54 | checkfilename(f) |
|
55 | 55 | abort, warn = checkportabilityalert(ui) |
|
56 | 56 | if abort or warn: |
|
57 | 57 | msg = util.checkwinfilename(f) |
|
58 | 58 | if msg: |
|
59 | 59 | msg = "%s: %r" % (msg, f) |
|
60 | 60 | if abort: |
|
61 | 61 | raise util.Abort(msg) |
|
62 | 62 | ui.warn(_("warning: %s\n") % msg) |
|
63 | 63 | |
|
64 | 64 | def checkportabilityalert(ui): |
|
65 | 65 | '''check if the user's config requests nothing, a warning, or abort for |
|
66 | 66 | non-portable filenames''' |
|
67 | 67 | val = ui.config('ui', 'portablefilenames', 'warn') |
|
68 | 68 | lval = val.lower() |
|
69 | 69 | bval = util.parsebool(val) |
|
70 | 70 | abort = os.name == 'nt' or lval == 'abort' |
|
71 | 71 | warn = bval or lval == 'warn' |
|
72 | 72 | if bval is None and not (warn or abort or lval == 'ignore'): |
|
73 | 73 | raise error.ConfigError( |
|
74 | 74 | _("ui.portablefilenames value is invalid ('%s')") % val) |
|
75 | 75 | return abort, warn |
|
76 | 76 | |
|
77 | 77 | class casecollisionauditor(object): |
|
78 | 78 | def __init__(self, ui, abort, dirstate): |
|
79 | 79 | self._ui = ui |
|
80 | 80 | self._abort = abort |
|
81 | 81 | allfiles = '\0'.join(dirstate._map) |
|
82 | 82 | self._loweredfiles = set(encoding.lower(allfiles).split('\0')) |
|
83 | 83 | self._dirstate = dirstate |
|
84 | 84 | # The purpose of _newfiles is so that we don't complain about |
|
85 | 85 | # case collisions if someone were to call this object with the |
|
86 | 86 | # same filename twice. |
|
87 | 87 | self._newfiles = set() |
|
88 | 88 | |
|
89 | 89 | def __call__(self, f): |
|
90 | 90 | fl = encoding.lower(f) |
|
91 | 91 | if (fl in self._loweredfiles and f not in self._dirstate and |
|
92 | 92 | f not in self._newfiles): |
|
93 | 93 | msg = _('possible case-folding collision for %s') % f |
|
94 | 94 | if self._abort: |
|
95 | 95 | raise util.Abort(msg) |
|
96 | 96 | self._ui.warn(_("warning: %s\n") % msg) |
|
97 | 97 | self._loweredfiles.add(fl) |
|
98 | 98 | self._newfiles.add(f) |
|
99 | 99 | |
|
100 | 100 | class pathauditor(object): |
|
101 | 101 | '''ensure that a filesystem path contains no banned components. |
|
102 | 102 | the following properties of a path are checked: |
|
103 | 103 | |
|
104 | 104 | - ends with a directory separator |
|
105 | 105 | - under top-level .hg |
|
106 | 106 | - starts at the root of a windows drive |
|
107 | 107 | - contains ".." |
|
108 | 108 | - traverses a symlink (e.g. a/symlink_here/b) |
|
109 | 109 | - inside a nested repository (a callback can be used to approve |
|
110 | 110 | some nested repositories, e.g., subrepositories) |
|
111 | 111 | ''' |
|
112 | 112 | |
|
113 | 113 | def __init__(self, root, callback=None): |
|
114 | 114 | self.audited = set() |
|
115 | 115 | self.auditeddir = set() |
|
116 | 116 | self.root = root |
|
117 | 117 | self.callback = callback |
|
118 | 118 | if os.path.lexists(root) and not util.checkcase(root): |
|
119 | 119 | self.normcase = util.normcase |
|
120 | 120 | else: |
|
121 | 121 | self.normcase = lambda x: x |
|
122 | 122 | |
|
123 | 123 | def __call__(self, path): |
|
124 | 124 | '''Check the relative path. |
|
125 | 125 | path may contain a pattern (e.g. foodir/**.txt)''' |
|
126 | 126 | |
|
127 | 127 | path = util.localpath(path) |
|
128 | 128 | normpath = self.normcase(path) |
|
129 | 129 | if normpath in self.audited: |
|
130 | 130 | return |
|
131 | 131 | # AIX ignores "/" at end of path, others raise EISDIR. |
|
132 | 132 | if util.endswithsep(path): |
|
133 | 133 | raise util.Abort(_("path ends in directory separator: %s") % path) |
|
134 | 134 | parts = util.splitpath(path) |
|
135 | 135 | if (os.path.splitdrive(path)[0] |
|
136 | 136 | or parts[0].lower() in ('.hg', '.hg.', '') |
|
137 | 137 | or os.pardir in parts): |
|
138 | 138 | raise util.Abort(_("path contains illegal component: %s") % path) |
|
139 | 139 | if '.hg' in path.lower(): |
|
140 | 140 | lparts = [p.lower() for p in parts] |
|
141 | 141 | for p in '.hg', '.hg.': |
|
142 | 142 | if p in lparts[1:]: |
|
143 | 143 | pos = lparts.index(p) |
|
144 | 144 | base = os.path.join(*parts[:pos]) |
|
145 | 145 | raise util.Abort(_("path '%s' is inside nested repo %r") |
|
146 | 146 | % (path, base)) |
|
147 | 147 | |
|
148 | 148 | normparts = util.splitpath(normpath) |
|
149 | 149 | assert len(parts) == len(normparts) |
|
150 | 150 | |
|
151 | 151 | parts.pop() |
|
152 | 152 | normparts.pop() |
|
153 | 153 | prefixes = [] |
|
154 | 154 | while parts: |
|
155 | 155 | prefix = os.sep.join(parts) |
|
156 | 156 | normprefix = os.sep.join(normparts) |
|
157 | 157 | if normprefix in self.auditeddir: |
|
158 | 158 | break |
|
159 | 159 | curpath = os.path.join(self.root, prefix) |
|
160 | 160 | try: |
|
161 | 161 | st = os.lstat(curpath) |
|
162 | 162 | except OSError, err: |
|
163 | 163 | # EINVAL can be raised as invalid path syntax under win32. |
|
164 | 164 | # They must be ignored for patterns can be checked too. |
|
165 | 165 | if err.errno not in (errno.ENOENT, errno.ENOTDIR, errno.EINVAL): |
|
166 | 166 | raise |
|
167 | 167 | else: |
|
168 | 168 | if stat.S_ISLNK(st.st_mode): |
|
169 | 169 | raise util.Abort( |
|
170 | 170 | _('path %r traverses symbolic link %r') |
|
171 | 171 | % (path, prefix)) |
|
172 | 172 | elif (stat.S_ISDIR(st.st_mode) and |
|
173 | 173 | os.path.isdir(os.path.join(curpath, '.hg'))): |
|
174 | 174 | if not self.callback or not self.callback(curpath): |
|
175 | 175 | raise util.Abort(_("path '%s' is inside nested " |
|
176 | 176 | "repo %r") |
|
177 | 177 | % (path, prefix)) |
|
178 | 178 | prefixes.append(normprefix) |
|
179 | 179 | parts.pop() |
|
180 | 180 | normparts.pop() |
|
181 | 181 | |
|
182 | 182 | self.audited.add(normpath) |
|
183 | 183 | # only add prefixes to the cache after checking everything: we don't |
|
184 | 184 | # want to add "foo/bar/baz" before checking if there's a "foo/.hg" |
|
185 | 185 | self.auditeddir.update(prefixes) |
|
186 | 186 | |
|
187 | def check(self, path): | |
|
188 | try: | |
|
189 | self(path) | |
|
190 | return True | |
|
191 | except (OSError, util.Abort): | |
|
192 | return False | |
|
193 | ||
|
187 | 194 | class abstractvfs(object): |
|
188 | 195 | """Abstract base class; cannot be instantiated""" |
|
189 | 196 | |
|
190 | 197 | def __init__(self, *args, **kwargs): |
|
191 | 198 | '''Prevent instantiation; don't call this from subclasses.''' |
|
192 | 199 | raise NotImplementedError('attempted instantiating ' + str(type(self))) |
|
193 | 200 | |
|
194 | 201 | def tryread(self, path): |
|
195 | 202 | '''gracefully return an empty string for missing files''' |
|
196 | 203 | try: |
|
197 | 204 | return self.read(path) |
|
198 | 205 | except IOError, inst: |
|
199 | 206 | if inst.errno != errno.ENOENT: |
|
200 | 207 | raise |
|
201 | 208 | return "" |
|
202 | 209 | |
|
203 | 210 | def read(self, path): |
|
204 | 211 | fp = self(path, 'rb') |
|
205 | 212 | try: |
|
206 | 213 | return fp.read() |
|
207 | 214 | finally: |
|
208 | 215 | fp.close() |
|
209 | 216 | |
|
210 | 217 | def write(self, path, data): |
|
211 | 218 | fp = self(path, 'wb') |
|
212 | 219 | try: |
|
213 | 220 | return fp.write(data) |
|
214 | 221 | finally: |
|
215 | 222 | fp.close() |
|
216 | 223 | |
|
217 | 224 | def append(self, path, data): |
|
218 | 225 | fp = self(path, 'ab') |
|
219 | 226 | try: |
|
220 | 227 | return fp.write(data) |
|
221 | 228 | finally: |
|
222 | 229 | fp.close() |
|
223 | 230 | |
|
224 | 231 | def exists(self, path=None): |
|
225 | 232 | return os.path.exists(self.join(path)) |
|
226 | 233 | |
|
227 | 234 | def isdir(self, path=None): |
|
228 | 235 | return os.path.isdir(self.join(path)) |
|
229 | 236 | |
|
230 | 237 | def makedir(self, path=None, notindexed=True): |
|
231 | 238 | return util.makedir(self.join(path), notindexed) |
|
232 | 239 | |
|
233 | 240 | def makedirs(self, path=None, mode=None): |
|
234 | 241 | return util.makedirs(self.join(path), mode) |
|
235 | 242 | |
|
236 | 243 | def mkdir(self, path=None): |
|
237 | 244 | return os.mkdir(self.join(path)) |
|
238 | 245 | |
|
239 | 246 | def readdir(self, path=None, stat=None, skip=None): |
|
240 | 247 | return osutil.listdir(self.join(path), stat, skip) |
|
241 | 248 | |
|
242 | 249 | def stat(self, path=None): |
|
243 | 250 | return os.stat(self.join(path)) |
|
244 | 251 | |
|
245 | 252 | class vfs(abstractvfs): |
|
246 | 253 | '''Operate files relative to a base directory |
|
247 | 254 | |
|
248 | 255 | This class is used to hide the details of COW semantics and |
|
249 | 256 | remote file access from higher level code. |
|
250 | 257 | ''' |
|
251 | 258 | def __init__(self, base, audit=True, expand=False): |
|
252 | 259 | if expand: |
|
253 | 260 | base = os.path.realpath(util.expandpath(base)) |
|
254 | 261 | self.base = base |
|
255 | 262 | self._setmustaudit(audit) |
|
256 | 263 | self.createmode = None |
|
257 | 264 | self._trustnlink = None |
|
258 | 265 | |
|
259 | 266 | def _getmustaudit(self): |
|
260 | 267 | return self._audit |
|
261 | 268 | |
|
262 | 269 | def _setmustaudit(self, onoff): |
|
263 | 270 | self._audit = onoff |
|
264 | 271 | if onoff: |
|
265 | 272 | self.audit = pathauditor(self.base) |
|
266 | 273 | else: |
|
267 | 274 | self.audit = util.always |
|
268 | 275 | |
|
269 | 276 | mustaudit = property(_getmustaudit, _setmustaudit) |
|
270 | 277 | |
|
271 | 278 | @util.propertycache |
|
272 | 279 | def _cansymlink(self): |
|
273 | 280 | return util.checklink(self.base) |
|
274 | 281 | |
|
275 | 282 | @util.propertycache |
|
276 | 283 | def _chmod(self): |
|
277 | 284 | return util.checkexec(self.base) |
|
278 | 285 | |
|
279 | 286 | def _fixfilemode(self, name): |
|
280 | 287 | if self.createmode is None or not self._chmod: |
|
281 | 288 | return |
|
282 | 289 | os.chmod(name, self.createmode & 0666) |
|
283 | 290 | |
|
284 | 291 | def __call__(self, path, mode="r", text=False, atomictemp=False): |
|
285 | 292 | if self._audit: |
|
286 | 293 | r = util.checkosfilename(path) |
|
287 | 294 | if r: |
|
288 | 295 | raise util.Abort("%s: %r" % (r, path)) |
|
289 | 296 | self.audit(path) |
|
290 | 297 | f = self.join(path) |
|
291 | 298 | |
|
292 | 299 | if not text and "b" not in mode: |
|
293 | 300 | mode += "b" # for that other OS |
|
294 | 301 | |
|
295 | 302 | nlink = -1 |
|
296 | 303 | if mode not in ('r', 'rb'): |
|
297 | 304 | dirname, basename = util.split(f) |
|
298 | 305 | # If basename is empty, then the path is malformed because it points |
|
299 | 306 | # to a directory. Let the posixfile() call below raise IOError. |
|
300 | 307 | if basename: |
|
301 | 308 | if atomictemp: |
|
302 | 309 | if not os.path.isdir(dirname): |
|
303 | 310 | util.makedirs(dirname, self.createmode) |
|
304 | 311 | return util.atomictempfile(f, mode, self.createmode) |
|
305 | 312 | try: |
|
306 | 313 | if 'w' in mode: |
|
307 | 314 | util.unlink(f) |
|
308 | 315 | nlink = 0 |
|
309 | 316 | else: |
|
310 | 317 | # nlinks() may behave differently for files on Windows |
|
311 | 318 | # shares if the file is open. |
|
312 | 319 | fd = util.posixfile(f) |
|
313 | 320 | nlink = util.nlinks(f) |
|
314 | 321 | if nlink < 1: |
|
315 | 322 | nlink = 2 # force mktempcopy (issue1922) |
|
316 | 323 | fd.close() |
|
317 | 324 | except (OSError, IOError), e: |
|
318 | 325 | if e.errno != errno.ENOENT: |
|
319 | 326 | raise |
|
320 | 327 | nlink = 0 |
|
321 | 328 | if not os.path.isdir(dirname): |
|
322 | 329 | util.makedirs(dirname, self.createmode) |
|
323 | 330 | if nlink > 0: |
|
324 | 331 | if self._trustnlink is None: |
|
325 | 332 | self._trustnlink = nlink > 1 or util.checknlink(f) |
|
326 | 333 | if nlink > 1 or not self._trustnlink: |
|
327 | 334 | util.rename(util.mktempcopy(f), f) |
|
328 | 335 | fp = util.posixfile(f, mode) |
|
329 | 336 | if nlink == 0: |
|
330 | 337 | self._fixfilemode(f) |
|
331 | 338 | return fp |
|
332 | 339 | |
|
333 | 340 | def symlink(self, src, dst): |
|
334 | 341 | self.audit(dst) |
|
335 | 342 | linkname = self.join(dst) |
|
336 | 343 | try: |
|
337 | 344 | os.unlink(linkname) |
|
338 | 345 | except OSError: |
|
339 | 346 | pass |
|
340 | 347 | |
|
341 | 348 | dirname = os.path.dirname(linkname) |
|
342 | 349 | if not os.path.exists(dirname): |
|
343 | 350 | util.makedirs(dirname, self.createmode) |
|
344 | 351 | |
|
345 | 352 | if self._cansymlink: |
|
346 | 353 | try: |
|
347 | 354 | os.symlink(src, linkname) |
|
348 | 355 | except OSError, err: |
|
349 | 356 | raise OSError(err.errno, _('could not symlink to %r: %s') % |
|
350 | 357 | (src, err.strerror), linkname) |
|
351 | 358 | else: |
|
352 | 359 | self.write(dst, src) |
|
353 | 360 | |
|
354 | 361 | def join(self, path): |
|
355 | 362 | if path: |
|
356 | 363 | return os.path.join(self.base, path) |
|
357 | 364 | else: |
|
358 | 365 | return self.base |
|
359 | 366 | |
|
360 | 367 | opener = vfs |
|
361 | 368 | |
|
362 | 369 | class auditvfs(object): |
|
363 | 370 | def __init__(self, vfs): |
|
364 | 371 | self.vfs = vfs |
|
365 | 372 | |
|
366 | 373 | def _getmustaudit(self): |
|
367 | 374 | return self.vfs.mustaudit |
|
368 | 375 | |
|
369 | 376 | def _setmustaudit(self, onoff): |
|
370 | 377 | self.vfs.mustaudit = onoff |
|
371 | 378 | |
|
372 | 379 | mustaudit = property(_getmustaudit, _setmustaudit) |
|
373 | 380 | |
|
374 | 381 | class filtervfs(abstractvfs, auditvfs): |
|
375 | 382 | '''Wrapper vfs for filtering filenames with a function.''' |
|
376 | 383 | |
|
377 | 384 | def __init__(self, vfs, filter): |
|
378 | 385 | auditvfs.__init__(self, vfs) |
|
379 | 386 | self._filter = filter |
|
380 | 387 | |
|
381 | 388 | def __call__(self, path, *args, **kwargs): |
|
382 | 389 | return self.vfs(self._filter(path), *args, **kwargs) |
|
383 | 390 | |
|
384 | 391 | def join(self, path): |
|
385 | 392 | if path: |
|
386 | 393 | return self.vfs.join(self._filter(path)) |
|
387 | 394 | else: |
|
388 | 395 | return self.vfs.join(path) |
|
389 | 396 | |
|
390 | 397 | filteropener = filtervfs |
|
391 | 398 | |
|
392 | 399 | class readonlyvfs(abstractvfs, auditvfs): |
|
393 | 400 | '''Wrapper vfs preventing any writing.''' |
|
394 | 401 | |
|
395 | 402 | def __init__(self, vfs): |
|
396 | 403 | auditvfs.__init__(self, vfs) |
|
397 | 404 | |
|
398 | 405 | def __call__(self, path, mode='r', *args, **kw): |
|
399 | 406 | if mode not in ('r', 'rb'): |
|
400 | 407 | raise util.Abort('this vfs is read only') |
|
401 | 408 | return self.vfs(path, mode, *args, **kw) |
|
402 | 409 | |
|
403 | 410 | |
|
404 | 411 | def canonpath(root, cwd, myname, auditor=None): |
|
405 | 412 | '''return the canonical path of myname, given cwd and root''' |
|
406 | 413 | if util.endswithsep(root): |
|
407 | 414 | rootsep = root |
|
408 | 415 | else: |
|
409 | 416 | rootsep = root + os.sep |
|
410 | 417 | name = myname |
|
411 | 418 | if not os.path.isabs(name): |
|
412 | 419 | name = os.path.join(root, cwd, name) |
|
413 | 420 | name = os.path.normpath(name) |
|
414 | 421 | if auditor is None: |
|
415 | 422 | auditor = pathauditor(root) |
|
416 | 423 | if name != rootsep and name.startswith(rootsep): |
|
417 | 424 | name = name[len(rootsep):] |
|
418 | 425 | auditor(name) |
|
419 | 426 | return util.pconvert(name) |
|
420 | 427 | elif name == root: |
|
421 | 428 | return '' |
|
422 | 429 | else: |
|
423 | 430 | # Determine whether `name' is in the hierarchy at or beneath `root', |
|
424 | 431 | # by iterating name=dirname(name) until that causes no change (can't |
|
425 | 432 | # check name == '/', because that doesn't work on windows). The list |
|
426 | 433 | # `rel' holds the reversed list of components making up the relative |
|
427 | 434 | # file name we want. |
|
428 | 435 | rel = [] |
|
429 | 436 | while True: |
|
430 | 437 | try: |
|
431 | 438 | s = util.samefile(name, root) |
|
432 | 439 | except OSError: |
|
433 | 440 | s = False |
|
434 | 441 | if s: |
|
435 | 442 | if not rel: |
|
436 | 443 | # name was actually the same as root (maybe a symlink) |
|
437 | 444 | return '' |
|
438 | 445 | rel.reverse() |
|
439 | 446 | name = os.path.join(*rel) |
|
440 | 447 | auditor(name) |
|
441 | 448 | return util.pconvert(name) |
|
442 | 449 | dirname, basename = util.split(name) |
|
443 | 450 | rel.append(basename) |
|
444 | 451 | if dirname == name: |
|
445 | 452 | break |
|
446 | 453 | name = dirname |
|
447 | 454 | |
|
448 | 455 | raise util.Abort(_("%s not under root '%s'") % (myname, root)) |
|
449 | 456 | |
|
450 | 457 | def walkrepos(path, followsym=False, seen_dirs=None, recurse=False): |
|
451 | 458 | '''yield every hg repository under path, always recursively. |
|
452 | 459 | The recurse flag will only control recursion into repo working dirs''' |
|
453 | 460 | def errhandler(err): |
|
454 | 461 | if err.filename == path: |
|
455 | 462 | raise err |
|
456 | 463 | samestat = getattr(os.path, 'samestat', None) |
|
457 | 464 | if followsym and samestat is not None: |
|
458 | 465 | def adddir(dirlst, dirname): |
|
459 | 466 | match = False |
|
460 | 467 | dirstat = os.stat(dirname) |
|
461 | 468 | for lstdirstat in dirlst: |
|
462 | 469 | if samestat(dirstat, lstdirstat): |
|
463 | 470 | match = True |
|
464 | 471 | break |
|
465 | 472 | if not match: |
|
466 | 473 | dirlst.append(dirstat) |
|
467 | 474 | return not match |
|
468 | 475 | else: |
|
469 | 476 | followsym = False |
|
470 | 477 | |
|
471 | 478 | if (seen_dirs is None) and followsym: |
|
472 | 479 | seen_dirs = [] |
|
473 | 480 | adddir(seen_dirs, path) |
|
474 | 481 | for root, dirs, files in os.walk(path, topdown=True, onerror=errhandler): |
|
475 | 482 | dirs.sort() |
|
476 | 483 | if '.hg' in dirs: |
|
477 | 484 | yield root # found a repository |
|
478 | 485 | qroot = os.path.join(root, '.hg', 'patches') |
|
479 | 486 | if os.path.isdir(os.path.join(qroot, '.hg')): |
|
480 | 487 | yield qroot # we have a patch queue repo here |
|
481 | 488 | if recurse: |
|
482 | 489 | # avoid recursing inside the .hg directory |
|
483 | 490 | dirs.remove('.hg') |
|
484 | 491 | else: |
|
485 | 492 | dirs[:] = [] # don't descend further |
|
486 | 493 | elif followsym: |
|
487 | 494 | newdirs = [] |
|
488 | 495 | for d in dirs: |
|
489 | 496 | fname = os.path.join(root, d) |
|
490 | 497 | if adddir(seen_dirs, fname): |
|
491 | 498 | if os.path.islink(fname): |
|
492 | 499 | for hgname in walkrepos(fname, True, seen_dirs): |
|
493 | 500 | yield hgname |
|
494 | 501 | else: |
|
495 | 502 | newdirs.append(d) |
|
496 | 503 | dirs[:] = newdirs |
|
497 | 504 | |
|
498 | 505 | def osrcpath(): |
|
499 | 506 | '''return default os-specific hgrc search path''' |
|
500 | 507 | path = systemrcpath() |
|
501 | 508 | path.extend(userrcpath()) |
|
502 | 509 | path = [os.path.normpath(f) for f in path] |
|
503 | 510 | return path |
|
504 | 511 | |
|
505 | 512 | _rcpath = None |
|
506 | 513 | |
|
507 | 514 | def rcpath(): |
|
508 | 515 | '''return hgrc search path. if env var HGRCPATH is set, use it. |
|
509 | 516 | for each item in path, if directory, use files ending in .rc, |
|
510 | 517 | else use item. |
|
511 | 518 | make HGRCPATH empty to only look in .hg/hgrc of current repo. |
|
512 | 519 | if no HGRCPATH, use default os-specific path.''' |
|
513 | 520 | global _rcpath |
|
514 | 521 | if _rcpath is None: |
|
515 | 522 | if 'HGRCPATH' in os.environ: |
|
516 | 523 | _rcpath = [] |
|
517 | 524 | for p in os.environ['HGRCPATH'].split(os.pathsep): |
|
518 | 525 | if not p: |
|
519 | 526 | continue |
|
520 | 527 | p = util.expandpath(p) |
|
521 | 528 | if os.path.isdir(p): |
|
522 | 529 | for f, kind in osutil.listdir(p): |
|
523 | 530 | if f.endswith('.rc'): |
|
524 | 531 | _rcpath.append(os.path.join(p, f)) |
|
525 | 532 | else: |
|
526 | 533 | _rcpath.append(p) |
|
527 | 534 | else: |
|
528 | 535 | _rcpath = osrcpath() |
|
529 | 536 | return _rcpath |
|
530 | 537 | |
|
531 | 538 | if os.name != 'nt': |
|
532 | 539 | |
|
533 | 540 | def rcfiles(path): |
|
534 | 541 | rcs = [os.path.join(path, 'hgrc')] |
|
535 | 542 | rcdir = os.path.join(path, 'hgrc.d') |
|
536 | 543 | try: |
|
537 | 544 | rcs.extend([os.path.join(rcdir, f) |
|
538 | 545 | for f, kind in osutil.listdir(rcdir) |
|
539 | 546 | if f.endswith(".rc")]) |
|
540 | 547 | except OSError: |
|
541 | 548 | pass |
|
542 | 549 | return rcs |
|
543 | 550 | |
|
544 | 551 | def systemrcpath(): |
|
545 | 552 | path = [] |
|
546 | 553 | if sys.platform == 'plan9': |
|
547 | 554 | root = 'lib/mercurial' |
|
548 | 555 | else: |
|
549 | 556 | root = 'etc/mercurial' |
|
550 | 557 | # old mod_python does not set sys.argv |
|
551 | 558 | if len(getattr(sys, 'argv', [])) > 0: |
|
552 | 559 | p = os.path.dirname(os.path.dirname(sys.argv[0])) |
|
553 | 560 | path.extend(rcfiles(os.path.join(p, root))) |
|
554 | 561 | path.extend(rcfiles('/' + root)) |
|
555 | 562 | return path |
|
556 | 563 | |
|
557 | 564 | def userrcpath(): |
|
558 | 565 | if sys.platform == 'plan9': |
|
559 | 566 | return [os.environ['home'] + '/lib/hgrc'] |
|
560 | 567 | else: |
|
561 | 568 | return [os.path.expanduser('~/.hgrc')] |
|
562 | 569 | |
|
563 | 570 | else: |
|
564 | 571 | |
|
565 | 572 | import _winreg |
|
566 | 573 | |
|
567 | 574 | def systemrcpath(): |
|
568 | 575 | '''return default os-specific hgrc search path''' |
|
569 | 576 | rcpath = [] |
|
570 | 577 | filename = util.executablepath() |
|
571 | 578 | # Use mercurial.ini found in directory with hg.exe |
|
572 | 579 | progrc = os.path.join(os.path.dirname(filename), 'mercurial.ini') |
|
573 | 580 | if os.path.isfile(progrc): |
|
574 | 581 | rcpath.append(progrc) |
|
575 | 582 | return rcpath |
|
576 | 583 | # Use hgrc.d found in directory with hg.exe |
|
577 | 584 | progrcd = os.path.join(os.path.dirname(filename), 'hgrc.d') |
|
578 | 585 | if os.path.isdir(progrcd): |
|
579 | 586 | for f, kind in osutil.listdir(progrcd): |
|
580 | 587 | if f.endswith('.rc'): |
|
581 | 588 | rcpath.append(os.path.join(progrcd, f)) |
|
582 | 589 | return rcpath |
|
583 | 590 | # else look for a system rcpath in the registry |
|
584 | 591 | value = util.lookupreg('SOFTWARE\\Mercurial', None, |
|
585 | 592 | _winreg.HKEY_LOCAL_MACHINE) |
|
586 | 593 | if not isinstance(value, str) or not value: |
|
587 | 594 | return rcpath |
|
588 | 595 | value = util.localpath(value) |
|
589 | 596 | for p in value.split(os.pathsep): |
|
590 | 597 | if p.lower().endswith('mercurial.ini'): |
|
591 | 598 | rcpath.append(p) |
|
592 | 599 | elif os.path.isdir(p): |
|
593 | 600 | for f, kind in osutil.listdir(p): |
|
594 | 601 | if f.endswith('.rc'): |
|
595 | 602 | rcpath.append(os.path.join(p, f)) |
|
596 | 603 | return rcpath |
|
597 | 604 | |
|
598 | 605 | def userrcpath(): |
|
599 | 606 | '''return os-specific hgrc search path to the user dir''' |
|
600 | 607 | home = os.path.expanduser('~') |
|
601 | 608 | path = [os.path.join(home, 'mercurial.ini'), |
|
602 | 609 | os.path.join(home, '.hgrc')] |
|
603 | 610 | userprofile = os.environ.get('USERPROFILE') |
|
604 | 611 | if userprofile: |
|
605 | 612 | path.append(os.path.join(userprofile, 'mercurial.ini')) |
|
606 | 613 | path.append(os.path.join(userprofile, '.hgrc')) |
|
607 | 614 | return path |
|
608 | 615 | |
|
609 | 616 | def revsingle(repo, revspec, default='.'): |
|
610 | 617 | if not revspec: |
|
611 | 618 | return repo[default] |
|
612 | 619 | |
|
613 | 620 | l = revrange(repo, [revspec]) |
|
614 | 621 | if len(l) < 1: |
|
615 | 622 | raise util.Abort(_('empty revision set')) |
|
616 | 623 | return repo[l[-1]] |
|
617 | 624 | |
|
618 | 625 | def revpair(repo, revs): |
|
619 | 626 | if not revs: |
|
620 | 627 | return repo.dirstate.p1(), None |
|
621 | 628 | |
|
622 | 629 | l = revrange(repo, revs) |
|
623 | 630 | |
|
624 | 631 | if len(l) == 0: |
|
625 | 632 | if revs: |
|
626 | 633 | raise util.Abort(_('empty revision range')) |
|
627 | 634 | return repo.dirstate.p1(), None |
|
628 | 635 | |
|
629 | 636 | if len(l) == 1 and len(revs) == 1 and _revrangesep not in revs[0]: |
|
630 | 637 | return repo.lookup(l[0]), None |
|
631 | 638 | |
|
632 | 639 | return repo.lookup(l[0]), repo.lookup(l[-1]) |
|
633 | 640 | |
|
634 | 641 | _revrangesep = ':' |
|
635 | 642 | |
|
636 | 643 | def revrange(repo, revs): |
|
637 | 644 | """Yield revision as strings from a list of revision specifications.""" |
|
638 | 645 | |
|
639 | 646 | def revfix(repo, val, defval): |
|
640 | 647 | if not val and val != 0 and defval is not None: |
|
641 | 648 | return defval |
|
642 | 649 | return repo[val].rev() |
|
643 | 650 | |
|
644 | 651 | seen, l = set(), [] |
|
645 | 652 | for spec in revs: |
|
646 | 653 | if l and not seen: |
|
647 | 654 | seen = set(l) |
|
648 | 655 | # attempt to parse old-style ranges first to deal with |
|
649 | 656 | # things like old-tag which contain query metacharacters |
|
650 | 657 | try: |
|
651 | 658 | if isinstance(spec, int): |
|
652 | 659 | seen.add(spec) |
|
653 | 660 | l.append(spec) |
|
654 | 661 | continue |
|
655 | 662 | |
|
656 | 663 | if _revrangesep in spec: |
|
657 | 664 | start, end = spec.split(_revrangesep, 1) |
|
658 | 665 | start = revfix(repo, start, 0) |
|
659 | 666 | end = revfix(repo, end, len(repo) - 1) |
|
660 | 667 | if end == nullrev and start <= 0: |
|
661 | 668 | start = nullrev |
|
662 | 669 | rangeiter = repo.changelog.revs(start, end) |
|
663 | 670 | if not seen and not l: |
|
664 | 671 | # by far the most common case: revs = ["-1:0"] |
|
665 | 672 | l = list(rangeiter) |
|
666 | 673 | # defer syncing seen until next iteration |
|
667 | 674 | continue |
|
668 | 675 | newrevs = set(rangeiter) |
|
669 | 676 | if seen: |
|
670 | 677 | newrevs.difference_update(seen) |
|
671 | 678 | seen.update(newrevs) |
|
672 | 679 | else: |
|
673 | 680 | seen = newrevs |
|
674 | 681 | l.extend(sorted(newrevs, reverse=start > end)) |
|
675 | 682 | continue |
|
676 | 683 | elif spec and spec in repo: # single unquoted rev |
|
677 | 684 | rev = revfix(repo, spec, None) |
|
678 | 685 | if rev in seen: |
|
679 | 686 | continue |
|
680 | 687 | seen.add(rev) |
|
681 | 688 | l.append(rev) |
|
682 | 689 | continue |
|
683 | 690 | except error.RepoLookupError: |
|
684 | 691 | pass |
|
685 | 692 | |
|
686 | 693 | # fall through to new-style queries if old-style fails |
|
687 | 694 | m = revset.match(repo.ui, spec) |
|
688 | 695 | dl = [r for r in m(repo, list(repo)) if r not in seen] |
|
689 | 696 | l.extend(dl) |
|
690 | 697 | seen.update(dl) |
|
691 | 698 | |
|
692 | 699 | return l |
|
693 | 700 | |
|
694 | 701 | def expandpats(pats): |
|
695 | 702 | if not util.expandglobs: |
|
696 | 703 | return list(pats) |
|
697 | 704 | ret = [] |
|
698 | 705 | for p in pats: |
|
699 | 706 | kind, name = matchmod._patsplit(p, None) |
|
700 | 707 | if kind is None: |
|
701 | 708 | try: |
|
702 | 709 | globbed = glob.glob(name) |
|
703 | 710 | except re.error: |
|
704 | 711 | globbed = [name] |
|
705 | 712 | if globbed: |
|
706 | 713 | ret.extend(globbed) |
|
707 | 714 | continue |
|
708 | 715 | ret.append(p) |
|
709 | 716 | return ret |
|
710 | 717 | |
|
711 | 718 | def matchandpats(ctx, pats=[], opts={}, globbed=False, default='relpath'): |
|
712 | 719 | if pats == ("",): |
|
713 | 720 | pats = [] |
|
714 | 721 | if not globbed and default == 'relpath': |
|
715 | 722 | pats = expandpats(pats or []) |
|
716 | 723 | |
|
717 | 724 | m = ctx.match(pats, opts.get('include'), opts.get('exclude'), |
|
718 | 725 | default) |
|
719 | 726 | def badfn(f, msg): |
|
720 | 727 | ctx._repo.ui.warn("%s: %s\n" % (m.rel(f), msg)) |
|
721 | 728 | m.bad = badfn |
|
722 | 729 | return m, pats |
|
723 | 730 | |
|
724 | 731 | def match(ctx, pats=[], opts={}, globbed=False, default='relpath'): |
|
725 | 732 | return matchandpats(ctx, pats, opts, globbed, default)[0] |
|
726 | 733 | |
|
727 | 734 | def matchall(repo): |
|
728 | 735 | return matchmod.always(repo.root, repo.getcwd()) |
|
729 | 736 | |
|
730 | 737 | def matchfiles(repo, files): |
|
731 | 738 | return matchmod.exact(repo.root, repo.getcwd(), files) |
|
732 | 739 | |
|
733 | 740 | def addremove(repo, pats=[], opts={}, dry_run=None, similarity=None): |
|
734 | 741 | if dry_run is None: |
|
735 | 742 | dry_run = opts.get('dry_run') |
|
736 | 743 | if similarity is None: |
|
737 | 744 | similarity = float(opts.get('similarity') or 0) |
|
738 | 745 | # we'd use status here, except handling of symlinks and ignore is tricky |
|
739 | 746 | added, unknown, deleted, removed = [], [], [], [] |
|
740 | 747 | audit_path = pathauditor(repo.root) |
|
741 | 748 | m = match(repo[None], pats, opts) |
|
742 | 749 | rejected = [] |
|
743 | 750 | m.bad = lambda x, y: rejected.append(x) |
|
744 | 751 | |
|
745 | 752 | ctx = repo[None] |
|
746 | 753 | walkresults = repo.dirstate.walk(m, sorted(ctx.substate), True, False) |
|
747 | 754 | for abs in sorted(walkresults): |
|
748 | good = True | |
|
749 | try: | |
|
750 | audit_path(abs) | |
|
751 | except (OSError, util.Abort): | |
|
752 | good = False | |
|
753 | ||
|
754 | 755 | st = walkresults[abs] |
|
755 | 756 | dstate = repo.dirstate[abs] |
|
756 | if good and dstate == '?': | |
|
757 | if dstate == '?' and audit_path.check(abs): | |
|
757 | 758 | unknown.append(abs) |
|
758 | 759 | if repo.ui.verbose or not m.exact(abs): |
|
759 | 760 | rel = m.rel(abs) |
|
760 | 761 | repo.ui.status(_('adding %s\n') % ((pats and rel) or abs)) |
|
761 | elif (dstate != 'r' and | |
|
762 | (not good or not st or | |
|
762 | elif (dstate != 'r' and (not st or | |
|
763 | 763 | (stat.S_ISDIR(st.st_mode) and not stat.S_ISLNK(st.st_mode)))): |
|
764 | 764 | deleted.append(abs) |
|
765 | 765 | if repo.ui.verbose or not m.exact(abs): |
|
766 | 766 | rel = m.rel(abs) |
|
767 | 767 | repo.ui.status(_('removing %s\n') % ((pats and rel) or abs)) |
|
768 | 768 | # for finding renames |
|
769 | 769 | elif dstate == 'r': |
|
770 | 770 | removed.append(abs) |
|
771 | 771 | elif dstate == 'a': |
|
772 | 772 | added.append(abs) |
|
773 | 773 | copies = {} |
|
774 | 774 | if similarity > 0: |
|
775 | 775 | for old, new, score in similar.findrenames(repo, |
|
776 | 776 | added + unknown, removed + deleted, similarity): |
|
777 | 777 | if repo.ui.verbose or not m.exact(old) or not m.exact(new): |
|
778 | 778 | repo.ui.status(_('recording removal of %s as rename to %s ' |
|
779 | 779 | '(%d%% similar)\n') % |
|
780 | 780 | (m.rel(old), m.rel(new), score * 100)) |
|
781 | 781 | copies[new] = old |
|
782 | 782 | |
|
783 | 783 | if not dry_run: |
|
784 | 784 | wctx = repo[None] |
|
785 | 785 | wlock = repo.wlock() |
|
786 | 786 | try: |
|
787 | 787 | wctx.forget(deleted) |
|
788 | 788 | wctx.add(unknown) |
|
789 | 789 | for new, old in copies.iteritems(): |
|
790 | 790 | wctx.copy(old, new) |
|
791 | 791 | finally: |
|
792 | 792 | wlock.release() |
|
793 | 793 | |
|
794 | 794 | for f in rejected: |
|
795 | 795 | if f in m.files(): |
|
796 | 796 | return 1 |
|
797 | 797 | return 0 |
|
798 | 798 | |
|
799 | 799 | def updatedir(ui, repo, patches, similarity=0): |
|
800 | 800 | '''Update dirstate after patch application according to metadata''' |
|
801 | 801 | if not patches: |
|
802 | 802 | return [] |
|
803 | 803 | copies = [] |
|
804 | 804 | removes = set() |
|
805 | 805 | cfiles = patches.keys() |
|
806 | 806 | cwd = repo.getcwd() |
|
807 | 807 | if cwd: |
|
808 | 808 | cfiles = [util.pathto(repo.root, cwd, f) for f in patches.keys()] |
|
809 | 809 | for f in patches: |
|
810 | 810 | gp = patches[f] |
|
811 | 811 | if not gp: |
|
812 | 812 | continue |
|
813 | 813 | if gp.op == 'RENAME': |
|
814 | 814 | copies.append((gp.oldpath, gp.path)) |
|
815 | 815 | removes.add(gp.oldpath) |
|
816 | 816 | elif gp.op == 'COPY': |
|
817 | 817 | copies.append((gp.oldpath, gp.path)) |
|
818 | 818 | elif gp.op == 'DELETE': |
|
819 | 819 | removes.add(gp.path) |
|
820 | 820 | |
|
821 | 821 | wctx = repo[None] |
|
822 | 822 | for src, dst in copies: |
|
823 | 823 | dirstatecopy(ui, repo, wctx, src, dst, cwd=cwd) |
|
824 | 824 | if (not similarity) and removes: |
|
825 | 825 | wctx.remove(sorted(removes), True) |
|
826 | 826 | |
|
827 | 827 | for f in patches: |
|
828 | 828 | gp = patches[f] |
|
829 | 829 | if gp and gp.mode: |
|
830 | 830 | islink, isexec = gp.mode |
|
831 | 831 | dst = repo.wjoin(gp.path) |
|
832 | 832 | # patch won't create empty files |
|
833 | 833 | if gp.op == 'ADD' and not os.path.lexists(dst): |
|
834 | 834 | flags = (isexec and 'x' or '') + (islink and 'l' or '') |
|
835 | 835 | repo.wwrite(gp.path, '', flags) |
|
836 | 836 | util.setflags(dst, islink, isexec) |
|
837 | 837 | addremove(repo, cfiles, similarity=similarity) |
|
838 | 838 | files = patches.keys() |
|
839 | 839 | files.extend([r for r in removes if r not in files]) |
|
840 | 840 | return sorted(files) |
|
841 | 841 | |
|
842 | 842 | def dirstatecopy(ui, repo, wctx, src, dst, dryrun=False, cwd=None): |
|
843 | 843 | """Update the dirstate to reflect the intent of copying src to dst. For |
|
844 | 844 | different reasons it might not end with dst being marked as copied from src. |
|
845 | 845 | """ |
|
846 | 846 | origsrc = repo.dirstate.copied(src) or src |
|
847 | 847 | if dst == origsrc: # copying back a copy? |
|
848 | 848 | if repo.dirstate[dst] not in 'mn' and not dryrun: |
|
849 | 849 | repo.dirstate.normallookup(dst) |
|
850 | 850 | else: |
|
851 | 851 | if repo.dirstate[origsrc] == 'a' and origsrc == src: |
|
852 | 852 | if not ui.quiet: |
|
853 | 853 | ui.warn(_("%s has not been committed yet, so no copy " |
|
854 | 854 | "data will be stored for %s.\n") |
|
855 | 855 | % (repo.pathto(origsrc, cwd), repo.pathto(dst, cwd))) |
|
856 | 856 | if repo.dirstate[dst] in '?r' and not dryrun: |
|
857 | 857 | wctx.add([dst]) |
|
858 | 858 | elif not dryrun: |
|
859 | 859 | wctx.copy(origsrc, dst) |
|
860 | 860 | |
|
861 | 861 | def readrequires(opener, supported): |
|
862 | 862 | '''Reads and parses .hg/requires and checks if all entries found |
|
863 | 863 | are in the list of supported features.''' |
|
864 | 864 | requirements = set(opener.read("requires").splitlines()) |
|
865 | 865 | missings = [] |
|
866 | 866 | for r in requirements: |
|
867 | 867 | if r not in supported: |
|
868 | 868 | if not r or not r[0].isalnum(): |
|
869 | 869 | raise error.RequirementError(_(".hg/requires file is corrupt")) |
|
870 | 870 | missings.append(r) |
|
871 | 871 | missings.sort() |
|
872 | 872 | if missings: |
|
873 | 873 | raise error.RequirementError( |
|
874 | 874 | _("unknown repository format: requires features '%s' (upgrade " |
|
875 | 875 | "Mercurial)") % "', '".join(missings)) |
|
876 | 876 | return requirements |
|
877 | 877 | |
|
878 | 878 | class filecacheentry(object): |
|
879 | 879 | def __init__(self, path, stat=True): |
|
880 | 880 | self.path = path |
|
881 | 881 | self.cachestat = None |
|
882 | 882 | self._cacheable = None |
|
883 | 883 | |
|
884 | 884 | if stat: |
|
885 | 885 | self.cachestat = filecacheentry.stat(self.path) |
|
886 | 886 | |
|
887 | 887 | if self.cachestat: |
|
888 | 888 | self._cacheable = self.cachestat.cacheable() |
|
889 | 889 | else: |
|
890 | 890 | # None means we don't know yet |
|
891 | 891 | self._cacheable = None |
|
892 | 892 | |
|
893 | 893 | def refresh(self): |
|
894 | 894 | if self.cacheable(): |
|
895 | 895 | self.cachestat = filecacheentry.stat(self.path) |
|
896 | 896 | |
|
897 | 897 | def cacheable(self): |
|
898 | 898 | if self._cacheable is not None: |
|
899 | 899 | return self._cacheable |
|
900 | 900 | |
|
901 | 901 | # we don't know yet, assume it is for now |
|
902 | 902 | return True |
|
903 | 903 | |
|
904 | 904 | def changed(self): |
|
905 | 905 | # no point in going further if we can't cache it |
|
906 | 906 | if not self.cacheable(): |
|
907 | 907 | return True |
|
908 | 908 | |
|
909 | 909 | newstat = filecacheentry.stat(self.path) |
|
910 | 910 | |
|
911 | 911 | # we may not know if it's cacheable yet, check again now |
|
912 | 912 | if newstat and self._cacheable is None: |
|
913 | 913 | self._cacheable = newstat.cacheable() |
|
914 | 914 | |
|
915 | 915 | # check again |
|
916 | 916 | if not self._cacheable: |
|
917 | 917 | return True |
|
918 | 918 | |
|
919 | 919 | if self.cachestat != newstat: |
|
920 | 920 | self.cachestat = newstat |
|
921 | 921 | return True |
|
922 | 922 | else: |
|
923 | 923 | return False |
|
924 | 924 | |
|
925 | 925 | @staticmethod |
|
926 | 926 | def stat(path): |
|
927 | 927 | try: |
|
928 | 928 | return util.cachestat(path) |
|
929 | 929 | except OSError, e: |
|
930 | 930 | if e.errno != errno.ENOENT: |
|
931 | 931 | raise |
|
932 | 932 | |
|
933 | 933 | class filecache(object): |
|
934 | 934 | '''A property like decorator that tracks a file under .hg/ for updates. |
|
935 | 935 | |
|
936 | 936 | Records stat info when called in _filecache. |
|
937 | 937 | |
|
938 | 938 | On subsequent calls, compares old stat info with new info, and recreates |
|
939 | 939 | the object when needed, updating the new stat info in _filecache. |
|
940 | 940 | |
|
941 | 941 | Mercurial either atomic renames or appends for files under .hg, |
|
942 | 942 | so to ensure the cache is reliable we need the filesystem to be able |
|
943 | 943 | to tell us if a file has been replaced. If it can't, we fallback to |
|
944 | 944 | recreating the object on every call (essentially the same behaviour as |
|
945 | 945 | propertycache).''' |
|
946 | 946 | def __init__(self, path): |
|
947 | 947 | self.path = path |
|
948 | 948 | |
|
949 | 949 | def join(self, obj, fname): |
|
950 | 950 | """Used to compute the runtime path of the cached file. |
|
951 | 951 | |
|
952 | 952 | Users should subclass filecache and provide their own version of this |
|
953 | 953 | function to call the appropriate join function on 'obj' (an instance |
|
954 | 954 | of the class that its member function was decorated). |
|
955 | 955 | """ |
|
956 | 956 | return obj.join(fname) |
|
957 | 957 | |
|
958 | 958 | def __call__(self, func): |
|
959 | 959 | self.func = func |
|
960 | 960 | self.name = func.__name__ |
|
961 | 961 | return self |
|
962 | 962 | |
|
963 | 963 | def __get__(self, obj, type=None): |
|
964 | 964 | # do we need to check if the file changed? |
|
965 | 965 | if self.name in obj.__dict__: |
|
966 | 966 | assert self.name in obj._filecache, self.name |
|
967 | 967 | return obj.__dict__[self.name] |
|
968 | 968 | |
|
969 | 969 | entry = obj._filecache.get(self.name) |
|
970 | 970 | |
|
971 | 971 | if entry: |
|
972 | 972 | if entry.changed(): |
|
973 | 973 | entry.obj = self.func(obj) |
|
974 | 974 | else: |
|
975 | 975 | path = self.join(obj, self.path) |
|
976 | 976 | |
|
977 | 977 | # We stat -before- creating the object so our cache doesn't lie if |
|
978 | 978 | # a writer modified between the time we read and stat |
|
979 | 979 | entry = filecacheentry(path) |
|
980 | 980 | entry.obj = self.func(obj) |
|
981 | 981 | |
|
982 | 982 | obj._filecache[self.name] = entry |
|
983 | 983 | |
|
984 | 984 | obj.__dict__[self.name] = entry.obj |
|
985 | 985 | return entry.obj |
|
986 | 986 | |
|
987 | 987 | def __set__(self, obj, value): |
|
988 | 988 | if self.name not in obj._filecache: |
|
989 | 989 | # we add an entry for the missing value because X in __dict__ |
|
990 | 990 | # implies X in _filecache |
|
991 | 991 | ce = filecacheentry(self.join(obj, self.path), False) |
|
992 | 992 | obj._filecache[self.name] = ce |
|
993 | 993 | else: |
|
994 | 994 | ce = obj._filecache[self.name] |
|
995 | 995 | |
|
996 | 996 | ce.obj = value # update cached copy |
|
997 | 997 | obj.__dict__[self.name] = value # update copy returned by obj.x |
|
998 | 998 | |
|
999 | 999 | def __delete__(self, obj): |
|
1000 | 1000 | try: |
|
1001 | 1001 | del obj.__dict__[self.name] |
|
1002 | 1002 | except KeyError: |
|
1003 | 1003 | raise AttributeError(self.name) |
@@ -1,424 +1,433 b'' | |||
|
1 | 1 | # template-filters.py - common template expansion filters |
|
2 | 2 | # |
|
3 | 3 | # Copyright 2005-2008 Matt Mackall <mpm@selenic.com> |
|
4 | 4 | # |
|
5 | 5 | # This software may be used and distributed according to the terms of the |
|
6 | 6 | # GNU General Public License version 2 or any later version. |
|
7 | 7 | |
|
8 | 8 | import cgi, re, os, time, urllib |
|
9 | 9 | import encoding, node, util, error |
|
10 | 10 | import hbisect |
|
11 | 11 | |
|
12 | 12 | def addbreaks(text): |
|
13 | 13 | """:addbreaks: Any text. Add an XHTML "<br />" tag before the end of |
|
14 | 14 | every line except the last. |
|
15 | 15 | """ |
|
16 | 16 | return text.replace('\n', '<br/>\n') |
|
17 | 17 | |
|
18 | 18 | agescales = [("year", 3600 * 24 * 365), |
|
19 | 19 | ("month", 3600 * 24 * 30), |
|
20 | 20 | ("week", 3600 * 24 * 7), |
|
21 | 21 | ("day", 3600 * 24), |
|
22 | 22 | ("hour", 3600), |
|
23 | 23 | ("minute", 60), |
|
24 | 24 | ("second", 1)] |
|
25 | 25 | |
|
26 | 26 | def age(date): |
|
27 | 27 | """:age: Date. Returns a human-readable date/time difference between the |
|
28 | 28 | given date/time and the current date/time. |
|
29 | 29 | """ |
|
30 | 30 | |
|
31 | 31 | def plural(t, c): |
|
32 | 32 | if c == 1: |
|
33 | 33 | return t |
|
34 | 34 | return t + "s" |
|
35 | 35 | def fmt(t, c): |
|
36 | 36 | return "%d %s" % (c, plural(t, c)) |
|
37 | 37 | |
|
38 | 38 | now = time.time() |
|
39 | 39 | then = date[0] |
|
40 | 40 | future = False |
|
41 | 41 | if then > now: |
|
42 | 42 | future = True |
|
43 | 43 | delta = max(1, int(then - now)) |
|
44 | 44 | if delta > agescales[0][1] * 30: |
|
45 | 45 | return 'in the distant future' |
|
46 | 46 | else: |
|
47 | 47 | delta = max(1, int(now - then)) |
|
48 | 48 | if delta > agescales[0][1] * 2: |
|
49 | 49 | return util.shortdate(date) |
|
50 | 50 | |
|
51 | 51 | for t, s in agescales: |
|
52 | 52 | n = delta // s |
|
53 | 53 | if n >= 2 or s == 1: |
|
54 | 54 | if future: |
|
55 | 55 | return '%s from now' % fmt(t, n) |
|
56 | 56 | return '%s ago' % fmt(t, n) |
|
57 | 57 | |
|
58 | 58 | def basename(path): |
|
59 | 59 | """:basename: Any text. Treats the text as a path, and returns the last |
|
60 | 60 | component of the path after splitting by the path separator |
|
61 | 61 | (ignoring trailing separators). For example, "foo/bar/baz" becomes |
|
62 | 62 | "baz" and "foo/bar//" becomes "bar". |
|
63 | 63 | """ |
|
64 | 64 | return os.path.basename(path) |
|
65 | 65 | |
|
66 | 66 | def datefilter(text): |
|
67 | 67 | """:date: Date. Returns a date in a Unix date format, including the |
|
68 | 68 | timezone: "Mon Sep 04 15:13:13 2006 0700". |
|
69 | 69 | """ |
|
70 | 70 | return util.datestr(text) |
|
71 | 71 | |
|
72 | 72 | def domain(author): |
|
73 | 73 | """:domain: Any text. Finds the first string that looks like an email |
|
74 | 74 | address, and extracts just the domain component. Example: ``User |
|
75 | 75 | <user@example.com>`` becomes ``example.com``. |
|
76 | 76 | """ |
|
77 | 77 | f = author.find('@') |
|
78 | 78 | if f == -1: |
|
79 | 79 | return '' |
|
80 | 80 | author = author[f + 1:] |
|
81 | 81 | f = author.find('>') |
|
82 | 82 | if f >= 0: |
|
83 | 83 | author = author[:f] |
|
84 | 84 | return author |
|
85 | 85 | |
|
86 | 86 | def email(text): |
|
87 | 87 | """:email: Any text. Extracts the first string that looks like an email |
|
88 | 88 | address. Example: ``User <user@example.com>`` becomes |
|
89 | 89 | ``user@example.com``. |
|
90 | 90 | """ |
|
91 | 91 | return util.email(text) |
|
92 | 92 | |
|
93 | 93 | def escape(text): |
|
94 | 94 | """:escape: Any text. Replaces the special XML/XHTML characters "&", "<" |
|
95 | 95 | and ">" with XML entities, and filters out NUL characters. |
|
96 | 96 | """ |
|
97 | 97 | return cgi.escape(text.replace('\0', ''), True) |
|
98 | 98 | |
|
99 | 99 | para_re = None |
|
100 | 100 | space_re = None |
|
101 | 101 | |
|
102 | 102 | def fill(text, width): |
|
103 | 103 | '''fill many paragraphs.''' |
|
104 | 104 | global para_re, space_re |
|
105 | 105 | if para_re is None: |
|
106 | 106 | para_re = re.compile('(\n\n|\n\\s*[-*]\\s*)', re.M) |
|
107 | 107 | space_re = re.compile(r' +') |
|
108 | 108 | |
|
109 | 109 | def findparas(): |
|
110 | 110 | start = 0 |
|
111 | 111 | while True: |
|
112 | 112 | m = para_re.search(text, start) |
|
113 | 113 | if not m: |
|
114 | 114 | uctext = unicode(text[start:], encoding.encoding) |
|
115 | 115 | w = len(uctext) |
|
116 | 116 | while 0 < w and uctext[w - 1].isspace(): |
|
117 | 117 | w -= 1 |
|
118 | 118 | yield (uctext[:w].encode(encoding.encoding), |
|
119 | 119 | uctext[w:].encode(encoding.encoding)) |
|
120 | 120 | break |
|
121 | 121 | yield text[start:m.start(0)], m.group(1) |
|
122 | 122 | start = m.end(1) |
|
123 | 123 | |
|
124 | 124 | return "".join([space_re.sub(' ', util.wrap(para, width=width)) + rest |
|
125 | 125 | for para, rest in findparas()]) |
|
126 | 126 | |
|
127 | 127 | def fill68(text): |
|
128 | 128 | """:fill68: Any text. Wraps the text to fit in 68 columns.""" |
|
129 | 129 | return fill(text, 68) |
|
130 | 130 | |
|
131 | 131 | def fill76(text): |
|
132 | 132 | """:fill76: Any text. Wraps the text to fit in 76 columns.""" |
|
133 | 133 | return fill(text, 76) |
|
134 | 134 | |
|
135 | 135 | def firstline(text): |
|
136 | 136 | """:firstline: Any text. Returns the first line of text.""" |
|
137 | 137 | try: |
|
138 | 138 | return text.splitlines(True)[0].rstrip('\r\n') |
|
139 | 139 | except IndexError: |
|
140 | 140 | return '' |
|
141 | 141 | |
|
142 | 142 | def hexfilter(text): |
|
143 | 143 | """:hex: Any text. Convert a binary Mercurial node identifier into |
|
144 | 144 | its long hexadecimal representation. |
|
145 | 145 | """ |
|
146 | 146 | return node.hex(text) |
|
147 | 147 | |
|
148 | 148 | def hgdate(text): |
|
149 | 149 | """:hgdate: Date. Returns the date as a pair of numbers: "1157407993 |
|
150 | 150 | 25200" (Unix timestamp, timezone offset). |
|
151 | 151 | """ |
|
152 | 152 | return "%d %d" % text |
|
153 | 153 | |
|
154 | 154 | def isodate(text): |
|
155 | 155 | """:isodate: Date. Returns the date in ISO 8601 format: "2009-08-18 13:00 |
|
156 | 156 | +0200". |
|
157 | 157 | """ |
|
158 | 158 | return util.datestr(text, '%Y-%m-%d %H:%M %1%2') |
|
159 | 159 | |
|
160 | 160 | def isodatesec(text): |
|
161 | 161 | """:isodatesec: Date. Returns the date in ISO 8601 format, including |
|
162 | 162 | seconds: "2009-08-18 13:00:13 +0200". See also the rfc3339date |
|
163 | 163 | filter. |
|
164 | 164 | """ |
|
165 | 165 | return util.datestr(text, '%Y-%m-%d %H:%M:%S %1%2') |
|
166 | 166 | |
|
167 | 167 | def indent(text, prefix): |
|
168 | 168 | '''indent each non-empty line of text after first with prefix.''' |
|
169 | 169 | lines = text.splitlines() |
|
170 | 170 | num_lines = len(lines) |
|
171 | 171 | endswithnewline = text[-1:] == '\n' |
|
172 | 172 | def indenter(): |
|
173 | 173 | for i in xrange(num_lines): |
|
174 | 174 | l = lines[i] |
|
175 | 175 | if i and l.strip(): |
|
176 | 176 | yield prefix |
|
177 | 177 | yield l |
|
178 | 178 | if i < num_lines - 1 or endswithnewline: |
|
179 | 179 | yield '\n' |
|
180 | 180 | return "".join(indenter()) |
|
181 | 181 | |
|
182 | 182 | def json(obj): |
|
183 | 183 | if obj is None or obj is False or obj is True: |
|
184 | 184 | return {None: 'null', False: 'false', True: 'true'}[obj] |
|
185 | 185 | elif isinstance(obj, int) or isinstance(obj, float): |
|
186 | 186 | return str(obj) |
|
187 | 187 | elif isinstance(obj, str): |
|
188 | 188 | u = unicode(obj, encoding.encoding, 'replace') |
|
189 | 189 | return '"%s"' % jsonescape(u) |
|
190 | 190 | elif isinstance(obj, unicode): |
|
191 | 191 | return '"%s"' % jsonescape(obj) |
|
192 | 192 | elif util.safehasattr(obj, 'keys'): |
|
193 | 193 | out = [] |
|
194 | 194 | for k, v in obj.iteritems(): |
|
195 | 195 | s = '%s: %s' % (json(k), json(v)) |
|
196 | 196 | out.append(s) |
|
197 | 197 | return '{' + ', '.join(out) + '}' |
|
198 | 198 | elif util.safehasattr(obj, '__iter__'): |
|
199 | 199 | out = [] |
|
200 | 200 | for i in obj: |
|
201 | 201 | out.append(json(i)) |
|
202 | 202 | return '[' + ', '.join(out) + ']' |
|
203 | 203 | else: |
|
204 | 204 | raise TypeError('cannot encode type %s' % obj.__class__.__name__) |
|
205 | 205 | |
|
206 | 206 | def _uescape(c): |
|
207 | 207 | if ord(c) < 0x80: |
|
208 | 208 | return c |
|
209 | 209 | else: |
|
210 | 210 | return '\\u%04x' % ord(c) |
|
211 | 211 | |
|
212 | 212 | _escapes = [ |
|
213 | 213 | ('\\', '\\\\'), ('"', '\\"'), ('\t', '\\t'), ('\n', '\\n'), |
|
214 | 214 | ('\r', '\\r'), ('\f', '\\f'), ('\b', '\\b'), |
|
215 | 215 | ] |
|
216 | 216 | |
|
217 | 217 | def jsonescape(s): |
|
218 | 218 | for k, v in _escapes: |
|
219 | 219 | s = s.replace(k, v) |
|
220 | 220 | return ''.join(_uescape(c) for c in s) |
|
221 | 221 | |
|
222 | 222 | def localdate(text): |
|
223 | 223 | """:localdate: Date. Converts a date to local date.""" |
|
224 | 224 | return (util.parsedate(text)[0], util.makedate()[1]) |
|
225 | 225 | |
|
226 | 226 | def nonempty(str): |
|
227 | 227 | """:nonempty: Any text. Returns '(none)' if the string is empty.""" |
|
228 | 228 | return str or "(none)" |
|
229 | 229 | |
|
230 | 230 | def obfuscate(text): |
|
231 | 231 | """:obfuscate: Any text. Returns the input text rendered as a sequence of |
|
232 | 232 | XML entities. |
|
233 | 233 | """ |
|
234 | 234 | text = unicode(text, encoding.encoding, 'replace') |
|
235 | 235 | return ''.join(['&#%d;' % ord(c) for c in text]) |
|
236 | 236 | |
|
237 | 237 | def permissions(flags): |
|
238 | 238 | if "l" in flags: |
|
239 | 239 | return "lrwxrwxrwx" |
|
240 | 240 | if "x" in flags: |
|
241 | 241 | return "-rwxr-xr-x" |
|
242 | 242 | return "-rw-r--r--" |
|
243 | 243 | |
|
244 | 244 | def person(author): |
|
245 | 245 | """:person: Any text. Returns the name before an email address, |
|
246 | 246 | interpreting it as per RFC 5322. |
|
247 | 247 | |
|
248 | 248 | >>> person('foo@bar') |
|
249 | 249 | 'foo' |
|
250 | 250 | >>> person('Foo Bar <foo@bar>') |
|
251 | 251 | 'Foo Bar' |
|
252 | 252 | >>> person('"Foo Bar" <foo@bar>') |
|
253 | 253 | 'Foo Bar' |
|
254 | 254 | >>> person('"Foo \"buz\" Bar" <foo@bar>') |
|
255 | 255 | 'Foo "buz" Bar' |
|
256 | 256 | >>> # The following are invalid, but do exist in real-life |
|
257 | 257 | ... |
|
258 | 258 | >>> person('Foo "buz" Bar <foo@bar>') |
|
259 | 259 | 'Foo "buz" Bar' |
|
260 | 260 | >>> person('"Foo Bar <foo@bar>') |
|
261 | 261 | 'Foo Bar' |
|
262 | 262 | """ |
|
263 | 263 | if '@' not in author: |
|
264 | 264 | return author |
|
265 | 265 | f = author.find('<') |
|
266 | 266 | if f != -1: |
|
267 | 267 | return author[:f].strip(' "').replace('\\"', '"') |
|
268 | 268 | f = author.find('@') |
|
269 | 269 | return author[:f].replace('.', ' ') |
|
270 | 270 | |
|
271 | 271 | def rfc3339date(text): |
|
272 | 272 | """:rfc3339date: Date. Returns a date using the Internet date format |
|
273 | 273 | specified in RFC 3339: "2009-08-18T13:00:13+02:00". |
|
274 | 274 | """ |
|
275 | 275 | return util.datestr(text, "%Y-%m-%dT%H:%M:%S%1:%2") |
|
276 | 276 | |
|
277 | 277 | def rfc822date(text): |
|
278 | 278 | """:rfc822date: Date. Returns a date using the same format used in email |
|
279 | 279 | headers: "Tue, 18 Aug 2009 13:00:13 +0200". |
|
280 | 280 | """ |
|
281 | 281 | return util.datestr(text, "%a, %d %b %Y %H:%M:%S %1%2") |
|
282 | 282 | |
|
283 | 283 | def short(text): |
|
284 | 284 | """:short: Changeset hash. Returns the short form of a changeset hash, |
|
285 | 285 | i.e. a 12 hexadecimal digit string. |
|
286 | 286 | """ |
|
287 | 287 | return text[:12] |
|
288 | 288 | |
|
289 | 289 | def shortbisect(text): |
|
290 | 290 | """:shortbisect: Any text. Treats `text` as a bisection status, and |
|
291 | 291 | returns a single-character representing the status (G: good, B: bad, |
|
292 | 292 | S: skipped, U: untested, I: ignored). Returns single space if `text` |
|
293 | 293 | is not a valid bisection status. |
|
294 | 294 | """ |
|
295 | 295 | return hbisect.shortlabel(text) or ' ' |
|
296 | 296 | |
|
297 | 297 | def shortdate(text): |
|
298 | 298 | """:shortdate: Date. Returns a date like "2006-09-18".""" |
|
299 | 299 | return util.shortdate(text) |
|
300 | 300 | |
|
301 | 301 | def stringescape(text): |
|
302 | 302 | return text.encode('string_escape') |
|
303 | 303 | |
|
304 | 304 | def stringify(thing): |
|
305 | 305 | """:stringify: Any type. Turns the value into text by converting values into |
|
306 | 306 | text and concatenating them. |
|
307 | 307 | """ |
|
308 | 308 | if util.safehasattr(thing, '__iter__') and not isinstance(thing, str): |
|
309 | 309 | return "".join([stringify(t) for t in thing if t is not None]) |
|
310 | 310 | return str(thing) |
|
311 | 311 | |
|
312 | 312 | def strip(text): |
|
313 | 313 | """:strip: Any text. Strips all leading and trailing whitespace.""" |
|
314 | 314 | return text.strip() |
|
315 | 315 | |
|
316 | 316 | def stripdir(text): |
|
317 | 317 | """:stripdir: Treat the text as path and strip a directory level, if |
|
318 | 318 | possible. For example, "foo" and "foo/bar" becomes "foo". |
|
319 | 319 | """ |
|
320 | 320 | dir = os.path.dirname(text) |
|
321 | 321 | if dir == "": |
|
322 | 322 | return os.path.basename(text) |
|
323 | 323 | else: |
|
324 | 324 | return dir |
|
325 | 325 | |
|
326 | 326 | def tabindent(text): |
|
327 | 327 | """:tabindent: Any text. Returns the text, with every line except the |
|
328 | 328 | first starting with a tab character. |
|
329 | 329 | """ |
|
330 | 330 | return indent(text, '\t') |
|
331 | 331 | |
|
332 | 332 | def urlescape(text): |
|
333 | 333 | """:urlescape: Any text. Escapes all "special" characters. For example, |
|
334 | 334 | "foo bar" becomes "foo%20bar". |
|
335 | 335 | """ |
|
336 | 336 | return urllib.quote(text) |
|
337 | 337 | |
|
338 | 338 | def userfilter(text): |
|
339 | 339 | """:user: Any text. Returns a short representation of a user name or email |
|
340 | 340 | address.""" |
|
341 | 341 | return util.shortuser(text) |
|
342 | 342 | |
|
343 | 343 | def emailuser(text): |
|
344 | 344 | """:emailuser: Any text. Returns the user portion of an email address.""" |
|
345 | 345 | return util.emailuser(text) |
|
346 | 346 | |
|
347 | 347 | def xmlescape(text): |
|
348 | 348 | text = (text |
|
349 | 349 | .replace('&', '&') |
|
350 | 350 | .replace('<', '<') |
|
351 | 351 | .replace('>', '>') |
|
352 | 352 | .replace('"', '"') |
|
353 | 353 | .replace("'", ''')) # ' invalid in HTML |
|
354 | 354 | return re.sub('[\x00-\x08\x0B\x0C\x0E-\x1F]', ' ', text) |
|
355 | 355 | |
|
356 | 356 | filters = { |
|
357 | 357 | "addbreaks": addbreaks, |
|
358 | 358 | "age": age, |
|
359 | 359 | "basename": basename, |
|
360 | 360 | "date": datefilter, |
|
361 | 361 | "domain": domain, |
|
362 | 362 | "email": email, |
|
363 | 363 | "escape": escape, |
|
364 | 364 | "fill68": fill68, |
|
365 | 365 | "fill76": fill76, |
|
366 | 366 | "firstline": firstline, |
|
367 | 367 | "hex": hexfilter, |
|
368 | 368 | "hgdate": hgdate, |
|
369 | 369 | "isodate": isodate, |
|
370 | 370 | "isodatesec": isodatesec, |
|
371 | 371 | "json": json, |
|
372 | 372 | "jsonescape": jsonescape, |
|
373 | 373 | "localdate": localdate, |
|
374 | 374 | "nonempty": nonempty, |
|
375 | 375 | "obfuscate": obfuscate, |
|
376 | 376 | "permissions": permissions, |
|
377 | 377 | "person": person, |
|
378 | 378 | "rfc3339date": rfc3339date, |
|
379 | 379 | "rfc822date": rfc822date, |
|
380 | 380 | "short": short, |
|
381 | 381 | "shortbisect": shortbisect, |
|
382 | 382 | "shortdate": shortdate, |
|
383 | 383 | "stringescape": stringescape, |
|
384 | 384 | "stringify": stringify, |
|
385 | 385 | "strip": strip, |
|
386 | 386 | "stripdir": stripdir, |
|
387 | 387 | "tabindent": tabindent, |
|
388 | 388 | "urlescape": urlescape, |
|
389 | 389 | "user": userfilter, |
|
390 | 390 | "emailuser": emailuser, |
|
391 | 391 | "xmlescape": xmlescape, |
|
392 | 392 | } |
|
393 | 393 | |
|
394 | def websub(text, websubtable): | |
|
395 | """:websub: Any text. Only applies to hgweb. Applies the regular | |
|
396 | expression replacements defined in the websub section. | |
|
397 | """ | |
|
398 | if websubtable: | |
|
399 | for regexp, format in websubtable: | |
|
400 | text = regexp.sub(format, text) | |
|
401 | return text | |
|
402 | ||
|
394 | 403 | def fillfunc(context, mapping, args): |
|
395 | 404 | if not (1 <= len(args) <= 2): |
|
396 | 405 | raise error.ParseError(_("fill expects one or two arguments")) |
|
397 | 406 | |
|
398 | 407 | text = stringify(args[0][0](context, mapping, args[0][1])) |
|
399 | 408 | width = 76 |
|
400 | 409 | if len(args) == 2: |
|
401 | 410 | try: |
|
402 | 411 | width = int(stringify(args[1][0](context, mapping, args[1][1]))) |
|
403 | 412 | except ValueError: |
|
404 | 413 | raise error.ParseError(_("fill expects an integer width")) |
|
405 | 414 | |
|
406 | 415 | return fill(text, width) |
|
407 | 416 | |
|
408 | 417 | def datefunc(context, mapping, args): |
|
409 | 418 | if not (1 <= len(args) <= 2): |
|
410 | 419 | raise error.ParseError(_("date expects one or two arguments")) |
|
411 | 420 | |
|
412 | 421 | date = args[0][0](context, mapping, args[0][1]) |
|
413 | 422 | if len(args) == 2: |
|
414 | 423 | fmt = stringify(args[1][0](context, mapping, args[1][1])) |
|
415 | 424 | return util.datestr(date, fmt) |
|
416 | 425 | return util.datestr(date) |
|
417 | 426 | |
|
418 | 427 | funcs = { |
|
419 | 428 | "fill": fillfunc, |
|
420 | 429 | "date": datefunc, |
|
421 | 430 | } |
|
422 | 431 | |
|
423 | 432 | # tell hggettext to extract docstrings from these functions: |
|
424 | 433 | i18nfunctions = filters.values() |
@@ -1,14 +1,14 b'' | |||
|
1 | 1 | <div> |
|
2 | 2 | <a class="title" href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}"><span class="age">{date|rfc822date}</span>{desc|strip|firstline|escape|nonempty}<span class="logtags"> {inbranch%inbranchtag}{branches%branchtag}{tags%tagtag}{bookmarks%bookmarktag}</span></a> |
|
3 | 3 | </div> |
|
4 | 4 | <div class="title_text"> |
|
5 | 5 | <div class="log_link"> |
|
6 | 6 | <a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">changeset</a><br/> |
|
7 | 7 | </div> |
|
8 | 8 | <i>{author|obfuscate} [{date|rfc822date}] rev {rev}</i><br/> |
|
9 | 9 | </div> |
|
10 | 10 | <div class="log_body"> |
|
11 | {desc|strip|escape|addbreaks|nonempty} | |
|
11 | {desc|strip|escape|websub|addbreaks|nonempty} | |
|
12 | 12 | <br/> |
|
13 | 13 | <br/> |
|
14 | 14 | </div> |
@@ -1,54 +1,54 b'' | |||
|
1 | 1 | {header} |
|
2 | 2 | <title>{repo|escape}: changeset {rev}:{node|short}</title> |
|
3 | 3 | <link rel="alternate" type="application/atom+xml" |
|
4 | 4 | href="{url|urlescape}atom-log" title="Atom feed for {repo|escape}"/> |
|
5 | 5 | <link rel="alternate" type="application/rss+xml" |
|
6 | 6 | href="{url|urlescape}rss-log" title="RSS feed for {repo|escape}"/> |
|
7 | 7 | </head> |
|
8 | 8 | <body> |
|
9 | 9 | |
|
10 | 10 | <div class="page_header"> |
|
11 | 11 | <a href="{logourl}" title="Mercurial" style="float: right;">Mercurial</a> |
|
12 | 12 | <a href="/">Mercurial</a> {pathdef%breadcrumb} / changeset |
|
13 | 13 | </div> |
|
14 | 14 | |
|
15 | 15 | <div class="page_nav"> |
|
16 | 16 | <a href="{url|urlescape}summary{sessionvars%urlparameter}">summary</a> | |
|
17 | 17 | <a href="{url|urlescape}shortlog/{rev}{sessionvars%urlparameter}">shortlog</a> | |
|
18 | 18 | <a href="{url|urlescape}log/{rev}{sessionvars%urlparameter}">changelog</a> | |
|
19 | 19 | <a href="{url|urlescape}graph{sessionvars%urlparameter}">graph</a> | |
|
20 | 20 | <a href="{url|urlescape}tags{sessionvars%urlparameter}">tags</a> | |
|
21 | 21 | <a href="{url|urlescape}bookmarks{sessionvars%urlparameter}">bookmarks</a> | |
|
22 | 22 | <a href="{url|urlescape}branches{sessionvars%urlparameter}">branches</a> | |
|
23 | 23 | <a href="{url|urlescape}file/{node|short}{sessionvars%urlparameter}">files</a> | |
|
24 | 24 | changeset | |
|
25 | 25 | <a href="{url|urlescape}raw-rev/{node|short}">raw</a> {archives%archiveentry} | |
|
26 | 26 | <a href="{url|urlescape}help{sessionvars%urlparameter}">help</a> |
|
27 | 27 | <br/> |
|
28 | 28 | </div> |
|
29 | 29 | |
|
30 | 30 | <div> |
|
31 | 31 | <a class="title" href="{url|urlescape}raw-rev/{node|short}">{desc|strip|escape|firstline|nonempty} <span class="logtags">{inbranch%inbranchtag}{branches%branchtag}{tags%tagtag}{bookmarks%bookmarktag}</span></a> |
|
32 | 32 | </div> |
|
33 | 33 | <div class="title_text"> |
|
34 | 34 | <table cellspacing="0"> |
|
35 | 35 | <tr><td>author</td><td>{author|obfuscate}</td></tr> |
|
36 | 36 | <tr><td></td><td class="date age">{date|rfc822date}</td></tr> |
|
37 | 37 | {branch%changesetbranch} |
|
38 | 38 | <tr><td>changeset {rev}</td><td style="font-family:monospace">{node|short}</td></tr> |
|
39 | 39 | {parent%changesetparent} |
|
40 | 40 | {child%changesetchild} |
|
41 | 41 | </table></div> |
|
42 | 42 | |
|
43 | 43 | <div class="page_body"> |
|
44 | {desc|strip|escape|addbreaks|nonempty} | |
|
44 | {desc|strip|escape|websub|addbreaks|nonempty} | |
|
45 | 45 | </div> |
|
46 | 46 | <div class="list_head"></div> |
|
47 | 47 | <div class="title_text"> |
|
48 | 48 | <table cellspacing="0"> |
|
49 | 49 | {files} |
|
50 | 50 | </table></div> |
|
51 | 51 | |
|
52 | 52 | <div class="page_body">{diff}</div> |
|
53 | 53 | |
|
54 | 54 | {footer} |
@@ -1,67 +1,67 b'' | |||
|
1 | 1 | {header} |
|
2 | 2 | <title>{repo|escape}: {file|escape}@{node|short} (annotated)</title> |
|
3 | 3 | <link rel="alternate" type="application/atom+xml" |
|
4 | 4 | href="{url|urlescape}atom-log" title="Atom feed for {repo|escape}"/> |
|
5 | 5 | <link rel="alternate" type="application/rss+xml" |
|
6 | 6 | href="{url|urlescape}rss-log" title="RSS feed for {repo|escape}"/> |
|
7 | 7 | </head> |
|
8 | 8 | <body> |
|
9 | 9 | |
|
10 | 10 | <div class="page_header"> |
|
11 | 11 | <a href="{logourl}" title="Mercurial" style="float: right;">Mercurial</a> |
|
12 | 12 | <a href="/">Mercurial</a> {pathdef%breadcrumb} / annotate |
|
13 | 13 | </div> |
|
14 | 14 | |
|
15 | 15 | <div class="page_nav"> |
|
16 | 16 | <a href="{url|urlescape}summary{sessionvars%urlparameter}">summary</a> | |
|
17 | 17 | <a href="{url|urlescape}shortlog{sessionvars%urlparameter}">shortlog</a> | |
|
18 | 18 | <a href="{url|urlescape}log{sessionvars%urlparameter}">changelog</a> | |
|
19 | 19 | <a href="{url|urlescape}graph{sessionvars%urlparameter}">graph</a> | |
|
20 | 20 | <a href="{url|urlescape}tags{sessionvars%urlparameter}">tags</a> | |
|
21 | 21 | <a href="{url|urlescape}bookmarks{sessionvars%urlparameter}">bookmarks</a> | |
|
22 | 22 | <a href="{url|urlescape}branches{sessionvars%urlparameter}">branches</a> | |
|
23 | 23 | <a href="{url|urlescape}file/{node|short}{path|urlescape}{sessionvars%urlparameter}">files</a> | |
|
24 | 24 | <a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">changeset</a> | |
|
25 | 25 | <a href="{url|urlescape}file/{node|short}/{file|urlescape}{sessionvars%urlparameter}">file</a> | |
|
26 | 26 | <a href="{url|urlescape}file/tip/{file|urlescape}{sessionvars%urlparameter}">latest</a> | |
|
27 | 27 | <a href="{url|urlescape}log/{node|short}/{file|urlescape}{sessionvars%urlparameter}">revisions</a> | |
|
28 | 28 | annotate | |
|
29 | 29 | <a href="{url|urlescape}diff/{node|short}/{file|urlescape}{sessionvars%urlparameter}">diff</a> | |
|
30 | 30 | <a href="{url|urlescape}comparison/{node|short}/{file|urlescape}{sessionvars%urlparameter}">comparison</a> | |
|
31 | 31 | <a href="{url|urlescape}raw-annotate/{node|short}/{file|urlescape}">raw</a> | |
|
32 | 32 | <a href="{url|urlescape}help{sessionvars%urlparameter}">help</a> |
|
33 | 33 | <br/> |
|
34 | 34 | </div> |
|
35 | 35 | |
|
36 | 36 | <div class="title">{file|escape}</div> |
|
37 | 37 | |
|
38 | 38 | <div class="title_text"> |
|
39 | 39 | <table cellspacing="0"> |
|
40 | 40 | <tr> |
|
41 | 41 | <td>author</td> |
|
42 | 42 | <td>{author|obfuscate}</td></tr> |
|
43 | 43 | <tr> |
|
44 | 44 | <td></td> |
|
45 | 45 | <td class="date age">{date|rfc822date}</td></tr> |
|
46 | 46 | {branch%filerevbranch} |
|
47 | 47 | <tr> |
|
48 | 48 | <td>changeset {rev}</td> |
|
49 | 49 | <td style="font-family:monospace"><a class="list" href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">{node|short}</a></td></tr> |
|
50 | 50 | {parent%fileannotateparent} |
|
51 | 51 | {child%fileannotatechild} |
|
52 | 52 | <tr> |
|
53 | 53 | <td>permissions</td> |
|
54 | 54 | <td style="font-family:monospace">{permissions|permissions}</td></tr> |
|
55 | 55 | </table> |
|
56 | 56 | </div> |
|
57 | 57 | |
|
58 | 58 | <div class="page_path"> |
|
59 | {desc|strip|escape|addbreaks|nonempty} | |
|
59 | {desc|strip|escape|websub|addbreaks|nonempty} | |
|
60 | 60 | </div> |
|
61 | 61 | <div class="page_body"> |
|
62 | 62 | <table> |
|
63 | 63 | {annotate%annotateline} |
|
64 | 64 | </table> |
|
65 | 65 | </div> |
|
66 | 66 | |
|
67 | 67 | {footer} |
@@ -1,66 +1,66 b'' | |||
|
1 | 1 | {header} |
|
2 | 2 | <title>{repo|escape}: {file|escape}@{node|short}</title> |
|
3 | 3 | <link rel="alternate" type="application/atom+xml" |
|
4 | 4 | href="{url|urlescape}atom-log" title="Atom feed for {repo|escape}"/> |
|
5 | 5 | <link rel="alternate" type="application/rss+xml" |
|
6 | 6 | href="{url|urlescape}rss-log" title="RSS feed for {repo|escape}"/> |
|
7 | 7 | </head> |
|
8 | 8 | <body> |
|
9 | 9 | |
|
10 | 10 | <div class="page_header"> |
|
11 | 11 | <a href="{logourl}" title="Mercurial" style="float: right;">Mercurial</a> |
|
12 | 12 | <a href="/">Mercurial</a> {pathdef%breadcrumb} / file revision |
|
13 | 13 | </div> |
|
14 | 14 | |
|
15 | 15 | <div class="page_nav"> |
|
16 | 16 | <a href="{url|urlescape}summary{sessionvars%urlparameter}">summary</a> | |
|
17 | 17 | <a href="{url|urlescape}shortlog{sessionvars%urlparameter}">shortlog</a> | |
|
18 | 18 | <a href="{url|urlescape}log{sessionvars%urlparameter}">changelog</a> | |
|
19 | 19 | <a href="{url|urlescape}graph{sessionvars%urlparameter}">graph</a> | |
|
20 | 20 | <a href="{url|urlescape}tags{sessionvars%urlparameter}">tags</a> | |
|
21 | 21 | <a href="{url|urlescape}bookmarks{sessionvars%urlparameter}">bookmarks</a> | |
|
22 | 22 | <a href="{url|urlescape}branches{sessionvars%urlparameter}">branches</a> | |
|
23 | 23 | <a href="{url|urlescape}file/{node|short}{path|urlescape}{sessionvars%urlparameter}">files</a> | |
|
24 | 24 | <a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">changeset</a> | |
|
25 | 25 | file | |
|
26 | 26 | <a href="{url|urlescape}file/tip/{file|urlescape}{sessionvars%urlparameter}">latest</a> | |
|
27 | 27 | <a href="{url|urlescape}log/{node|short}/{file|urlescape}{sessionvars%urlparameter}">revisions</a> | |
|
28 | 28 | <a href="{url|urlescape}annotate/{node|short}/{file|urlescape}{sessionvars%urlparameter}">annotate</a> | |
|
29 | 29 | <a href="{url|urlescape}diff/{node|short}/{file|urlescape}{sessionvars%urlparameter}">diff</a> | |
|
30 | 30 | <a href="{url|urlescape}comparison/{node|short}/{file|urlescape}{sessionvars%urlparameter}">comparison</a> | |
|
31 | 31 | <a href="{url|urlescape}raw-file/{node|short}/{file|urlescape}">raw</a> | |
|
32 | 32 | <a href="{url|urlescape}help{sessionvars%urlparameter}">help</a> |
|
33 | 33 | <br/> |
|
34 | 34 | </div> |
|
35 | 35 | |
|
36 | 36 | <div class="title">{file|escape}</div> |
|
37 | 37 | |
|
38 | 38 | <div class="title_text"> |
|
39 | 39 | <table cellspacing="0"> |
|
40 | 40 | <tr> |
|
41 | 41 | <td>author</td> |
|
42 | 42 | <td>{author|obfuscate}</td></tr> |
|
43 | 43 | <tr> |
|
44 | 44 | <td></td> |
|
45 | 45 | <td class="date age">{date|rfc822date}</td></tr> |
|
46 | 46 | {branch%filerevbranch} |
|
47 | 47 | <tr> |
|
48 | 48 | <td>changeset {rev}</td> |
|
49 | 49 | <td style="font-family:monospace"><a class="list" href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">{node|short}</a></td></tr> |
|
50 | 50 | {parent%filerevparent} |
|
51 | 51 | {child%filerevchild} |
|
52 | 52 | <tr> |
|
53 | 53 | <td>permissions</td> |
|
54 | 54 | <td style="font-family:monospace">{permissions|permissions}</td></tr> |
|
55 | 55 | </table> |
|
56 | 56 | </div> |
|
57 | 57 | |
|
58 | 58 | <div class="page_path"> |
|
59 | {desc|strip|escape|addbreaks|nonempty} | |
|
59 | {desc|strip|escape|websub|addbreaks|nonempty} | |
|
60 | 60 | </div> |
|
61 | 61 | |
|
62 | 62 | <div class="page_body"> |
|
63 | 63 | {text%fileline} |
|
64 | 64 | </div> |
|
65 | 65 | |
|
66 | 66 | {footer} |
@@ -1,6 +1,6 b'' | |||
|
1 | 1 | <h3 class="changelog"><a class="title" href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">{desc|strip|firstline|escape|nonempty}<span class="logtags"> {inbranch%inbranchtag}{branches%branchtag}{tags%tagtag}{bookmarks%bookmarktag}</span></a></h3> |
|
2 | 2 | <ul class="changelog-entry"> |
|
3 | 3 | <li class="age">{date|rfc822date}</li> |
|
4 | 4 | <li>by <span class="name">{author|obfuscate}</span> <span class="revdate">[{date|rfc822date}] rev {rev}</span></li> |
|
5 | <li class="description">{desc|strip|escape|addbreaks|nonempty}</li> | |
|
5 | <li class="description">{desc|strip|escape|websub|addbreaks|nonempty}</li> | |
|
6 | 6 | </ul> |
@@ -1,65 +1,65 b'' | |||
|
1 | 1 | {header} |
|
2 | 2 | <title>{repo|escape}: changeset {rev}:{node|short}</title> |
|
3 | 3 | <link rel="alternate" type="application/atom+xml" href="{url|urlescape}atom-log" title="Atom feed for {repo|escape}"/> |
|
4 | 4 | <link rel="alternate" type="application/rss+xml" href="{url|urlescape}rss-log" title="RSS feed for {repo|escape}"/> |
|
5 | 5 | </head> |
|
6 | 6 | |
|
7 | 7 | <body> |
|
8 | 8 | <div id="container"> |
|
9 | 9 | <div class="page-header"> |
|
10 | 10 | <h1 class="breadcrumb"><a href="/">Mercurial</a> {pathdef%breadcrumb} / changeset</h1> |
|
11 | 11 | |
|
12 | 12 | <form action="{url|urlescape}log"> |
|
13 | 13 | {sessionvars%hiddenformentry} |
|
14 | 14 | <dl class="search"> |
|
15 | 15 | <dt><label>Search: </label></dt> |
|
16 | 16 | <dd><input type="text" name="rev" /></dd> |
|
17 | 17 | </dl> |
|
18 | 18 | </form> |
|
19 | 19 | |
|
20 | 20 | <ul class="page-nav"> |
|
21 | 21 | <li><a href="{url|urlescape}summary{sessionvars%urlparameter}">summary</a></li> |
|
22 | 22 | <li><a href="{url|urlescape}shortlog{sessionvars%urlparameter}">shortlog</a></li> |
|
23 | 23 | <li><a href="{url|urlescape}changelog{sessionvars%urlparameter}">changelog</a></li> |
|
24 | 24 | <li><a href="{url|urlescape}graph/{node|short}{sessionvars%urlparameter}">graph</a></li> |
|
25 | 25 | <li><a href="{url|urlescape}tags{sessionvars%urlparameter}">tags</a></li> |
|
26 | 26 | <li><a href="{url|urlescape}bookmarks{sessionvars%urlparameter}">bookmarks</a></li> |
|
27 | 27 | <li><a href="{url|urlescape}branches{sessionvars%urlparameter}">branches</a></li> |
|
28 | 28 | <li><a href="{url|urlescape}file/{node|short}{sessionvars%urlparameter}">files</a></li> |
|
29 | 29 | <li><a href="{url|urlescape}help{sessionvars%urlparameter}">help</a></li> |
|
30 | 30 | </ul> |
|
31 | 31 | </div> |
|
32 | 32 | |
|
33 | 33 | <ul class="submenu"> |
|
34 | 34 | <li class="current">changeset</li> |
|
35 | 35 | <li><a href="{url|urlescape}raw-rev/{node|short}">raw</a> {archives%archiveentry}</li> |
|
36 | 36 | </ul> |
|
37 | 37 | |
|
38 | 38 | <h2 class="no-link no-border">changeset</h2> |
|
39 | 39 | |
|
40 | 40 | <h3 class="changeset"><a href="{url|urlescape}raw-rev/{node|short}">{desc|strip|escape|firstline|nonempty} <span class="logtags">{inbranch%inbranchtag}{branches%branchtag}{tags%tagtag}{bookmarks%bookmarktag}</span></a></h3> |
|
41 | 41 | <p class="changeset-age age">{date|rfc822date}</p> |
|
42 | 42 | |
|
43 | 43 | <dl class="overview"> |
|
44 | 44 | <dt>author</dt> |
|
45 | 45 | <dd>{author|obfuscate}</dd> |
|
46 | 46 | <dt>date</dt> |
|
47 | 47 | <dd>{date|rfc822date}</dd> |
|
48 | 48 | {branch%changesetbranch} |
|
49 | 49 | <dt>changeset {rev}</dt> |
|
50 | 50 | <dd>{node|short}</dd> |
|
51 | 51 | {parent%changesetparent} |
|
52 | 52 | {child%changesetchild} |
|
53 | 53 | </dl> |
|
54 | 54 | |
|
55 | <p class="description">{desc|strip|escape|addbreaks|nonempty}</p> | |
|
55 | <p class="description">{desc|strip|escape|websub|addbreaks|nonempty}</p> | |
|
56 | 56 | |
|
57 | 57 | <table> |
|
58 | 58 | {files} |
|
59 | 59 | </table> |
|
60 | 60 | |
|
61 | 61 | <div class="diff"> |
|
62 | 62 | {diff} |
|
63 | 63 | </div> |
|
64 | 64 | |
|
65 | 65 | {footer} |
@@ -1,66 +1,66 b'' | |||
|
1 | 1 | {header} |
|
2 | 2 | <title>{repo|escape}: {file|escape}@{node|short} (annotated)</title> |
|
3 | 3 | <link rel="alternate" type="application/atom+xml" href="{url|urlescape}atom-log" title="Atom feed for {repo|escape}"/> |
|
4 | 4 | <link rel="alternate" type="application/rss+xml" href="{url|urlescape}rss-log" title="RSS feed for {repo|escape}"/> |
|
5 | 5 | </head> |
|
6 | 6 | |
|
7 | 7 | <body> |
|
8 | 8 | <div id="container"> |
|
9 | 9 | <div class="page-header"> |
|
10 | 10 | <h1 class="breadcrumb"><a href="/">Mercurial</a> {pathdef%breadcrumb} / annotate</h1> |
|
11 | 11 | |
|
12 | 12 | <form action="{url|urlescape}log"> |
|
13 | 13 | {sessionvars%hiddenformentry} |
|
14 | 14 | <dl class="search"> |
|
15 | 15 | <dt><label>Search: </label></dt> |
|
16 | 16 | <dd><input type="text" name="rev" /></dd> |
|
17 | 17 | </dl> |
|
18 | 18 | </form> |
|
19 | 19 | |
|
20 | 20 | <ul class="page-nav"> |
|
21 | 21 | <li><a href="{url|urlescape}summary{sessionvars%urlparameter}">summary</a></li> |
|
22 | 22 | <li><a href="{url|urlescape}shortlog{sessionvars%urlparameter}">shortlog</a></li> |
|
23 | 23 | <li><a href="{url|urlescape}log{sessionvars%urlparameter}">changelog</a></li> |
|
24 | 24 | <li><a href="{url|urlescape}graph/{node|short}{sessionvars%urlparameter}">graph</a></li> |
|
25 | 25 | <li><a href="{url|urlescape}tags{sessionvars%urlparameter}">tags</a></li> |
|
26 | 26 | <li><a href="{url|urlescape}bookmarks{sessionvars%urlparameter}">bookmarks</a></li> |
|
27 | 27 | <li><a href="{url|urlescape}branches{sessionvars%urlparameter}">branches</a></li> |
|
28 | 28 | <li><a href="{url|urlescape}file/{node|short}{path|urlescape}{sessionvars%urlparameter}">files</a></li> |
|
29 | 29 | <li><a href="{url|urlescape}help{sessionvars%urlparameter}">help</a></li> |
|
30 | 30 | </ul> |
|
31 | 31 | </div> |
|
32 | 32 | |
|
33 | 33 | <ul class="submenu"> |
|
34 | 34 | <li><a href="{url|urlescape}file/{node|short}/{file|urlescape}{sessionvars%urlparameter}">file</a></li> |
|
35 | 35 | <li><a href="{url|urlescape}log/{node|short}/{file|urlescape}{sessionvars%urlparameter}">revisions</a></li> |
|
36 | 36 | <li class="current">annotate</li> |
|
37 | 37 | <li><a href="{url|urlescape}diff/{node|short}/{file|urlescape}{sessionvars%urlparameter}">diff</a></li> |
|
38 | 38 | <li><a href="{url|urlescape}comparison/{node|short}/{file|urlescape}{sessionvars%urlparameter}">comparison</a></li> |
|
39 | 39 | <li><a href="{url|urlescape}raw-annotate/{node|short}/{file|urlescape}">raw</a></li> |
|
40 | 40 | </ul> |
|
41 | 41 | |
|
42 | 42 | <h2 class="no-link no-border">{file|escape}@{node|short} (annotated)</h2> |
|
43 | 43 | <h3 class="changeset">{file|escape}</h3> |
|
44 | 44 | <p class="changeset-age age">{date|rfc822date}</p> |
|
45 | 45 | |
|
46 | 46 | <dl class="overview"> |
|
47 | 47 | <dt>author</dt> |
|
48 | 48 | <dd>{author|obfuscate}</dd> |
|
49 | 49 | <dt>date</dt> |
|
50 | 50 | <dd>{date|rfc822date}</dd> |
|
51 | 51 | {branch%filerevbranch} |
|
52 | 52 | <dt>changeset {rev}</dt> |
|
53 | 53 | <dd><a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">{node|short}</a></dd> |
|
54 | 54 | {parent%fileannotateparent} |
|
55 | 55 | {child%fileannotatechild} |
|
56 | 56 | <dt>permissions</dt> |
|
57 | 57 | <dd>{permissions|permissions}</dd> |
|
58 | 58 | </dl> |
|
59 | 59 | |
|
60 | <p class="description">{desc|strip|escape|addbreaks|nonempty}</p> | |
|
60 | <p class="description">{desc|strip|escape|websub|addbreaks|nonempty}</p> | |
|
61 | 61 | |
|
62 | 62 | <table class="annotated"> |
|
63 | 63 | {annotate%annotateline} |
|
64 | 64 | </table> |
|
65 | 65 | |
|
66 | 66 | {footer} |
@@ -1,66 +1,66 b'' | |||
|
1 | 1 | {header} |
|
2 | 2 | <title>{repo|escape}: {file|escape}@{node|short}</title> |
|
3 | 3 | <link rel="alternate" type="application/atom+xml" href="{url|urlescape}atom-log" title="Atom feed for {repo|escape}"/> |
|
4 | 4 | <link rel="alternate" type="application/rss+xml" href="{url|urlescape}rss-log" title="RSS feed for {repo|escape}"/> |
|
5 | 5 | </head> |
|
6 | 6 | |
|
7 | 7 | <body> |
|
8 | 8 | <div id="container"> |
|
9 | 9 | <div class="page-header"> |
|
10 | 10 | <h1 class="breadcrumb"><a href="/">Mercurial</a> {pathdef%breadcrumb} / file revision</h1> |
|
11 | 11 | |
|
12 | 12 | <form action="{url|urlescape}log"> |
|
13 | 13 | {sessionvars%hiddenformentry} |
|
14 | 14 | <dl class="search"> |
|
15 | 15 | <dt><label>Search: </label></dt> |
|
16 | 16 | <dd><input type="text" name="rev" /></dd> |
|
17 | 17 | </dl> |
|
18 | 18 | </form> |
|
19 | 19 | |
|
20 | 20 | <ul class="page-nav"> |
|
21 | 21 | <li><a href="{url|urlescape}summary{sessionvars%urlparameter}">summary</a></li> |
|
22 | 22 | <li><a href="{url|urlescape}shortlog{sessionvars%urlparameter}">shortlog</a></li> |
|
23 | 23 | <li><a href="{url|urlescape}changelog{sessionvars%urlparameter}">changelog</a></li> |
|
24 | 24 | <li><a href="{url|urlescape}graph/{node|short}{sessionvars%urlparameter}">graph</a></li> |
|
25 | 25 | <li><a href="{url|urlescape}tags{sessionvars%urlparameter}">tags</a></li> |
|
26 | 26 | <li><a href="{url|urlescape}bookmarks{sessionvars%urlparameter}">bookmarks</a></li> |
|
27 | 27 | <li><a href="{url|urlescape}branches{sessionvars%urlparameter}">branches</a></li> |
|
28 | 28 | <li><a href="{url|urlescape}file/{node|short}{path|urlescape}{sessionvars%urlparameter}">files</a></li> |
|
29 | 29 | <li><a href="{url|urlescape}help{sessionvars%urlparameter}">help</a></li> |
|
30 | 30 | </ul> |
|
31 | 31 | </div> |
|
32 | 32 | |
|
33 | 33 | <ul class="submenu"> |
|
34 | 34 | <li class="current">file</li> |
|
35 | 35 | <li><a href="{url|urlescape}log/{node|short}/{file|urlescape}{sessionvars%urlparameter}">revisions</a></li> |
|
36 | 36 | <li><a href="{url|urlescape}annotate/{node|short}/{file|urlescape}{sessionvars%urlparameter}">annotate</a></li> |
|
37 | 37 | <li><a href="{url|urlescape}diff/{node|short}/{file|urlescape}{sessionvars%urlparameter}">diff</a></li> |
|
38 | 38 | <li><a href="{url|urlescape}comparison/{node|short}/{file|urlescape}{sessionvars%urlparameter}">comparison</a></li> |
|
39 | 39 | <li><a href="{url|urlescape}raw-file/{node|short}/{file|urlescape}">raw</a></li> |
|
40 | 40 | </ul> |
|
41 | 41 | |
|
42 | 42 | <h2 class="no-link no-border">{file|escape}@{node|short}</h2> |
|
43 | 43 | <h3 class="changeset">{file|escape}</h3> |
|
44 | 44 | <p class="changeset-age age">{date|rfc822date}</p> |
|
45 | 45 | |
|
46 | 46 | <dl class="overview"> |
|
47 | 47 | <dt>author</dt> |
|
48 | 48 | <dd>{author|obfuscate}</dd> |
|
49 | 49 | <dt>date</dt> |
|
50 | 50 | <dd>{date|rfc822date}</dd> |
|
51 | 51 | {branch%filerevbranch} |
|
52 | 52 | <dt>changeset {rev}</dt> |
|
53 | 53 | <dd><a class="list" href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">{node|short}</a></dd> |
|
54 | 54 | {parent%filerevparent} |
|
55 | 55 | {child%filerevchild} |
|
56 | 56 | <dt>permissions</dt> |
|
57 | 57 | <dd>{permissions|permissions}</dd> |
|
58 | 58 | </dl> |
|
59 | 59 | |
|
60 | <p class="description">{desc|strip|escape|addbreaks|nonempty}</p> | |
|
60 | <p class="description">{desc|strip|escape|websub|addbreaks|nonempty}</p> | |
|
61 | 61 | |
|
62 | 62 | <div class="source"> |
|
63 | 63 | {text%fileline} |
|
64 | 64 | </div> |
|
65 | 65 | |
|
66 | 66 | {footer} |
@@ -1,87 +1,87 b'' | |||
|
1 | 1 | {header} |
|
2 | 2 | <title>{repo|escape}: {node|short}</title> |
|
3 | 3 | </head> |
|
4 | 4 | <body> |
|
5 | 5 | <div class="container"> |
|
6 | 6 | <div class="menu"> |
|
7 | 7 | <div class="logo"> |
|
8 | 8 | <a href="{logourl}"> |
|
9 | 9 | <img src="{staticurl|urlescape}{logoimg}" alt="mercurial" /></a> |
|
10 | 10 | </div> |
|
11 | 11 | <ul> |
|
12 | 12 | <li><a href="{url|urlescape}shortlog/{node|short}{sessionvars%urlparameter}">log</a></li> |
|
13 | 13 | <li><a href="{url|urlescape}graph/{node|short}{sessionvars%urlparameter}">graph</a></li> |
|
14 | 14 | <li><a href="{url|urlescape}tags{sessionvars%urlparameter}">tags</a></li> |
|
15 | 15 | <li><a href="{url|urlescape}bookmarks{sessionvars%urlparameter}">bookmarks</a></li> |
|
16 | 16 | <li><a href="{url|urlescape}branches{sessionvars%urlparameter}">branches</a></li> |
|
17 | 17 | </ul> |
|
18 | 18 | <ul> |
|
19 | 19 | <li class="active">changeset</li> |
|
20 | 20 | <li><a href="{url|urlescape}raw-rev/{node|short}{sessionvars%urlparameter}">raw</a></li> |
|
21 | 21 | <li><a href="{url|urlescape}file/{node|short}{sessionvars%urlparameter}">browse</a></li> |
|
22 | 22 | </ul> |
|
23 | 23 | <ul> |
|
24 | 24 | {archives%archiveentry} |
|
25 | 25 | </ul> |
|
26 | 26 | <ul> |
|
27 | 27 | <li><a href="{url|urlescape}help{sessionvars%urlparameter}">help</a></li> |
|
28 | 28 | </ul> |
|
29 | 29 | </div> |
|
30 | 30 | |
|
31 | 31 | <div class="main"> |
|
32 | 32 | |
|
33 | 33 | <h2 class="breadcrumb"><a href="/">Mercurial</a> {pathdef%breadcrumb}</h2> |
|
34 | 34 | <h3>changeset {rev}:{node|short} {changesetbranch%changelogbranchname} {changesettag} {changesetbookmark}</h3> |
|
35 | 35 | |
|
36 | 36 | <form class="search" action="{url|urlescape}log"> |
|
37 | 37 | {sessionvars%hiddenformentry} |
|
38 | 38 | <p><input name="rev" id="search1" type="text" size="30" /></p> |
|
39 | 39 | <div id="hint">find changesets by author, revision, |
|
40 | 40 | files, or words in the commit message</div> |
|
41 | 41 | </form> |
|
42 | 42 | |
|
43 | <div class="description">{desc|strip|escape|nonempty}</div> | |
|
43 | <div class="description">{desc|strip|escape|websub|nonempty}</div> | |
|
44 | 44 | |
|
45 | 45 | <table id="changesetEntry"> |
|
46 | 46 | <tr> |
|
47 | 47 | <th class="author">author</th> |
|
48 | 48 | <td class="author">{author|obfuscate}</td> |
|
49 | 49 | </tr> |
|
50 | 50 | <tr> |
|
51 | 51 | <th class="date">date</th> |
|
52 | 52 | <td class="date age">{date|rfc822date}</td></tr> |
|
53 | 53 | <tr> |
|
54 | 54 | <th class="author">parents</th> |
|
55 | 55 | <td class="author">{parent%changesetparent}</td> |
|
56 | 56 | </tr> |
|
57 | 57 | <tr> |
|
58 | 58 | <th class="author">children</th> |
|
59 | 59 | <td class="author">{child%changesetchild}</td> |
|
60 | 60 | </tr> |
|
61 | 61 | <tr> |
|
62 | 62 | <th class="files">files</th> |
|
63 | 63 | <td class="files">{files}</td> |
|
64 | 64 | </tr> |
|
65 | 65 | <tr> |
|
66 | 66 | <th class="diffstat">diffstat</th> |
|
67 | 67 | <td class="diffstat"> |
|
68 | 68 | {diffsummary} |
|
69 | 69 | <a id="diffstatexpand" href="javascript:showDiffstat()"/>[<tt>+</tt>]</a> |
|
70 | 70 | <div id="diffstatdetails" style="display:none;"> |
|
71 | 71 | <a href="javascript:hideDiffstat()"/>[<tt>-</tt>]</a> |
|
72 | 72 | <p> |
|
73 | 73 | <table>{diffstat}</table> |
|
74 | 74 | </div> |
|
75 | 75 | </td> |
|
76 | 76 | </tr> |
|
77 | 77 | </table> |
|
78 | 78 | |
|
79 | 79 | <div class="overflow"> |
|
80 | 80 | <div class="sourcefirst"> line diff</div> |
|
81 | 81 | |
|
82 | 82 | {diff} |
|
83 | 83 | </div> |
|
84 | 84 | |
|
85 | 85 | </div> |
|
86 | 86 | </div> |
|
87 | 87 | {footer} |
@@ -1,83 +1,83 b'' | |||
|
1 | 1 | {header} |
|
2 | 2 | <title>{repo|escape}: {file|escape} annotate</title> |
|
3 | 3 | </head> |
|
4 | 4 | <body> |
|
5 | 5 | |
|
6 | 6 | <div class="container"> |
|
7 | 7 | <div class="menu"> |
|
8 | 8 | <div class="logo"> |
|
9 | 9 | <a href="{logourl}"> |
|
10 | 10 | <img src="{staticurl|urlescape}{logoimg}" alt="mercurial" /></a> |
|
11 | 11 | </div> |
|
12 | 12 | <ul> |
|
13 | 13 | <li><a href="{url|urlescape}shortlog/{node|short}{sessionvars%urlparameter}">log</a></li> |
|
14 | 14 | <li><a href="{url|urlescape}graph/{node|short}{sessionvars%urlparameter}">graph</a></li> |
|
15 | 15 | <li><a href="{url|urlescape}tags{sessionvars%urlparameter}">tags</a></li> |
|
16 | 16 | <li><a href="{url|urlescape}bookmarks{sessionvars%urlparameter}">bookmarks</a></li> |
|
17 | 17 | <li><a href="{url|urlescape}branches{sessionvars%urlparameter}">branches</a></li> |
|
18 | 18 | </ul> |
|
19 | 19 | |
|
20 | 20 | <ul> |
|
21 | 21 | <li><a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">changeset</a></li> |
|
22 | 22 | <li><a href="{url|urlescape}file/{node|short}{path|urlescape}{sessionvars%urlparameter}">browse</a></li> |
|
23 | 23 | </ul> |
|
24 | 24 | <ul> |
|
25 | 25 | <li><a href="{url|urlescape}file/{node|short}/{file|urlescape}{sessionvars%urlparameter}">file</a></li> |
|
26 | 26 | <li><a href="{url|urlescape}file/tip/{file|urlescape}{sessionvars%urlparameter}">latest</a></li> |
|
27 | 27 | <li><a href="{url|urlescape}diff/{node|short}/{file|urlescape}{sessionvars%urlparameter}">diff</a></li> |
|
28 | 28 | <li><a href="{url|urlescape}comparison/{node|short}/{file|urlescape}{sessionvars%urlparameter}">comparison</a></li> |
|
29 | 29 | <li class="active">annotate</li> |
|
30 | 30 | <li><a href="{url|urlescape}log/{node|short}/{file|urlescape}{sessionvars%urlparameter}">file log</a></li> |
|
31 | 31 | <li><a href="{url|urlescape}raw-annotate/{node|short}/{file|urlescape}">raw</a></li> |
|
32 | 32 | </ul> |
|
33 | 33 | <ul> |
|
34 | 34 | <li><a href="{url|urlescape}help{sessionvars%urlparameter}">help</a></li> |
|
35 | 35 | </ul> |
|
36 | 36 | </div> |
|
37 | 37 | |
|
38 | 38 | <div class="main"> |
|
39 | 39 | <h2 class="breadcrumb"><a href="/">Mercurial</a> {pathdef%breadcrumb}</h2> |
|
40 | 40 | <h3>annotate {file|escape} @ {rev}:{node|short}</h3> |
|
41 | 41 | |
|
42 | 42 | <form class="search" action="{url|urlescape}log"> |
|
43 | 43 | {sessionvars%hiddenformentry} |
|
44 | 44 | <p><input name="rev" id="search1" type="text" size="30" /></p> |
|
45 | 45 | <div id="hint">find changesets by author, revision, |
|
46 | 46 | files, or words in the commit message</div> |
|
47 | 47 | </form> |
|
48 | 48 | |
|
49 | <div class="description">{desc|strip|escape|nonempty}</div> | |
|
49 | <div class="description">{desc|strip|escape|websub|nonempty}</div> | |
|
50 | 50 | |
|
51 | 51 | <table id="changesetEntry"> |
|
52 | 52 | <tr> |
|
53 | 53 | <th class="author">author</th> |
|
54 | 54 | <td class="author">{author|obfuscate}</td> |
|
55 | 55 | </tr> |
|
56 | 56 | <tr> |
|
57 | 57 | <th class="date">date</th> |
|
58 | 58 | <td class="date age">{date|rfc822date}</td> |
|
59 | 59 | </tr> |
|
60 | 60 | <tr> |
|
61 | 61 | <th class="author">parents</th> |
|
62 | 62 | <td class="author">{parent%filerevparent}</td> |
|
63 | 63 | </tr> |
|
64 | 64 | <tr> |
|
65 | 65 | <th class="author">children</th> |
|
66 | 66 | <td class="author">{child%filerevchild}</td> |
|
67 | 67 | </tr> |
|
68 | 68 | {changesettag} |
|
69 | 69 | </table> |
|
70 | 70 | |
|
71 | 71 | <div class="overflow"> |
|
72 | 72 | <table class="bigtable"> |
|
73 | 73 | <tr> |
|
74 | 74 | <th class="annotate">rev</th> |
|
75 | 75 | <th class="line"> line source</th> |
|
76 | 76 | </tr> |
|
77 | 77 | {annotate%annotateline} |
|
78 | 78 | </table> |
|
79 | 79 | </div> |
|
80 | 80 | </div> |
|
81 | 81 | </div> |
|
82 | 82 | |
|
83 | 83 | {footer} |
@@ -1,93 +1,93 b'' | |||
|
1 | 1 | {header} |
|
2 | 2 | <title>{repo|escape}: {file|escape} comparison</title> |
|
3 | 3 | </head> |
|
4 | 4 | <body> |
|
5 | 5 | |
|
6 | 6 | <div class="container"> |
|
7 | 7 | <div class="menu"> |
|
8 | 8 | <div class="logo"> |
|
9 | 9 | <a href="{logourl}"> |
|
10 | 10 | <img src="{staticurl|urlescape}{logoimg}" alt="mercurial" /></a> |
|
11 | 11 | </div> |
|
12 | 12 | <ul> |
|
13 | 13 | <li><a href="{url|urlescape}shortlog/{node|short}{sessionvars%urlparameter}">log</a></li> |
|
14 | 14 | <li><a href="{url|urlescape}graph/{node|short}{sessionvars%urlparameter}">graph</a></li> |
|
15 | 15 | <li><a href="{url|urlescape}tags{sessionvars%urlparameter}">tags</a></li> |
|
16 | 16 | <li><a href="{url|urlescape}bookmarks{sessionvars%urlparameter}">bookmarks</a></li> |
|
17 | 17 | <li><a href="{url|urlescape}branches{sessionvars%urlparameter}">branches</a></li> |
|
18 | 18 | </ul> |
|
19 | 19 | <ul> |
|
20 | 20 | <li><a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">changeset</a></li> |
|
21 | 21 | <li><a href="{url|urlescape}file/{node|short}{path|urlescape}{sessionvars%urlparameter}">browse</a></li> |
|
22 | 22 | </ul> |
|
23 | 23 | <ul> |
|
24 | 24 | <li><a href="{url|urlescape}file/{node|short}/{file|urlescape}{sessionvars%urlparameter}">file</a></li> |
|
25 | 25 | <li><a href="{url|urlescape}file/tip/{file|urlescape}{sessionvars%urlparameter}">latest</a></li> |
|
26 | 26 | <li><a href="{url|urlescape}diff/{node|short}/{file|urlescape}{sessionvars%urlparameter}">diff</a></li> |
|
27 | 27 | <li class="active">comparison</li> |
|
28 | 28 | <li><a href="{url|urlescape}annotate/{node|short}/{file|urlescape}{sessionvars%urlparameter}">annotate</a></li> |
|
29 | 29 | <li><a href="{url|urlescape}log/{node|short}/{file|urlescape}{sessionvars%urlparameter}">file log</a></li> |
|
30 | 30 | <li><a href="{url|urlescape}raw-file/{node|short}/{file|urlescape}">raw</a></li> |
|
31 | 31 | </ul> |
|
32 | 32 | <ul> |
|
33 | 33 | <li><a href="{url|urlescape}help{sessionvars%urlparameter}">help</a></li> |
|
34 | 34 | </ul> |
|
35 | 35 | </div> |
|
36 | 36 | |
|
37 | 37 | <div class="main"> |
|
38 | 38 | <h2 class="breadcrumb"><a href="/">Mercurial</a> {pathdef%breadcrumb}</h2> |
|
39 | 39 | <h3>comparison {file|escape} @ {rev}:{node|short}</h3> |
|
40 | 40 | |
|
41 | 41 | <form class="search" action="{url|urlescape}log"> |
|
42 | 42 | <p>{sessionvars%hiddenformentry}</p> |
|
43 | 43 | <p><input name="rev" id="search1" type="text" size="30" /></p> |
|
44 | 44 | <div id="hint">find changesets by author, revision, |
|
45 | 45 | files, or words in the commit message</div> |
|
46 | 46 | </form> |
|
47 | 47 | |
|
48 | <div class="description">{desc|strip|escape|nonempty}</div> | |
|
48 | <div class="description">{desc|strip|escape|websub|nonempty}</div> | |
|
49 | 49 | |
|
50 | 50 | <table id="changesetEntry"> |
|
51 | 51 | <tr> |
|
52 | 52 | <th>author</th> |
|
53 | 53 | <td>{author|obfuscate}</td> |
|
54 | 54 | </tr> |
|
55 | 55 | <tr> |
|
56 | 56 | <th>date</th> |
|
57 | 57 | <td class="date age">{date|rfc822date}</td> |
|
58 | 58 | </tr> |
|
59 | 59 | <tr> |
|
60 | 60 | <th>parents</th> |
|
61 | 61 | <td>{parent%filerevparent}</td> |
|
62 | 62 | </tr> |
|
63 | 63 | <tr> |
|
64 | 64 | <th>children</th> |
|
65 | 65 | <td>{child%filerevchild}</td> |
|
66 | 66 | </tr> |
|
67 | 67 | {changesettag} |
|
68 | 68 | </table> |
|
69 | 69 | |
|
70 | 70 | <div class="overflow"> |
|
71 | 71 | <div class="sourcefirst"> comparison</div> |
|
72 | 72 | <div class="legend"> |
|
73 | 73 | <span class="legendinfo equal">equal</span> |
|
74 | 74 | <span class="legendinfo delete">deleted</span> |
|
75 | 75 | <span class="legendinfo insert">inserted</span> |
|
76 | 76 | <span class="legendinfo replace">replaced</span> |
|
77 | 77 | </div> |
|
78 | 78 | |
|
79 | 79 | <table class="bigtable"> |
|
80 | 80 | <thead class="header"> |
|
81 | 81 | <tr> |
|
82 | 82 | <th>{leftrev}:{leftnode|short}</th> |
|
83 | 83 | <th>{rightrev}:{rightnode|short}</th> |
|
84 | 84 | </tr> |
|
85 | 85 | </thead> |
|
86 | 86 | {comparison} |
|
87 | 87 | </table> |
|
88 | 88 | |
|
89 | 89 | </div> |
|
90 | 90 | </div> |
|
91 | 91 | </div> |
|
92 | 92 | |
|
93 | 93 | {footer} |
@@ -1,78 +1,78 b'' | |||
|
1 | 1 | {header} |
|
2 | 2 | <title>{repo|escape}: {file|escape} diff</title> |
|
3 | 3 | </head> |
|
4 | 4 | <body> |
|
5 | 5 | |
|
6 | 6 | <div class="container"> |
|
7 | 7 | <div class="menu"> |
|
8 | 8 | <div class="logo"> |
|
9 | 9 | <a href="{logourl}"> |
|
10 | 10 | <img src="{staticurl|urlescape}{logoimg}" alt="mercurial" /></a> |
|
11 | 11 | </div> |
|
12 | 12 | <ul> |
|
13 | 13 | <li><a href="{url|urlescape}shortlog/{node|short}{sessionvars%urlparameter}">log</a></li> |
|
14 | 14 | <li><a href="{url|urlescape}graph/{node|short}{sessionvars%urlparameter}">graph</a></li> |
|
15 | 15 | <li><a href="{url|urlescape}tags{sessionvars%urlparameter}">tags</a></li> |
|
16 | 16 | <li><a href="{url|urlescape}bookmarks{sessionvars%urlparameter}">bookmarks</a></li> |
|
17 | 17 | <li><a href="{url|urlescape}branches{sessionvars%urlparameter}">branches</a></li> |
|
18 | 18 | </ul> |
|
19 | 19 | <ul> |
|
20 | 20 | <li><a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">changeset</a></li> |
|
21 | 21 | <li><a href="{url|urlescape}file/{node|short}{path|urlescape}{sessionvars%urlparameter}">browse</a></li> |
|
22 | 22 | </ul> |
|
23 | 23 | <ul> |
|
24 | 24 | <li><a href="{url|urlescape}file/{node|short}/{file|urlescape}{sessionvars%urlparameter}">file</a></li> |
|
25 | 25 | <li><a href="{url|urlescape}file/tip/{file|urlescape}{sessionvars%urlparameter}">latest</a></li> |
|
26 | 26 | <li class="active">diff</li> |
|
27 | 27 | <li><a href="{url|urlescape}comparison/{node|short}/{file|urlescape}{sessionvars%urlparameter}">comparison</a></li> |
|
28 | 28 | <li><a href="{url|urlescape}annotate/{node|short}/{file|urlescape}{sessionvars%urlparameter}">annotate</a></li> |
|
29 | 29 | <li><a href="{url|urlescape}log/{node|short}/{file|urlescape}{sessionvars%urlparameter}">file log</a></li> |
|
30 | 30 | <li><a href="{url|urlescape}raw-file/{node|short}/{file|urlescape}">raw</a></li> |
|
31 | 31 | </ul> |
|
32 | 32 | <ul> |
|
33 | 33 | <li><a href="{url|urlescape}help{sessionvars%urlparameter}">help</a></li> |
|
34 | 34 | </ul> |
|
35 | 35 | </div> |
|
36 | 36 | |
|
37 | 37 | <div class="main"> |
|
38 | 38 | <h2 class="breadcrumb"><a href="/">Mercurial</a> {pathdef%breadcrumb}</h2> |
|
39 | 39 | <h3>diff {file|escape} @ {rev}:{node|short}</h3> |
|
40 | 40 | |
|
41 | 41 | <form class="search" action="{url|urlescape}log"> |
|
42 | 42 | <p>{sessionvars%hiddenformentry}</p> |
|
43 | 43 | <p><input name="rev" id="search1" type="text" size="30" /></p> |
|
44 | 44 | <div id="hint">find changesets by author, revision, |
|
45 | 45 | files, or words in the commit message</div> |
|
46 | 46 | </form> |
|
47 | 47 | |
|
48 | <div class="description">{desc|strip|escape|nonempty}</div> | |
|
48 | <div class="description">{desc|strip|escape|websub|nonempty}</div> | |
|
49 | 49 | |
|
50 | 50 | <table id="changesetEntry"> |
|
51 | 51 | <tr> |
|
52 | 52 | <th>author</th> |
|
53 | 53 | <td>{author|obfuscate}</td> |
|
54 | 54 | </tr> |
|
55 | 55 | <tr> |
|
56 | 56 | <th>date</th> |
|
57 | 57 | <td class="date age">{date|rfc822date}</td> |
|
58 | 58 | </tr> |
|
59 | 59 | <tr> |
|
60 | 60 | <th>parents</th> |
|
61 | 61 | <td>{parent%filerevparent}</td> |
|
62 | 62 | </tr> |
|
63 | 63 | <tr> |
|
64 | 64 | <th>children</th> |
|
65 | 65 | <td>{child%filerevchild}</td> |
|
66 | 66 | </tr> |
|
67 | 67 | {changesettag} |
|
68 | 68 | </table> |
|
69 | 69 | |
|
70 | 70 | <div class="overflow"> |
|
71 | 71 | <div class="sourcefirst"> line diff</div> |
|
72 | 72 | |
|
73 | 73 | {diff} |
|
74 | 74 | </div> |
|
75 | 75 | </div> |
|
76 | 76 | </div> |
|
77 | 77 | |
|
78 | 78 | {footer} |
@@ -1,77 +1,77 b'' | |||
|
1 | 1 | {header} |
|
2 | 2 | <title>{repo|escape}: {node|short} {file|escape}</title> |
|
3 | 3 | </head> |
|
4 | 4 | <body> |
|
5 | 5 | |
|
6 | 6 | <div class="container"> |
|
7 | 7 | <div class="menu"> |
|
8 | 8 | <div class="logo"> |
|
9 | 9 | <a href="{logourl}"> |
|
10 | 10 | <img src="{staticurl|urlescape}{logoimg}" alt="mercurial" /></a> |
|
11 | 11 | </div> |
|
12 | 12 | <ul> |
|
13 | 13 | <li><a href="{url|urlescape}shortlog/{node|short}{sessionvars%urlparameter}">log</a></li> |
|
14 | 14 | <li><a href="{url|urlescape}graph/{node|short}{sessionvars%urlparameter}">graph</a></li> |
|
15 | 15 | <li><a href="{url|urlescape}tags{sessionvars%urlparameter}">tags</a></li> |
|
16 | 16 | <li><a href="{url|urlescape}branches{sessionvars%urlparameter}">branches</a></li> |
|
17 | 17 | </ul> |
|
18 | 18 | <ul> |
|
19 | 19 | <li><a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">changeset</a></li> |
|
20 | 20 | <li><a href="{url|urlescape}file/{node|short}{path|urlescape}{sessionvars%urlparameter}">browse</a></li> |
|
21 | 21 | </ul> |
|
22 | 22 | <ul> |
|
23 | 23 | <li class="active">file</li> |
|
24 | 24 | <li><a href="{url|urlescape}file/tip/{file|urlescape}{sessionvars%urlparameter}">latest</a></li> |
|
25 | 25 | <li><a href="{url|urlescape}diff/{node|short}/{file|urlescape}{sessionvars%urlparameter}">diff</a></li> |
|
26 | 26 | <li><a href="{url|urlescape}comparison/{node|short}/{file|urlescape}{sessionvars%urlparameter}">comparison</a></li> |
|
27 | 27 | <li><a href="{url|urlescape}annotate/{node|short}/{file|urlescape}{sessionvars%urlparameter}">annotate</a></li> |
|
28 | 28 | <li><a href="{url|urlescape}log/{node|short}/{file|urlescape}{sessionvars%urlparameter}">file log</a></li> |
|
29 | 29 | <li><a href="{url|urlescape}raw-file/{node|short}/{file|urlescape}">raw</a></li> |
|
30 | 30 | </ul> |
|
31 | 31 | <ul> |
|
32 | 32 | <li><a href="{url|urlescape}help{sessionvars%urlparameter}">help</a></li> |
|
33 | 33 | </ul> |
|
34 | 34 | </div> |
|
35 | 35 | |
|
36 | 36 | <div class="main"> |
|
37 | 37 | <h2 class="breadcrumb"><a href="/">Mercurial</a> {pathdef%breadcrumb}</h2> |
|
38 | 38 | <h3>view {file|escape} @ {rev}:{node|short}</h3> |
|
39 | 39 | |
|
40 | 40 | <form class="search" action="{url|urlescape}log"> |
|
41 | 41 | {sessionvars%hiddenformentry} |
|
42 | 42 | <p><input name="rev" id="search1" type="text" size="30" /></p> |
|
43 | 43 | <div id="hint">find changesets by author, revision, |
|
44 | 44 | files, or words in the commit message</div> |
|
45 | 45 | </form> |
|
46 | 46 | |
|
47 | <div class="description">{desc|strip|escape|nonempty}</div> | |
|
47 | <div class="description">{desc|strip|escape|websub|nonempty}</div> | |
|
48 | 48 | |
|
49 | 49 | <table id="changesetEntry"> |
|
50 | 50 | <tr> |
|
51 | 51 | <th class="author">author</th> |
|
52 | 52 | <td class="author">{author|obfuscate}</td> |
|
53 | 53 | </tr> |
|
54 | 54 | <tr> |
|
55 | 55 | <th class="date">date</th> |
|
56 | 56 | <td class="date age">{date|rfc822date}</td> |
|
57 | 57 | </tr> |
|
58 | 58 | <tr> |
|
59 | 59 | <th class="author">parents</th> |
|
60 | 60 | <td class="author">{parent%filerevparent}</td> |
|
61 | 61 | </tr> |
|
62 | 62 | <tr> |
|
63 | 63 | <th class="author">children</th> |
|
64 | 64 | <td class="author">{child%filerevchild}</td> |
|
65 | 65 | </tr> |
|
66 | 66 | {changesettag} |
|
67 | 67 | </table> |
|
68 | 68 | |
|
69 | 69 | <div class="overflow"> |
|
70 | 70 | <div class="sourcefirst"> line source</div> |
|
71 | 71 | {text%fileline} |
|
72 | 72 | <div class="sourcelast"></div> |
|
73 | 73 | </div> |
|
74 | 74 | </div> |
|
75 | 75 | </div> |
|
76 | 76 | |
|
77 | 77 | {footer} |
@@ -1,52 +1,52 b'' | |||
|
1 | 1 | {header} |
|
2 | 2 | <title>{repo|escape}: changeset {node|short}</title> |
|
3 | 3 | </head> |
|
4 | 4 | <body> |
|
5 | 5 | |
|
6 | 6 | <div class="buttons"> |
|
7 | 7 | <a href="{url|urlescape}log/{rev}{sessionvars%urlparameter}">changelog</a> |
|
8 | 8 | <a href="{url|urlescape}shortlog/{rev}{sessionvars%urlparameter}">shortlog</a> |
|
9 | 9 | <a href="{url|urlescape}graph{sessionvars%urlparameter}">graph</a> |
|
10 | 10 | <a href="{url|urlescape}tags{sessionvars%urlparameter}">tags</a> |
|
11 | 11 | <a href="{url|urlescape}branches{sessionvars%urlparameter}">branches</a> |
|
12 | 12 | <a href="{url|urlescape}file/{node|short}{sessionvars%urlparameter}">files</a> |
|
13 | 13 | <a href="{url|urlescape}raw-rev/{node|short}">raw</a> |
|
14 | 14 | {archives%archiveentry} |
|
15 | 15 | <a href="{url|urlescape}help{sessionvars%urlparameter}">help</a> |
|
16 | 16 | </div> |
|
17 | 17 | |
|
18 | 18 | <h2><a href="/">Mercurial</a> {pathdef%breadcrumb} / changeset: {desc|strip|escape|firstline|nonempty}</h2> |
|
19 | 19 | |
|
20 | 20 | <table id="changesetEntry"> |
|
21 | 21 | <tr> |
|
22 | 22 | <th class="changeset">changeset {rev}:</th> |
|
23 | 23 | <td class="changeset"><a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">{node|short}</a></td> |
|
24 | 24 | </tr> |
|
25 | 25 | {parent%changesetparent} |
|
26 | 26 | {child%changesetchild} |
|
27 | 27 | {changesettag} |
|
28 | 28 | <tr> |
|
29 | 29 | <th class="author">author:</th> |
|
30 | 30 | <td class="author">{author|obfuscate}</td> |
|
31 | 31 | </tr> |
|
32 | 32 | <tr> |
|
33 | 33 | <th class="date">date:</th> |
|
34 | 34 | <td class="date age">{date|rfc822date}</td> |
|
35 | 35 | </tr> |
|
36 | 36 | <tr> |
|
37 | 37 | <th class="files">files:</th> |
|
38 | 38 | <td class="files">{files}</td> |
|
39 | 39 | </tr> |
|
40 | 40 | <tr> |
|
41 | 41 | <th class="description">description:</th> |
|
42 | <td class="description">{desc|strip|escape|addbreaks|nonempty}</td> | |
|
42 | <td class="description">{desc|strip|escape|websub|addbreaks|nonempty}</td> | |
|
43 | 43 | </tr> |
|
44 | 44 | </table> |
|
45 | 45 | |
|
46 | 46 | <div id="changesetDiff"> |
|
47 | 47 | {diff} |
|
48 | 48 | </div> |
|
49 | 49 | |
|
50 | 50 | {footer} |
|
51 | 51 | |
|
52 | 52 |
@@ -1,49 +1,49 b'' | |||
|
1 | 1 | {header} |
|
2 | 2 | <title>{repo|escape}: {file|escape} annotate</title> |
|
3 | 3 | </head> |
|
4 | 4 | <body> |
|
5 | 5 | |
|
6 | 6 | <div class="buttons"> |
|
7 | 7 | <a href="{url|urlescape}log/{rev}{sessionvars%urlparameter}">changelog</a> |
|
8 | 8 | <a href="{url|urlescape}shortlog/{rev}{sessionvars%urlparameter}">shortlog</a> |
|
9 | 9 | <a href="{url|urlescape}graph{sessionvars%urlparameter}">graph</a> |
|
10 | 10 | <a href="{url|urlescape}tags{sessionvars%urlparameter}">tags</a> |
|
11 | 11 | <a href="{url|urlescape}branches{sessionvars%urlparameter}">branches</a> |
|
12 | 12 | <a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">changeset</a> |
|
13 | 13 | <a href="{url|urlescape}file/{node|short}{path|urlescape}{sessionvars%urlparameter}">files</a> |
|
14 | 14 | <a href="{url|urlescape}file/{node|short}/{file|urlescape}{sessionvars%urlparameter}">file</a> |
|
15 | 15 | <a href="{url|urlescape}log/{node|short}/{file|urlescape}{sessionvars%urlparameter}">revisions</a> |
|
16 | 16 | <a href="{url|urlescape}raw-annotate/{node|short}/{file|urlescape}">raw</a> |
|
17 | 17 | <a href="{url|urlescape}help{sessionvars%urlparameter}">help</a> |
|
18 | 18 | </div> |
|
19 | 19 | |
|
20 | 20 | <h2><a href="/">Mercurial</a> {pathdef%breadcrumb} / annotate {file|escape}</h2> |
|
21 | 21 | |
|
22 | 22 | <table> |
|
23 | 23 | <tr> |
|
24 | 24 | <td class="metatag">changeset {rev}:</td> |
|
25 | 25 | <td><a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">{node|short}</a></td></tr> |
|
26 | 26 | {parent%fileannotateparent} |
|
27 | 27 | {child%fileannotatechild} |
|
28 | 28 | <tr> |
|
29 | 29 | <td class="metatag">author:</td> |
|
30 | 30 | <td>{author|obfuscate}</td></tr> |
|
31 | 31 | <tr> |
|
32 | 32 | <td class="metatag">date:</td> |
|
33 | 33 | <td class="date age">{date|rfc822date}</td> |
|
34 | 34 | </tr> |
|
35 | 35 | <tr> |
|
36 | 36 | <td class="metatag">permissions:</td> |
|
37 | 37 | <td>{permissions|permissions}</td> |
|
38 | 38 | </tr> |
|
39 | 39 | <tr> |
|
40 | 40 | <td class="metatag">description:</td> |
|
41 | <td>{desc|strip|escape|addbreaks|nonempty}</td> | |
|
41 | <td>{desc|strip|escape|websub|addbreaks|nonempty}</td> | |
|
42 | 42 | </tr> |
|
43 | 43 | </table> |
|
44 | 44 | |
|
45 | 45 | <table cellspacing="0" cellpadding="0"> |
|
46 | 46 | {annotate%annotateline} |
|
47 | 47 | </table> |
|
48 | 48 | |
|
49 | 49 | {footer} |
@@ -1,47 +1,47 b'' | |||
|
1 | 1 | {header} |
|
2 | 2 | <title>{repo|escape}:{file|escape}</title> |
|
3 | 3 | </head> |
|
4 | 4 | <body> |
|
5 | 5 | |
|
6 | 6 | <div class="buttons"> |
|
7 | 7 | <a href="{url|urlescape}log/{rev}{sessionvars%urlparameter}">changelog</a> |
|
8 | 8 | <a href="{url|urlescape}shortlog/{rev}{sessionvars%urlparameter}">shortlog</a> |
|
9 | 9 | <a href="{url|urlescape}graph{sessionvars%urlparameter}">graph</a> |
|
10 | 10 | <a href="{url|urlescape}tags{sessionvars%urlparameter}">tags</a> |
|
11 | 11 | <a href="{url|urlescape}branches{sessionvars%urlparameter}">branches</a> |
|
12 | 12 | <a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">changeset</a> |
|
13 | 13 | <a href="{url|urlescape}file/{node|short}{path|urlescape}{sessionvars%urlparameter}">files</a> |
|
14 | 14 | <a href="{url|urlescape}log/{node|short}/{file|urlescape}{sessionvars%urlparameter}">revisions</a> |
|
15 | 15 | <a href="{url|urlescape}annotate/{node|short}/{file|urlescape}{sessionvars%urlparameter}">annotate</a> |
|
16 | 16 | <a href="{url|urlescape}raw-file/{node|short}/{file|urlescape}">raw</a> |
|
17 | 17 | <a href="{url|urlescape}help{sessionvars%urlparameter}">help</a> |
|
18 | 18 | </div> |
|
19 | 19 | |
|
20 | 20 | <h2><a href="/">Mercurial</a> {pathdef%breadcrumb} / {file|escape}</h2> |
|
21 | 21 | |
|
22 | 22 | <table> |
|
23 | 23 | <tr> |
|
24 | 24 | <td class="metatag">changeset {rev}:</td> |
|
25 | 25 | <td><a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">{node|short}</a></td></tr> |
|
26 | 26 | {parent%filerevparent} |
|
27 | 27 | {child%filerevchild} |
|
28 | 28 | <tr> |
|
29 | 29 | <td class="metatag">author:</td> |
|
30 | 30 | <td>{author|obfuscate}</td></tr> |
|
31 | 31 | <tr> |
|
32 | 32 | <td class="metatag">date:</td> |
|
33 | 33 | <td class="date age">{date|rfc822date}</td></tr> |
|
34 | 34 | <tr> |
|
35 | 35 | <td class="metatag">permissions:</td> |
|
36 | 36 | <td>{permissions|permissions}</td></tr> |
|
37 | 37 | <tr> |
|
38 | 38 | <td class="metatag">description:</td> |
|
39 | <td>{desc|strip|escape|addbreaks|nonempty}</td> | |
|
39 | <td>{desc|strip|escape|websub|addbreaks|nonempty}</td> | |
|
40 | 40 | </tr> |
|
41 | 41 | </table> |
|
42 | 42 | |
|
43 | 43 | <pre> |
|
44 | 44 | {text%fileline} |
|
45 | 45 | </pre> |
|
46 | 46 | |
|
47 | 47 | {footer} |
@@ -1,256 +1,260 b'' | |||
|
1 | 1 | $ "$TESTDIR/hghave" symlink || exit 80 |
|
2 | 2 | |
|
3 | 3 | == tests added in 0.7 == |
|
4 | 4 | |
|
5 | 5 | $ hg init test-symlinks-0.7; cd test-symlinks-0.7; |
|
6 | 6 | $ touch foo; ln -s foo bar; |
|
7 | 7 | |
|
8 | 8 | import with addremove -- symlink walking should _not_ screwup. |
|
9 | 9 | |
|
10 | 10 | $ hg addremove |
|
11 | 11 | adding bar |
|
12 | 12 | adding foo |
|
13 | 13 | |
|
14 | 14 | commit -- the symlink should _not_ appear added to dir state |
|
15 | 15 | |
|
16 | 16 | $ hg commit -m 'initial' |
|
17 | 17 | |
|
18 | 18 | $ touch bomb |
|
19 | 19 | |
|
20 | 20 | again, symlink should _not_ show up on dir state |
|
21 | 21 | |
|
22 | 22 | $ hg addremove |
|
23 | 23 | adding bomb |
|
24 | 24 | |
|
25 | 25 | Assert screamed here before, should go by without consequence |
|
26 | 26 | |
|
27 | 27 | $ hg commit -m 'is there a bug?' |
|
28 | 28 | $ cd .. |
|
29 | 29 | |
|
30 | 30 | |
|
31 | 31 | == fifo & ignore == |
|
32 | 32 | |
|
33 | 33 | $ hg init test; cd test; |
|
34 | 34 | |
|
35 | 35 | $ mkdir dir |
|
36 | 36 | $ touch a.c dir/a.o dir/b.o |
|
37 | 37 | |
|
38 | 38 | test what happens if we want to trick hg |
|
39 | 39 | |
|
40 | 40 | $ hg commit -A -m 0 |
|
41 | 41 | adding a.c |
|
42 | 42 | adding dir/a.o |
|
43 | 43 | adding dir/b.o |
|
44 | 44 | $ echo "relglob:*.o" > .hgignore |
|
45 | 45 | $ rm a.c |
|
46 | 46 | $ rm dir/a.o |
|
47 | 47 | $ rm dir/b.o |
|
48 | 48 | $ mkdir dir/a.o |
|
49 | 49 | $ ln -s nonexistent dir/b.o |
|
50 | 50 | $ mkfifo a.c |
|
51 | 51 | |
|
52 | 52 | it should show a.c, dir/a.o and dir/b.o deleted |
|
53 | 53 | |
|
54 | 54 | $ hg status |
|
55 | 55 | M dir/b.o |
|
56 | 56 | ! a.c |
|
57 | 57 | ! dir/a.o |
|
58 | 58 | ? .hgignore |
|
59 | 59 | $ hg status a.c |
|
60 | 60 | a.c: unsupported file type (type is fifo) |
|
61 | 61 | ! a.c |
|
62 | 62 | $ cd .. |
|
63 | 63 | |
|
64 | 64 | |
|
65 | 65 | == symlinks from outside the tree == |
|
66 | 66 | |
|
67 | 67 | test absolute path through symlink outside repo |
|
68 | 68 | |
|
69 | 69 | $ p=`pwd` |
|
70 | 70 | $ hg init x |
|
71 | 71 | $ ln -s x y |
|
72 | 72 | $ cd x |
|
73 | 73 | $ touch f |
|
74 | 74 | $ hg add f |
|
75 | 75 | $ hg status "$p"/y/f |
|
76 | 76 | A f |
|
77 | 77 | |
|
78 | 78 | try symlink outside repo to file inside |
|
79 | 79 | |
|
80 | 80 | $ ln -s x/f ../z |
|
81 | 81 | |
|
82 | 82 | this should fail |
|
83 | 83 | |
|
84 | 84 | $ hg status ../z && { echo hg mistakenly exited with status 0; exit 1; } || : |
|
85 | 85 | abort: ../z not under root '$TESTTMP/x' |
|
86 | 86 | $ cd .. |
|
87 | 87 | |
|
88 | 88 | |
|
89 | 89 | == cloning symlinks == |
|
90 | 90 | $ hg init clone; cd clone; |
|
91 | 91 | |
|
92 | 92 | try cloning symlink in a subdir |
|
93 | 93 | 1. commit a symlink |
|
94 | 94 | |
|
95 | 95 | $ mkdir -p a/b/c |
|
96 | 96 | $ cd a/b/c |
|
97 | 97 | $ ln -s /path/to/symlink/source demo |
|
98 | 98 | $ cd ../../.. |
|
99 | 99 | $ hg stat |
|
100 | 100 | ? a/b/c/demo |
|
101 | 101 | $ hg commit -A -m 'add symlink in a/b/c subdir' |
|
102 | 102 | adding a/b/c/demo |
|
103 | 103 | |
|
104 | 104 | 2. clone it |
|
105 | 105 | |
|
106 | 106 | $ cd .. |
|
107 | 107 | $ hg clone clone clonedest |
|
108 | 108 | updating to branch default |
|
109 | 109 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
110 | 110 | |
|
111 | 111 | |
|
112 | 112 | == symlink and git diffs == |
|
113 | 113 | |
|
114 | 114 | git symlink diff |
|
115 | 115 | |
|
116 | 116 | $ cd clonedest |
|
117 | 117 | $ hg diff --git -r null:tip |
|
118 | 118 | diff --git a/a/b/c/demo b/a/b/c/demo |
|
119 | 119 | new file mode 120000 |
|
120 | 120 | --- /dev/null |
|
121 | 121 | +++ b/a/b/c/demo |
|
122 | 122 | @@ -0,0 +1,1 @@ |
|
123 | 123 | +/path/to/symlink/source |
|
124 | 124 | \ No newline at end of file |
|
125 | 125 | $ hg export --git tip > ../sl.diff |
|
126 | 126 | |
|
127 | 127 | import git symlink diff |
|
128 | 128 | |
|
129 | 129 | $ hg rm a/b/c/demo |
|
130 | 130 | $ hg commit -m'remove link' |
|
131 | 131 | $ hg import ../sl.diff |
|
132 | 132 | applying ../sl.diff |
|
133 | 133 | $ hg diff --git -r 1:tip |
|
134 | 134 | diff --git a/a/b/c/demo b/a/b/c/demo |
|
135 | 135 | new file mode 120000 |
|
136 | 136 | --- /dev/null |
|
137 | 137 | +++ b/a/b/c/demo |
|
138 | 138 | @@ -0,0 +1,1 @@ |
|
139 | 139 | +/path/to/symlink/source |
|
140 | 140 | \ No newline at end of file |
|
141 | 141 | |
|
142 | 142 | == symlinks and addremove == |
|
143 | 143 | |
|
144 | 144 | directory moved and symlinked |
|
145 | 145 | |
|
146 | 146 | $ mkdir foo |
|
147 | 147 | $ touch foo/a |
|
148 | 148 | $ hg ci -Ama |
|
149 | 149 | adding foo/a |
|
150 | 150 | $ mv foo bar |
|
151 | 151 | $ ln -s bar foo |
|
152 | $ hg status | |
|
153 | ! foo/a | |
|
154 | ? bar/a | |
|
155 | ? foo | |
|
152 | 156 | |
|
153 | 157 |
|
|
154 | 158 | |
|
155 | 159 | $ hg addremove |
|
156 | 160 | adding bar/a |
|
157 | 161 | adding foo |
|
158 | 162 | removing foo/a |
|
159 | 163 | $ cd .. |
|
160 | 164 | |
|
161 | 165 | == root of repository is symlinked == |
|
162 | 166 | |
|
163 | 167 | $ hg init root |
|
164 | 168 | $ ln -s root link |
|
165 | 169 | $ cd root |
|
166 | 170 | $ echo foo > foo |
|
167 | 171 | $ hg status |
|
168 | 172 | ? foo |
|
169 | 173 | $ hg status ../link |
|
170 | 174 | ? foo |
|
171 | 175 | $ hg add foo |
|
172 | 176 | $ hg cp foo "$TESTTMP/link/bar" |
|
173 | 177 | foo has not been committed yet, so no copy data will be stored for bar. |
|
174 | 178 | $ cd .. |
|
175 | 179 | |
|
176 | 180 | |
|
177 | 181 | $ hg init b |
|
178 | 182 | $ cd b |
|
179 | 183 | $ ln -s nothing dangling |
|
180 | 184 | $ hg commit -m 'commit symlink without adding' dangling |
|
181 | 185 | abort: dangling: file not tracked! |
|
182 | 186 | [255] |
|
183 | 187 | $ hg add dangling |
|
184 | 188 | $ hg commit -m 'add symlink' |
|
185 | 189 | |
|
186 | 190 | $ hg tip -v |
|
187 | 191 | changeset: 0:cabd88b706fc |
|
188 | 192 | tag: tip |
|
189 | 193 | user: test |
|
190 | 194 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
191 | 195 | files: dangling |
|
192 | 196 | description: |
|
193 | 197 | add symlink |
|
194 | 198 | |
|
195 | 199 | |
|
196 | 200 | $ hg manifest --debug |
|
197 | 201 | 2564acbe54bbbedfbf608479340b359f04597f80 644 @ dangling |
|
198 | 202 | $ "$TESTDIR/readlink.py" dangling |
|
199 | 203 | dangling -> nothing |
|
200 | 204 | |
|
201 | 205 | $ rm dangling |
|
202 | 206 | $ ln -s void dangling |
|
203 | 207 | $ hg commit -m 'change symlink' |
|
204 | 208 | $ "$TESTDIR/readlink.py" dangling |
|
205 | 209 | dangling -> void |
|
206 | 210 | |
|
207 | 211 | |
|
208 | 212 | modifying link |
|
209 | 213 | |
|
210 | 214 | $ rm dangling |
|
211 | 215 | $ ln -s empty dangling |
|
212 | 216 | $ "$TESTDIR/readlink.py" dangling |
|
213 | 217 | dangling -> empty |
|
214 | 218 | |
|
215 | 219 | |
|
216 | 220 | reverting to rev 0: |
|
217 | 221 | |
|
218 | 222 | $ hg revert -r 0 -a |
|
219 | 223 | reverting dangling |
|
220 | 224 | $ "$TESTDIR/readlink.py" dangling |
|
221 | 225 | dangling -> nothing |
|
222 | 226 | |
|
223 | 227 | |
|
224 | 228 | backups: |
|
225 | 229 | |
|
226 | 230 | $ "$TESTDIR/readlink.py" *.orig |
|
227 | 231 | dangling.orig -> empty |
|
228 | 232 | $ rm *.orig |
|
229 | 233 | $ hg up -C |
|
230 | 234 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
231 | 235 | |
|
232 | 236 | copies |
|
233 | 237 | |
|
234 | 238 | $ hg cp -v dangling dangling2 |
|
235 | 239 | copying dangling to dangling2 |
|
236 | 240 | $ hg st -Cmard |
|
237 | 241 | A dangling2 |
|
238 | 242 | dangling |
|
239 | 243 | $ "$TESTDIR/readlink.py" dangling dangling2 |
|
240 | 244 | dangling -> void |
|
241 | 245 | dangling2 -> void |
|
242 | 246 | |
|
243 | 247 | |
|
244 | 248 | Issue995: hg copy -A incorrectly handles symbolic links |
|
245 | 249 | |
|
246 | 250 | $ hg up -C |
|
247 | 251 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
248 | 252 | $ mkdir dir |
|
249 | 253 | $ ln -s dir dirlink |
|
250 | 254 | $ hg ci -qAm 'add dirlink' |
|
251 | 255 | $ mkdir newdir |
|
252 | 256 | $ mv dir newdir/dir |
|
253 | 257 | $ mv dirlink newdir/dirlink |
|
254 | 258 | $ hg mv -A dirlink newdir/dirlink |
|
255 | 259 | |
|
256 | 260 | $ cd .. |
@@ -1,33 +1,36 b'' | |||
|
1 | 1 | $ "$TESTDIR/hghave" serve || exit 80 |
|
2 | 2 | |
|
3 | 3 | $ hg init test |
|
4 | 4 | $ cd test |
|
5 | 5 | |
|
6 | 6 | $ cat > .hg/hgrc <<EOF |
|
7 | 7 | > [extensions] |
|
8 | > # this is only necessary to check that the mapping from | |
|
9 | > # interhg to websub works | |
|
8 | 10 | > interhg = |
|
9 | 11 | > |
|
12 | > [websub] | |
|
13 | > issues = s|Issue(\d+)|<a href="http://bts.example.org/issue\1">Issue\1</a>| | |
|
14 | > | |
|
10 | 15 | > [interhg] |
|
11 | > issues = s|Issue(\d+)|<a href="http://bts.example.org/issue\1">Issue\1</a>| | |
|
12 | > | |
|
16 | > # check that we maintain some interhg backwards compatibility... | |
|
13 | 17 |
> # |
|
14 | 18 | > markbugs = sxbugx<i class="\x">bug</i>x |
|
15 | 19 | > EOF |
|
16 | 20 | |
|
17 | 21 | $ touch foo |
|
18 | 22 | $ hg add foo |
|
19 | 23 | $ hg commit -d '1 0' -m 'Issue123: fixed the bug!' |
|
20 | 24 | |
|
21 | 25 | $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log |
|
22 | 26 | $ cat hg.pid >> $DAEMON_PIDS |
|
23 | 27 | |
|
24 | 28 | log |
|
25 | 29 | |
|
26 |
$ "$TESTDIR/get-with-headers.py" localhost:$HGPORT |
|
|
27 |
|
|
|
28 | ||
|
30 | $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT "rev/tip" | grep bts | |
|
31 | <div class="description"><a href="http://bts.example.org/issue123">Issue123</a>: fixed the <i class="x">bug</i>!</div> | |
|
29 | 32 | errors |
|
30 | 33 | |
|
31 | 34 | $ cat errors.log |
|
32 | 35 | |
|
33 | 36 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now