Show More
@@ -29,20 +29,20 b' def relpath(repo, args):' | |||||
29 | return [util.normpath(os.path.join(cwd, x)) for x in args] |
|
29 | return [util.normpath(os.path.join(cwd, x)) for x in args] | |
30 | return args |
|
30 | return args | |
31 |
|
31 | |||
32 |
def matchpats(repo, cwd, pats |
|
32 | def matchpats(repo, cwd, pats=[], opts={}, head=''): | |
33 | return util.matcher(repo, cwd, pats or ['.'], opts.get('include'), |
|
33 | return util.matcher(repo, cwd, pats or ['.'], opts.get('include'), | |
34 | opts.get('exclude'), head) |
|
34 | opts.get('exclude'), head) | |
35 |
|
35 | |||
36 |
def makewalk(repo, pats, opts, head |
|
36 | def makewalk(repo, pats, opts, head=''): | |
37 | cwd = repo.getcwd() |
|
37 | cwd = repo.getcwd() | |
38 | files, matchfn, anypats = matchpats(repo, cwd, pats, opts, head) |
|
38 | files, matchfn, anypats = matchpats(repo, cwd, pats, opts, head) | |
39 | exact = dict(zip(files, files)) |
|
39 | exact = dict(zip(files, files)) | |
40 | def walk(): |
|
40 | def walk(): | |
41 |
for src, fn in repo.walk(files |
|
41 | for src, fn in repo.walk(files=files, match=matchfn): | |
42 | yield src, fn, util.pathto(cwd, fn), fn in exact |
|
42 | yield src, fn, util.pathto(cwd, fn), fn in exact | |
43 | return files, matchfn, walk() |
|
43 | return files, matchfn, walk() | |
44 |
|
44 | |||
45 |
def walk(repo, pats, opts, head |
|
45 | def walk(repo, pats, opts, head=''): | |
46 | files, matchfn, results = makewalk(repo, pats, opts, head) |
|
46 | files, matchfn, results = makewalk(repo, pats, opts, head) | |
47 | for r in results: yield r |
|
47 | for r in results: yield r | |
48 |
|
48 | |||
@@ -220,7 +220,7 b' def dodiff(fp, ui, repo, node1, node2, f' | |||||
220 | return time.asctime(time.gmtime(float(c[2].split(' ')[0]))) |
|
220 | return time.asctime(time.gmtime(float(c[2].split(' ')[0]))) | |
221 |
|
221 | |||
222 | if not changes: |
|
222 | if not changes: | |
223 |
(c, a, d, u) = repo.changes(node1, node2, files, match |
|
223 | (c, a, d, u) = repo.changes(node1, node2, files, match=match) | |
224 | else: |
|
224 | else: | |
225 | (c, a, d, u) = changes |
|
225 | (c, a, d, u) = changes | |
226 | if files: |
|
226 | if files: | |
@@ -626,7 +626,7 b' def commit(ui, repo, *pats, **opts):' | |||||
626 | fns, match, anypats = matchpats(repo, (pats and repo.getcwd()) or '', |
|
626 | fns, match, anypats = matchpats(repo, (pats and repo.getcwd()) or '', | |
627 | pats, opts) |
|
627 | pats, opts) | |
628 | if pats: |
|
628 | if pats: | |
629 |
c, a, d, u = repo.changes(files |
|
629 | c, a, d, u = repo.changes(files=fns, match=match) | |
630 | files = c + a + [fn for fn in d if repo.dirstate.state(fn) == 'r'] |
|
630 | files = c + a + [fn for fn in d if repo.dirstate.state(fn) == 'r'] | |
631 | else: |
|
631 | else: | |
632 | files = [] |
|
632 | files = [] | |
@@ -793,7 +793,7 b' def forget(ui, repo, *pats, **opts):' | |||||
793 | if not exact: ui.status('forgetting ', rel, '\n') |
|
793 | if not exact: ui.status('forgetting ', rel, '\n') | |
794 | repo.forget(forget) |
|
794 | repo.forget(forget) | |
795 |
|
795 | |||
796 |
def grep(ui, repo, pattern |
|
796 | def grep(ui, repo, pattern=None, *pats, **opts): | |
797 | """search for a pattern in specified files and revisions""" |
|
797 | """search for a pattern in specified files and revisions""" | |
798 | if pattern is None: pattern = opts['regexp'] |
|
798 | if pattern is None: pattern = opts['regexp'] | |
799 | if not pattern: raise util.Abort('no pattern to search for') |
|
799 | if not pattern: raise util.Abort('no pattern to search for') | |
@@ -1089,7 +1089,7 b' def parents(ui, repo, rev=None):' | |||||
1089 | if n != hg.nullid: |
|
1089 | if n != hg.nullid: | |
1090 | show_changeset(ui, repo, changenode=n) |
|
1090 | show_changeset(ui, repo, changenode=n) | |
1091 |
|
1091 | |||
1092 |
def paths(ui, search |
|
1092 | def paths(ui, search=None): | |
1093 | """show definition of symbolic path names""" |
|
1093 | """show definition of symbolic path names""" | |
1094 | try: |
|
1094 | try: | |
1095 | repo = hg.repository(ui=ui) |
|
1095 | repo = hg.repository(ui=ui) |
@@ -360,7 +360,7 b' class dirstate:' | |||||
360 | if not self.dirty: |
|
360 | if not self.dirty: | |
361 | self.dirty = 1 |
|
361 | self.dirty = 1 | |
362 |
|
362 | |||
363 |
def setparents(self, p1, p2 |
|
363 | def setparents(self, p1, p2=nullid): | |
364 | self.markdirty() |
|
364 | self.markdirty() | |
365 | self.pl = p1, p2 |
|
365 | self.pl = p1, p2 | |
366 |
|
366 | |||
@@ -480,7 +480,7 b' class dirstate:' | |||||
480 | bs += 1 |
|
480 | bs += 1 | |
481 | return ret |
|
481 | return ret | |
482 |
|
482 | |||
483 |
def walk(self, files |
|
483 | def walk(self, files=None, match=util.always, dc=None): | |
484 | self.read() |
|
484 | self.read() | |
485 |
|
485 | |||
486 | # walk all files by default |
|
486 | # walk all files by default | |
@@ -816,7 +816,7 b' class localrepository:' | |||||
816 | else: |
|
816 | else: | |
817 | self.ui.warn("no undo information available\n") |
|
817 | self.ui.warn("no undo information available\n") | |
818 |
|
818 | |||
819 |
def lock(self, wait |
|
819 | def lock(self, wait=1): | |
820 | try: |
|
820 | try: | |
821 | return lock.lock(self.join("lock"), 0) |
|
821 | return lock.lock(self.join("lock"), 0) | |
822 | except lock.LockHeld, inst: |
|
822 | except lock.LockHeld, inst: | |
@@ -911,7 +911,7 b' class localrepository:' | |||||
911 | else: |
|
911 | else: | |
912 | self.ui.warn("%s not tracked!\n" % f) |
|
912 | self.ui.warn("%s not tracked!\n" % f) | |
913 | else: |
|
913 | else: | |
914 |
(c, a, d, u) = self.changes(match |
|
914 | (c, a, d, u) = self.changes(match=match) | |
915 | commit = c + a |
|
915 | commit = c + a | |
916 | remove = d |
|
916 | remove = d | |
917 |
|
917 | |||
@@ -1018,7 +1018,7 b' class localrepository:' | |||||
1018 | return None |
|
1018 | return None | |
1019 | return n |
|
1019 | return n | |
1020 |
|
1020 | |||
1021 |
def walk(self, node |
|
1021 | def walk(self, node=None, files=[], match=util.always): | |
1022 | if node: |
|
1022 | if node: | |
1023 | for fn in self.manifest.read(self.changelog.read(node)[0]): |
|
1023 | for fn in self.manifest.read(self.changelog.read(node)[0]): | |
1024 | if match(fn): yield 'm', fn |
|
1024 | if match(fn): yield 'm', fn |
@@ -65,7 +65,7 b' def write(*things):' | |||||
65 | sys.stdout.write(str(thing)) |
|
65 | sys.stdout.write(str(thing)) | |
66 |
|
66 | |||
67 | class templater: |
|
67 | class templater: | |
68 |
def __init__(self, mapfile, filters |
|
68 | def __init__(self, mapfile, filters={}, defaults={}): | |
69 | self.cache = {} |
|
69 | self.cache = {} | |
70 | self.map = {} |
|
70 | self.map = {} | |
71 | self.base = os.path.dirname(mapfile) |
|
71 | self.base = os.path.dirname(mapfile) | |
@@ -92,7 +92,7 b' class templater:' | |||||
92 | tmpl = self.cache[t] = file(self.map[t]).read() |
|
92 | tmpl = self.cache[t] = file(self.map[t]).read() | |
93 | return self.template(tmpl, self.filters, **m) |
|
93 | return self.template(tmpl, self.filters, **m) | |
94 |
|
94 | |||
95 |
def template(self, tmpl, filters |
|
95 | def template(self, tmpl, filters={}, **map): | |
96 | while tmpl: |
|
96 | while tmpl: | |
97 | m = re.search(r"#([a-zA-Z0-9]+)((%[a-zA-Z0-9]+)*)((\|[a-zA-Z0-9]+)*)#", tmpl) |
|
97 | m = re.search(r"#([a-zA-Z0-9]+)((%[a-zA-Z0-9]+)*)((\|[a-zA-Z0-9]+)*)#", tmpl) | |
98 | if m: |
|
98 | if m: | |
@@ -162,13 +162,13 b' class hgweb:' | |||||
162 |
|
162 | |||
163 | def listfiles(self, files, mf): |
|
163 | def listfiles(self, files, mf): | |
164 | for f in files[:self.maxfiles]: |
|
164 | for f in files[:self.maxfiles]: | |
165 |
yield self.t("filenodelink", node |
|
165 | yield self.t("filenodelink", node=hex(mf[f]), file=f) | |
166 | if len(files) > self.maxfiles: |
|
166 | if len(files) > self.maxfiles: | |
167 | yield self.t("fileellipses") |
|
167 | yield self.t("fileellipses") | |
168 |
|
168 | |||
169 | def listfilediffs(self, files, changeset): |
|
169 | def listfilediffs(self, files, changeset): | |
170 | for f in files[:self.maxfiles]: |
|
170 | for f in files[:self.maxfiles]: | |
171 |
yield self.t("filedifflink", node |
|
171 | yield self.t("filedifflink", node=hex(changeset), file=f) | |
172 | if len(files) > self.maxfiles: |
|
172 | if len(files) > self.maxfiles: | |
173 | yield self.t("fileellipses") |
|
173 | yield self.t("fileellipses") | |
174 |
|
174 | |||
@@ -176,11 +176,11 b' class hgweb:' | |||||
176 | if not rev: rev = lambda x: "" |
|
176 | if not rev: rev = lambda x: "" | |
177 | for node in nodes: |
|
177 | for node in nodes: | |
178 | if node != nullid: |
|
178 | if node != nullid: | |
179 |
yield self.t(t1, node |
|
179 | yield self.t(t1, node=hex(node), rev=rev(node), **args) | |
180 |
|
180 | |||
181 | def showtag(self, t1, node=nullid, **args): |
|
181 | def showtag(self, t1, node=nullid, **args): | |
182 | for t in self.repo.nodetags(node): |
|
182 | for t in self.repo.nodetags(node): | |
183 |
yield self.t(t1, tag |
|
183 | yield self.t(t1, tag=t, **args) | |
184 |
|
184 | |||
185 | def diff(self, node1, node2, files): |
|
185 | def diff(self, node1, node2, files): | |
186 | def filterfiles(list, files): |
|
186 | def filterfiles(list, files): | |
@@ -203,13 +203,13 b' class hgweb:' | |||||
203 | def prettyprintlines(diff): |
|
203 | def prettyprintlines(diff): | |
204 | for l in diff.splitlines(1): |
|
204 | for l in diff.splitlines(1): | |
205 | if l.startswith('+'): |
|
205 | if l.startswith('+'): | |
206 |
yield self.t("difflineplus", line |
|
206 | yield self.t("difflineplus", line=l) | |
207 | elif l.startswith('-'): |
|
207 | elif l.startswith('-'): | |
208 |
yield self.t("difflineminus", line |
|
208 | yield self.t("difflineminus", line=l) | |
209 | elif l.startswith('@'): |
|
209 | elif l.startswith('@'): | |
210 |
yield self.t("difflineat", line |
|
210 | yield self.t("difflineat", line=l) | |
211 | else: |
|
211 | else: | |
212 |
yield self.t("diffline", line |
|
212 | yield self.t("diffline", line=l) | |
213 |
|
213 | |||
214 | r = self.repo |
|
214 | r = self.repo | |
215 | cl = r.changelog |
|
215 | cl = r.changelog | |
@@ -240,7 +240,7 b' class hgweb:' | |||||
240 |
|
240 | |||
241 | def changelog(self, pos): |
|
241 | def changelog(self, pos): | |
242 | def changenav(**map): |
|
242 | def changenav(**map): | |
243 |
def seq(factor |
|
243 | def seq(factor=1): | |
244 | yield 1 * factor |
|
244 | yield 1 * factor | |
245 | yield 3 * factor |
|
245 | yield 3 * factor | |
246 | #yield 5 * factor |
|
246 | #yield 5 * factor | |
@@ -296,9 +296,9 b' class hgweb:' | |||||
296 | pos = end - 1 |
|
296 | pos = end - 1 | |
297 |
|
297 | |||
298 | yield self.t('changelog', |
|
298 | yield self.t('changelog', | |
299 |
changenav |
|
299 | changenav=changenav, | |
300 |
manifest |
|
300 | manifest=hex(mf), | |
301 |
rev |
|
301 | rev=pos, changesets=count, entries=changelist) | |
302 |
|
302 | |||
303 | def search(self, query): |
|
303 | def search(self, query): | |
304 |
|
304 | |||
@@ -334,17 +334,17 b' class hgweb:' | |||||
334 |
|
334 | |||
335 | yield self.t( |
|
335 | yield self.t( | |
336 | 'searchentry', |
|
336 | 'searchentry', | |
337 |
parity |
|
337 | parity=count & 1, | |
338 |
author |
|
338 | author=changes[1], | |
339 |
parent |
|
339 | parent=self.parents("changelogparent", | |
340 | cl.parents(n), cl.rev), |
|
340 | cl.parents(n), cl.rev), | |
341 |
changelogtag |
|
341 | changelogtag=self.showtag("changelogtag",n), | |
342 |
manifest |
|
342 | manifest=hex(changes[0]), | |
343 |
desc |
|
343 | desc=changes[4], | |
344 |
date |
|
344 | date=t, | |
345 |
files |
|
345 | files=self.listfilediffs(changes[3], n), | |
346 |
rev |
|
346 | rev=i, | |
347 |
node |
|
347 | node=hn) | |
348 |
|
348 | |||
349 | if count >= self.maxchanges: break |
|
349 | if count >= self.maxchanges: break | |
350 |
|
350 | |||
@@ -352,9 +352,9 b' class hgweb:' | |||||
352 | mf = cl.read(cl.tip())[0] |
|
352 | mf = cl.read(cl.tip())[0] | |
353 |
|
353 | |||
354 | yield self.t('search', |
|
354 | yield self.t('search', | |
355 |
query |
|
355 | query=query, | |
356 |
manifest |
|
356 | manifest=hex(mf), | |
357 |
entries |
|
357 | entries=changelist) | |
358 |
|
358 | |||
359 | def changeset(self, nodeid): |
|
359 | def changeset(self, nodeid): | |
360 | n = bin(nodeid) |
|
360 | n = bin(nodeid) | |
@@ -367,23 +367,23 b' class hgweb:' | |||||
367 | mf = self.repo.manifest.read(changes[0]) |
|
367 | mf = self.repo.manifest.read(changes[0]) | |
368 | for f in changes[3]: |
|
368 | for f in changes[3]: | |
369 | files.append(self.t("filenodelink", |
|
369 | files.append(self.t("filenodelink", | |
370 |
filenode = hex(mf.get(f, nullid)), file |
|
370 | filenode = hex(mf.get(f, nullid)), file=f)) | |
371 |
|
371 | |||
372 | def diff(**map): |
|
372 | def diff(**map): | |
373 | yield self.diff(p1, n, None) |
|
373 | yield self.diff(p1, n, None) | |
374 |
|
374 | |||
375 | yield self.t('changeset', |
|
375 | yield self.t('changeset', | |
376 |
diff |
|
376 | diff=diff, | |
377 |
rev |
|
377 | rev=cl.rev(n), | |
378 |
node |
|
378 | node=nodeid, | |
379 |
parent |
|
379 | parent=self.parents("changesetparent", | |
380 | cl.parents(n), cl.rev), |
|
380 | cl.parents(n), cl.rev), | |
381 |
changesettag |
|
381 | changesettag=self.showtag("changesettag",n), | |
382 |
manifest |
|
382 | manifest=hex(changes[0]), | |
383 |
author |
|
383 | author=changes[1], | |
384 |
desc |
|
384 | desc=changes[4], | |
385 |
date |
|
385 | date=t, | |
386 |
files |
|
386 | files=files) | |
387 |
|
387 | |||
388 | def filelog(self, f, filenode): |
|
388 | def filelog(self, f, filenode): | |
389 | cl = self.repo.changelog |
|
389 | cl = self.repo.changelog | |
@@ -417,9 +417,9 b' class hgweb:' | |||||
417 | for e in l: yield e |
|
417 | for e in l: yield e | |
418 |
|
418 | |||
419 | yield self.t("filelog", |
|
419 | yield self.t("filelog", | |
420 |
file |
|
420 | file=f, | |
421 |
filenode |
|
421 | filenode=filenode, | |
422 |
entries |
|
422 | entries=entries) | |
423 |
|
423 | |||
424 | def filerevision(self, f, node): |
|
424 | def filerevision(self, f, node): | |
425 | fl = self.repo.file(f) |
|
425 | fl = self.repo.file(f) | |
@@ -438,18 +438,18 b' class hgweb:' | |||||
438 | "linenumber": "% 6d" % (l + 1), |
|
438 | "linenumber": "% 6d" % (l + 1), | |
439 | "parity": l & 1} |
|
439 | "parity": l & 1} | |
440 |
|
440 | |||
441 |
yield self.t("filerevision", file |
|
441 | yield self.t("filerevision", file=f, | |
442 |
filenode |
|
442 | filenode=node, | |
443 |
path |
|
443 | path=up(f), | |
444 |
text |
|
444 | text=lines(), | |
445 |
rev |
|
445 | rev=changerev, | |
446 |
node |
|
446 | node=hex(cn), | |
447 |
manifest |
|
447 | manifest=hex(mfn), | |
448 |
author |
|
448 | author=cs[1], | |
449 |
date |
|
449 | date=t, | |
450 |
parent |
|
450 | parent=self.parents("filerevparent", | |
451 | fl.parents(n), fl.rev, file=f), |
|
451 | fl.parents(n), fl.rev, file=f), | |
452 |
permissions |
|
452 | permissions=self.repo.manifest.readflags(mfn)[f]) | |
453 |
|
453 | |||
454 | def fileannotate(self, f, node): |
|
454 | def fileannotate(self, f, node): | |
455 | bcache = {} |
|
455 | bcache = {} | |
@@ -566,13 +566,13 b' class hgweb:' | |||||
566 | parity = 1 - parity |
|
566 | parity = 1 - parity | |
567 |
|
567 | |||
568 | yield self.t("manifest", |
|
568 | yield self.t("manifest", | |
569 |
manifest |
|
569 | manifest=mnode, | |
570 |
rev |
|
570 | rev=rev, | |
571 |
node |
|
571 | node=hex(node), | |
572 |
path |
|
572 | path=path, | |
573 |
up |
|
573 | up=up(path), | |
574 |
fentries |
|
574 | fentries=filelist, | |
575 |
dentries |
|
575 | dentries=dirlist) | |
576 |
|
576 | |||
577 | def tags(self): |
|
577 | def tags(self): | |
578 | cl = self.repo.changelog |
|
578 | cl = self.repo.changelog | |
@@ -590,8 +590,8 b' class hgweb:' | |||||
590 | parity = 1 - parity |
|
590 | parity = 1 - parity | |
591 |
|
591 | |||
592 | yield self.t("tags", |
|
592 | yield self.t("tags", | |
593 |
manifest |
|
593 | manifest=hex(mf), | |
594 |
entries |
|
594 | entries=entries) | |
595 |
|
595 | |||
596 | def filediff(self, file, changeset): |
|
596 | def filediff(self, file, changeset): | |
597 | n = bin(changeset) |
|
597 | n = bin(changeset) | |
@@ -604,13 +604,13 b' class hgweb:' | |||||
604 | yield self.diff(p1, n, file) |
|
604 | yield self.diff(p1, n, file) | |
605 |
|
605 | |||
606 | yield self.t("filediff", |
|
606 | yield self.t("filediff", | |
607 |
file |
|
607 | file=file, | |
608 |
filenode |
|
608 | filenode=hex(mf.get(file, nullid)), | |
609 |
node |
|
609 | node=changeset, | |
610 |
rev |
|
610 | rev=self.repo.changelog.rev(n), | |
611 |
parent |
|
611 | parent=self.parents("filediffparent", | |
612 | cl.parents(n), cl.rev), |
|
612 | cl.parents(n), cl.rev), | |
613 |
diff |
|
613 | diff=diff) | |
614 |
|
614 | |||
615 | # add tags to things |
|
615 | # add tags to things | |
616 | # tags -> list of changesets corresponding to tags |
|
616 | # tags -> list of changesets corresponding to tags | |
@@ -643,10 +643,10 b' class hgweb:' | |||||
643 | url = "http://%s%s%s" % (os.environ["SERVER_NAME"], port, uri) |
|
643 | url = "http://%s%s%s" % (os.environ["SERVER_NAME"], port, uri) | |
644 |
|
644 | |||
645 | self.t = templater(m, common_filters, |
|
645 | self.t = templater(m, common_filters, | |
646 | {"url":url, |
|
646 | {"url": url, | |
647 | "repo":self.reponame, |
|
647 | "repo": self.reponame, | |
648 | "header":header, |
|
648 | "header": header, | |
649 | "footer":footer, |
|
649 | "footer": footer, | |
650 | }) |
|
650 | }) | |
651 |
|
651 | |||
652 | if not args.has_key('cmd'): |
|
652 | if not args.has_key('cmd'): | |
@@ -827,8 +827,8 b' def create_server(repo):' | |||||
827 | else: |
|
827 | else: | |
828 | return BaseHTTPServer.HTTPServer((address, port), hgwebhandler) |
|
828 | return BaseHTTPServer.HTTPServer((address, port), hgwebhandler) | |
829 |
|
829 | |||
830 |
def server(path, name, templates, address, port, use_ipv6 |
|
830 | def server(path, name, templates, address, port, use_ipv6=False, | |
831 |
accesslog |
|
831 | accesslog=sys.stdout, errorlog=sys.stderr): | |
832 | httpd = create_server(path, name, templates, address, port, use_ipv6, |
|
832 | httpd = create_server(path, name, templates, address, port, use_ipv6, | |
833 | accesslog, errorlog) |
|
833 | accesslog, errorlog) | |
834 | httpd.serve_forever() |
|
834 | httpd.serve_forever() | |
@@ -879,14 +879,14 b' class hgwebdir:' | |||||
879 | url = os.environ["REQUEST_URI"] + "/" + v |
|
879 | url = os.environ["REQUEST_URI"] + "/" + v | |
880 | url = url.replace("//", "/") |
|
880 | url = url.replace("//", "/") | |
881 |
|
881 | |||
882 |
yield dict(author |
|
882 | yield dict(author=get("web", "author", "unknown"), | |
883 |
name |
|
883 | name=get("web", "name", v), | |
884 |
url |
|
884 | url=url, | |
885 |
parity |
|
885 | parity=parity, | |
886 |
shortdesc |
|
886 | shortdesc=get("web", "description", "unknown"), | |
887 |
lastupdate |
|
887 | lastupdate=os.stat(os.path.join(r, ".hg", | |
888 | "00changelog.d")).st_mtime) |
|
888 | "00changelog.d")).st_mtime) | |
889 |
|
889 | |||
890 | parity = 1 - parity |
|
890 | parity = 1 - parity | |
891 |
|
891 | |||
892 |
write(tmpl("index", entries |
|
892 | write(tmpl("index", entries=entries)) |
@@ -12,7 +12,7 b' class LockHeld(Exception):' | |||||
12 | pass |
|
12 | pass | |
13 |
|
13 | |||
14 | class lock: |
|
14 | class lock: | |
15 |
def __init__(self, file, wait |
|
15 | def __init__(self, file, wait=1): | |
16 | self.f = file |
|
16 | self.f = file | |
17 | self.held = 0 |
|
17 | self.held = 0 | |
18 | self.wait = wait |
|
18 | self.wait = wait |
@@ -473,7 +473,7 b' class revlog:' | |||||
473 |
|
473 | |||
474 | yield struct.pack(">l", 0) |
|
474 | yield struct.pack(">l", 0) | |
475 |
|
475 | |||
476 |
def addgroup(self, revs, linkmapper, transaction, unique |
|
476 | def addgroup(self, revs, linkmapper, transaction, unique=0): | |
477 | # given a set of deltas, add them to the revision log. the |
|
477 | # given a set of deltas, add them to the revision log. the | |
478 | # first delta is against its parent, which should be in our |
|
478 | # first delta is against its parent, which should be in our | |
479 | # log, the rest are against the previous delta. |
|
479 | # log, the rest are against the previous delta. |
@@ -15,7 +15,7 b' import os' | |||||
15 | import util |
|
15 | import util | |
16 |
|
16 | |||
17 | class transaction: |
|
17 | class transaction: | |
18 |
def __init__(self, report, opener, journal, after |
|
18 | def __init__(self, report, opener, journal, after=None): | |
19 | self.journal = None |
|
19 | self.journal = None | |
20 |
|
20 | |||
21 | # abort here if the journal already exists |
|
21 | # abort here if the journal already exists |
@@ -89,7 +89,7 b' class ui:' | |||||
89 |
|
89 | |||
90 | def readline(self): |
|
90 | def readline(self): | |
91 | return sys.stdin.readline()[:-1] |
|
91 | return sys.stdin.readline()[:-1] | |
92 |
def prompt(self, msg, pat, default |
|
92 | def prompt(self, msg, pat, default="y"): | |
93 | if not self.interactive: return default |
|
93 | if not self.interactive: return default | |
94 | while 1: |
|
94 | while 1: | |
95 | self.write(msg, " ") |
|
95 | self.write(msg, " ") | |
@@ -118,7 +118,7 b' class ui:' | |||||
118 | os.environ.get("EDITOR", "vi")) |
|
118 | os.environ.get("EDITOR", "vi")) | |
119 |
|
119 | |||
120 | os.environ["HGUSER"] = self.username() |
|
120 | os.environ["HGUSER"] = self.username() | |
121 |
util.system("%s %s" % (editor, name), errprefix |
|
121 | util.system("%s %s" % (editor, name), errprefix="edit failed") | |
122 |
|
122 | |||
123 | t = open(name).read() |
|
123 | t = open(name).read() | |
124 | t = re.sub("(?m)^HG:.*\n", "", t) |
|
124 | t = re.sub("(?m)^HG:.*\n", "", t) |
@@ -27,7 +27,7 b' class Abort(Exception):' | |||||
27 | def always(fn): return True |
|
27 | def always(fn): return True | |
28 | def never(fn): return False |
|
28 | def never(fn): return False | |
29 |
|
29 | |||
30 |
def globre(pat, head |
|
30 | def globre(pat, head='^', tail='$'): | |
31 | "convert a glob pattern into a regexp" |
|
31 | "convert a glob pattern into a regexp" | |
32 | i, n = 0, len(pat) |
|
32 | i, n = 0, len(pat) | |
33 | res = '' |
|
33 | res = '' | |
@@ -98,7 +98,7 b' def canonpath(repo, cwd, myname):' | |||||
98 | else: |
|
98 | else: | |
99 | raise Abort('%s not under repository root' % myname) |
|
99 | raise Abort('%s not under repository root' % myname) | |
100 |
|
100 | |||
101 |
def matcher(repo, cwd, names, inc, exc, head |
|
101 | def matcher(repo, cwd, names, inc, exc, head=''): | |
102 | def patkind(name): |
|
102 | def patkind(name): | |
103 | for prefix in 're:', 'glob:', 'path:', 'relpath:': |
|
103 | for prefix in 're:', 'glob:', 'path:', 'relpath:': | |
104 | if name.startswith(prefix): return name.split(':', 1) |
|
104 | if name.startswith(prefix): return name.split(':', 1) |
General Comments 0
You need to be logged in to leave comments.
Login now