Show More
@@ -91,7 +91,7 b' class checker(object):' | |||
|
91 | 91 | |
|
92 | 92 | def check(self, node): |
|
93 | 93 | '''return if access allowed, raise exception if not.''' |
|
94 |
files = self.repo |
|
|
94 | files = self.repo[node].files() | |
|
95 | 95 | if self.deniable: |
|
96 | 96 | for f in files: |
|
97 | 97 | if self.deny(f): |
@@ -300,7 +300,7 b' def hook(ui, repo, hooktype, node=None, ' | |||
|
300 | 300 | hooktype) |
|
301 | 301 | try: |
|
302 | 302 | bz = bugzilla(ui, repo) |
|
303 |
ctx = repo |
|
|
303 | ctx = repo[node] | |
|
304 | 304 | ids = bz.find_bug_ids(ctx) |
|
305 | 305 | if ids: |
|
306 | 306 | for id in ids: |
@@ -25,7 +25,7 b' def children(ui, repo, file_=None, **opt' | |||
|
25 | 25 | if file_: |
|
26 | 26 | ctx = repo.filectx(file_, changeid=rev) |
|
27 | 27 | else: |
|
28 |
ctx = repo |
|
|
28 | ctx = repo[rev] | |
|
29 | 29 | |
|
30 | 30 | displayer = cmdutil.show_changeset(ui, repo, opts) |
|
31 | 31 | for node in [cp.node() for cp in ctx.children()]: |
@@ -157,7 +157,7 b' class mercurial_sink(converter_sink):' | |||
|
157 | 157 | |
|
158 | 158 | def puttags(self, tags): |
|
159 | 159 | try: |
|
160 |
parentctx = self.repo |
|
|
160 | parentctx = self.repo[self.tagsbranch] | |
|
161 | 161 | tagparent = parentctx.node() |
|
162 | 162 | except RepoError, inst: |
|
163 | 163 | parentctx = None |
@@ -212,19 +212,19 b' class mercurial_source(converter_source)' | |||
|
212 | 212 | |
|
213 | 213 | def changectx(self, rev): |
|
214 | 214 | if self.lastrev != rev: |
|
215 |
self.lastctx = self.repo |
|
|
215 | self.lastctx = self.repo[rev] | |
|
216 | 216 | self.lastrev = rev |
|
217 | 217 | return self.lastctx |
|
218 | 218 | |
|
219 | 219 | def getheads(self): |
|
220 | 220 | if self.rev: |
|
221 |
return [hex(self.repo |
|
|
221 | return [hex(self.repo[self.rev].node())] | |
|
222 | 222 | else: |
|
223 | 223 | return [hex(node) for node in self.repo.heads()] |
|
224 | 224 | |
|
225 | 225 | def getfile(self, name, rev): |
|
226 | 226 | try: |
|
227 |
return self.changectx(rev) |
|
|
227 | return self.changectx(rev)[name].data() | |
|
228 | 228 | except revlog.LookupError, err: |
|
229 | 229 | raise IOError(err) |
|
230 | 230 |
@@ -52,7 +52,6 b' import os, shlex, shutil, tempfile' | |||
|
52 | 52 | |
|
53 | 53 | def snapshot_node(ui, repo, files, node, tmproot): |
|
54 | 54 | '''snapshot files as of some revision''' |
|
55 | mf = repo.changectx(node).manifest() | |
|
56 | 55 | dirname = os.path.basename(repo.root) |
|
57 | 56 | if dirname == "": |
|
58 | 57 | dirname = "root" |
@@ -61,17 +60,18 b' def snapshot_node(ui, repo, files, node,' | |||
|
61 | 60 | os.mkdir(base) |
|
62 | 61 | ui.note(_('making snapshot of %d files from rev %s\n') % |
|
63 | 62 | (len(files), short(node))) |
|
63 | ctx = repo[node] | |
|
64 | 64 | for fn in files: |
|
65 | if not fn in mf: | |
|
65 | wfn = util.pconvert(fn) | |
|
66 | if not wfn in ctx: | |
|
66 | 67 | # skipping new file after a merge ? |
|
67 | 68 | continue |
|
68 | wfn = util.pconvert(fn) | |
|
69 | 69 | ui.note(' %s\n' % wfn) |
|
70 | 70 | dest = os.path.join(base, wfn) |
|
71 | 71 | destdir = os.path.dirname(dest) |
|
72 | 72 | if not os.path.isdir(destdir): |
|
73 | 73 | os.makedirs(destdir) |
|
74 |
data = repo.wwritedata(wfn, |
|
|
74 | data = repo.wwritedata(wfn, ctx[wfn].data()) | |
|
75 | 75 | open(dest, 'wb').write(data) |
|
76 | 76 | return dirname |
|
77 | 77 |
@@ -52,8 +52,8 b' def difftree(ui, repo, node1=None, node2' | |||
|
52 | 52 | """diff trees from two commits""" |
|
53 | 53 | def __difftree(repo, node1, node2, files=[]): |
|
54 | 54 | assert node2 is not None |
|
55 |
mmap = repo |
|
|
56 |
mmap2 = repo |
|
|
55 | mmap = repo[node1].manifest() | |
|
56 | mmap2 = repo[node2].manifest() | |
|
57 | 57 | m = cmdutil.match(repo, files) |
|
58 | 58 | status = repo.status(node1, node2, match=m)[:5] |
|
59 | 59 | modified, added, removed, deleted, unknown = status |
@@ -103,7 +103,7 b' def difftree(ui, repo, node1=None, node2' | |||
|
103 | 103 | def catcommit(ui, repo, n, prefix, ctx=None): |
|
104 | 104 | nlprefix = '\n' + prefix; |
|
105 | 105 | if ctx is None: |
|
106 |
ctx = repo |
|
|
106 | ctx = repo[n] | |
|
107 | 107 | (p1, p2) = ctx.parents() |
|
108 | 108 | ui.write("tree %s\n" % short(ctx.changeset()[0])) # use ctx.node() instead ?? |
|
109 | 109 | if p1: ui.write("parent %s\n" % short(p1.node())) |
@@ -191,7 +191,7 b' def revtree(ui, args, repo, full="tree",' | |||
|
191 | 191 | l[chunk - x:] = [0] * (chunk - x) |
|
192 | 192 | break |
|
193 | 193 | if full != None: |
|
194 |
l[x] = repo |
|
|
194 | l[x] = repo[i + x] | |
|
195 | 195 | l[x].changeset() # force reading |
|
196 | 196 | else: |
|
197 | 197 | l[x] = 1 |
@@ -172,12 +172,12 b' class kwtemplater(object):' | |||
|
172 | 172 | def overwrite(self, node, expand, files): |
|
173 | 173 | '''Overwrites selected files expanding/shrinking keywords.''' |
|
174 | 174 | if node is not None: # commit |
|
175 |
ctx = self.repo |
|
|
175 | ctx = self.repo[node] | |
|
176 | 176 | mf = ctx.manifest() |
|
177 | 177 | files = [f for f in ctx.files() if f in mf] |
|
178 | 178 | notify = self.ui.debug |
|
179 | 179 | else: # kwexpand/kwshrink |
|
180 |
ctx = self.repo |
|
|
180 | ctx = self.repo['.'] | |
|
181 | 181 | mf = ctx.manifest() |
|
182 | 182 | notify = self.ui.note |
|
183 | 183 | candidates = [f for f in files if self.iskwfile(f, mf.linkf)] |
@@ -386,7 +386,7 b' def files(ui, repo, *pats, **opts):' | |||
|
386 | 386 | if opts.get('untracked'): |
|
387 | 387 | files += unknown |
|
388 | 388 | files.sort() |
|
389 |
wctx = repo |
|
|
389 | wctx = repo[None] | |
|
390 | 390 | islink = lambda p: 'l' in wctx.flags(p) |
|
391 | 391 | kwfiles = [f for f in files if kwt.iskwfile(f, islink)] |
|
392 | 392 | cwd = pats and repo.getcwd() or '' |
@@ -513,7 +513,7 b' def reposetup(ui, repo):' | |||
|
513 | 513 | comparing against working dir.''' |
|
514 | 514 | if node2 is not None: |
|
515 | 515 | kwt.matcher = util.never |
|
516 |
elif node1 is not None and node1 != repo |
|
|
516 | elif node1 is not None and node1 != repo['.'].node(): | |
|
517 | 517 | kwt.restrict = True |
|
518 | 518 | patch_diff(repo, node1, node2, match, fp, changes, opts) |
|
519 | 519 |
@@ -342,7 +342,7 b' class queue:' | |||
|
342 | 342 | hg.clean(repo, head) |
|
343 | 343 | self.strip(repo, n, update=False, backup='strip') |
|
344 | 344 | |
|
345 |
ctx = repo |
|
|
345 | ctx = repo[rev] | |
|
346 | 346 | ret = hg.merge(repo, rev) |
|
347 | 347 | if ret: |
|
348 | 348 | raise util.Abort(_("update returned %d") % ret) |
@@ -99,7 +99,7 b' def macencode(s, cmd):' | |||
|
99 | 99 | def forbidnewline(ui, repo, hooktype, node, newline, **kwargs): |
|
100 | 100 | halt = False |
|
101 | 101 | for rev in xrange(repo.changelog.rev(bin(node)), repo.changelog.count()): |
|
102 |
c = repo |
|
|
102 | c = repo[rev] | |
|
103 | 103 | for f in c.files(): |
|
104 | 104 | if f not in c: |
|
105 | 105 | continue |
@@ -208,7 +208,7 b' def archive(repo, dest, node, kind, deco' | |||
|
208 | 208 | data = repo.wwritedata(name, data) |
|
209 | 209 | archiver.addfile(name, mode, islink, data) |
|
210 | 210 | |
|
211 |
ctx = repo |
|
|
211 | ctx = repo[node] | |
|
212 | 212 | if kind not in archivers: |
|
213 | 213 | raise util.Abort(_("unknown archive type '%s'" % kind)) |
|
214 | 214 | archiver = archivers[kind](dest, prefix, mtime or ctx.date()[0]) |
@@ -245,7 +245,7 b' def findrenames(repo, added=None, remove' | |||
|
245 | 245 | '''find renamed files -- yields (before, after, score) tuples''' |
|
246 | 246 | if added is None or removed is None: |
|
247 | 247 | added, removed = repo.status()[1:3] |
|
248 |
ctx = repo |
|
|
248 | ctx = repo['.'] | |
|
249 | 249 | for a in added: |
|
250 | 250 | aa = repo.wread(a) |
|
251 | 251 | bestname, bestscore = None, threshold |
@@ -930,7 +930,7 b' def show_changeset(ui, repo, opts, buffe' | |||
|
930 | 930 | def finddate(ui, repo, date): |
|
931 | 931 | """Find the tipmost changeset that matches the given date spec""" |
|
932 | 932 | df = util.matchdate(date) |
|
933 |
get = util.cachefunc(lambda r: repo |
|
|
933 | get = util.cachefunc(lambda r: repo[r].changeset()) | |
|
934 | 934 | changeiter, matchfn = walkchangerevs(ui, repo, [], get, {'rev':None}) |
|
935 | 935 | results = {} |
|
936 | 936 | for st, rev, fns in changeiter: |
@@ -992,7 +992,7 b' def walkchangerevs(ui, repo, pats, chang' | |||
|
992 | 992 | return [], m |
|
993 | 993 | |
|
994 | 994 | if follow: |
|
995 |
defrange = '%s:0' % repo |
|
|
995 | defrange = '%s:0' % repo['.'].rev() | |
|
996 | 996 | else: |
|
997 | 997 | defrange = '-1:0' |
|
998 | 998 | revs = revrange(repo, opts['rev'] or [defrange]) |
@@ -107,7 +107,7 b' def annotate(ui, repo, *pats, **opts):' | |||
|
107 | 107 | lastfunc = funcmap[-1] |
|
108 | 108 | funcmap[-1] = lambda x: "%s:%s" % (lastfunc(x), x[1]) |
|
109 | 109 | |
|
110 |
ctx = repo |
|
|
110 | ctx = repo[opts['rev']] | |
|
111 | 111 | |
|
112 | 112 | m = cmdutil.match(repo, pats, opts) |
|
113 | 113 | for abs in repo.walk(m, ctx.node()): |
@@ -154,7 +154,7 b' def archive(ui, repo, dest, **opts):' | |||
|
154 | 154 | The default is the basename of the archive, with suffixes removed. |
|
155 | 155 | ''' |
|
156 | 156 | |
|
157 |
ctx = repo |
|
|
157 | ctx = repo[opts['rev']] | |
|
158 | 158 | if not ctx: |
|
159 | 159 | raise util.Abort(_('repository has no revisions')) |
|
160 | 160 | node = ctx.node() |
@@ -359,7 +359,7 b' def branch(ui, repo, label=None, **opts)' | |||
|
359 | 359 | |
|
360 | 360 | if label: |
|
361 | 361 | if not opts.get('force') and label in repo.branchtags(): |
|
362 |
if label not in [p.branch() for p in repo. |
|
|
362 | if label not in [p.branch() for p in repo.parents()]: | |
|
363 | 363 | raise util.Abort(_('a branch of the same name already exists' |
|
364 | 364 | ' (use --force to override)')) |
|
365 | 365 | repo.dirstate.setbranch(util.fromlocal(label)) |
@@ -378,7 +378,7 b' def branches(ui, repo, active=False):' | |||
|
378 | 378 | Use the command 'hg update' to switch to an existing branch. |
|
379 | 379 | """ |
|
380 | 380 | hexfunc = ui.debugflag and hex or short |
|
381 |
activebranches = [util.tolocal(repo |
|
|
381 | activebranches = [util.tolocal(repo[n].branch()) | |
|
382 | 382 | for n in repo.heads()] |
|
383 | 383 | branches = [(tag in activebranches, repo.changelog.rev(node), tag) |
|
384 | 384 | for tag, node in repo.branchtags().items()] |
@@ -483,7 +483,7 b' def cat(ui, repo, file1, *pats, **opts):' | |||
|
483 | 483 | %d dirname of file being printed, or '.' if in repo root |
|
484 | 484 | %p root-relative path name of file being printed |
|
485 | 485 | """ |
|
486 |
ctx = repo |
|
|
486 | ctx = repo[opts['rev']] | |
|
487 | 487 | err = 1 |
|
488 | 488 | m = cmdutil.match(repo, (file1,) + pats, opts) |
|
489 | 489 | for abs in repo.walk(m, ctx.node()): |
@@ -647,23 +647,20 b' def debugfsinfo(ui, path = "."):' | |||
|
647 | 647 | and 'yes' or 'no')) |
|
648 | 648 | os.unlink('.debugfsinfo') |
|
649 | 649 | |
|
650 | def debugrebuildstate(ui, repo, rev=""): | |
|
650 | def debugrebuildstate(ui, repo, rev="tip"): | |
|
651 | 651 | """rebuild the dirstate as it would look like for the given revision""" |
|
652 | if rev == "": | |
|
653 | rev = repo.changelog.tip() | |
|
654 | ctx = repo.changectx(rev) | |
|
655 | files = ctx.manifest() | |
|
652 | ctx = repo[rev] | |
|
656 | 653 | wlock = repo.wlock() |
|
657 | 654 | try: |
|
658 |
repo.dirstate.rebuild( |
|
|
655 | repo.dirstate.rebuild(ctx.node(), ctx.manifest()) | |
|
659 | 656 | finally: |
|
660 | 657 | del wlock |
|
661 | 658 | |
|
662 | 659 | def debugcheckstate(ui, repo): |
|
663 | 660 | """validate the correctness of the current dirstate""" |
|
664 | 661 | parent1, parent2 = repo.dirstate.parents() |
|
665 |
m1 = repo |
|
|
666 |
m2 = repo |
|
|
662 | m1 = repo[parent1].manifest() | |
|
663 | m2 = repo[parent2].manifest() | |
|
667 | 664 | errors = 0 |
|
668 | 665 | for f in repo.dirstate: |
|
669 | 666 | state = repo.dirstate[f] |
@@ -913,7 +910,7 b' def debuginstall(ui):' | |||
|
913 | 910 | def debugrename(ui, repo, file1, *pats, **opts): |
|
914 | 911 | """dump rename information""" |
|
915 | 912 | |
|
916 |
ctx = repo |
|
|
913 | ctx = repo[opts.get('rev', 'tip')] | |
|
917 | 914 | m = cmdutil.match(repo, (file1,) + pats, opts) |
|
918 | 915 | for abs in repo.walk(m, ctx.node()): |
|
919 | 916 | fctx = ctx.filectx(abs) |
@@ -1122,7 +1119,7 b' def grep(ui, repo, pattern, *pats, **opt' | |||
|
1122 | 1119 | |
|
1123 | 1120 | fstate = {} |
|
1124 | 1121 | skip = {} |
|
1125 |
get = util.cachefunc(lambda r: repo |
|
|
1122 | get = util.cachefunc(lambda r: repo[r].changeset()) | |
|
1126 | 1123 | changeiter, matchfn = cmdutil.walkchangerevs(ui, repo, pats, get, opts) |
|
1127 | 1124 | found = False |
|
1128 | 1125 | follow = opts.get('follow') |
@@ -1130,7 +1127,7 b' def grep(ui, repo, pattern, *pats, **opt' | |||
|
1130 | 1127 | if st == 'window': |
|
1131 | 1128 | matches.clear() |
|
1132 | 1129 | elif st == 'add': |
|
1133 |
ctx = repo |
|
|
1130 | ctx = repo[rev] | |
|
1134 | 1131 | matches[rev] = {} |
|
1135 | 1132 | for fn in fns: |
|
1136 | 1133 | if fn in skip: |
@@ -1202,7 +1199,7 b' def heads(ui, repo, *branchrevs, **opts)' | |||
|
1202 | 1199 | heads = [] |
|
1203 | 1200 | visitedset = util.set() |
|
1204 | 1201 | for branchrev in branchrevs: |
|
1205 |
branch = repo |
|
|
1202 | branch = repo[branchrev].branch() | |
|
1206 | 1203 | if branch in visitedset: |
|
1207 | 1204 | continue |
|
1208 | 1205 | visitedset.add(branch) |
@@ -1454,7 +1451,7 b' def identify(ui, repo, source=None,' | |||
|
1454 | 1451 | "can't query remote revision number, branch, or tags") |
|
1455 | 1452 | output = [hexfunc(srepo.lookup(rev))] |
|
1456 | 1453 | elif not rev: |
|
1457 |
ctx = repo |
|
|
1454 | ctx = repo[None] | |
|
1458 | 1455 | parents = ctx.parents() |
|
1459 | 1456 | changed = False |
|
1460 | 1457 | if default or id or num: |
@@ -1466,7 +1463,7 b' def identify(ui, repo, source=None,' | |||
|
1466 | 1463 | output.append("%s%s" % ('+'.join([str(p.rev()) for p in parents]), |
|
1467 | 1464 | (changed) and "+" or "")) |
|
1468 | 1465 | else: |
|
1469 |
ctx = repo |
|
|
1466 | ctx = repo[rev] | |
|
1470 | 1467 | if default or id: |
|
1471 | 1468 | output = [hexfunc(ctx.node())] |
|
1472 | 1469 | if num: |
@@ -1563,7 +1560,7 b' def import_(ui, repo, patch1, *patches, ' | |||
|
1563 | 1560 | message = None |
|
1564 | 1561 | ui.debug(_('message:\n%s\n') % message) |
|
1565 | 1562 | |
|
1566 |
wp = repo. |
|
|
1563 | wp = repo.parents() | |
|
1567 | 1564 | if opts.get('exact'): |
|
1568 | 1565 | if not nodeid or not p1: |
|
1569 | 1566 | raise util.Abort(_('not a mercurial patch')) |
@@ -1756,7 +1753,7 b' def log(ui, repo, *pats, **opts):' | |||
|
1756 | 1753 | |
|
1757 | 1754 | """ |
|
1758 | 1755 | |
|
1759 |
get = util.cachefunc(lambda r: repo |
|
|
1756 | get = util.cachefunc(lambda r: repo[r].changeset()) | |
|
1760 | 1757 | changeiter, matchfn = cmdutil.walkchangerevs(ui, repo, pats, get, opts) |
|
1761 | 1758 | |
|
1762 | 1759 | limit = cmdutil.loglimit(opts) |
@@ -1793,7 +1790,7 b' def log(ui, repo, *pats, **opts):' | |||
|
1793 | 1790 | # filectx logic. |
|
1794 | 1791 | |
|
1795 | 1792 | try: |
|
1796 |
return repo |
|
|
1793 | return repo[rev][fn].renamed() | |
|
1797 | 1794 | except revlog.LookupError: |
|
1798 | 1795 | pass |
|
1799 | 1796 | return None |
@@ -1869,7 +1866,7 b' def manifest(ui, repo, node=None, rev=No' | |||
|
1869 | 1866 | if not node: |
|
1870 | 1867 | node = rev |
|
1871 | 1868 | |
|
1872 |
m = repo |
|
|
1869 | m = repo[node].manifest() | |
|
1873 | 1870 | files = m.keys() |
|
1874 | 1871 | files.sort() |
|
1875 | 1872 | |
@@ -1916,7 +1913,7 b' def merge(ui, repo, node=None, force=Non' | |||
|
1916 | 1913 | "please merge with an explicit rev") % |
|
1917 | 1914 | branch) |
|
1918 | 1915 | msg = _('there is nothing to merge') |
|
1919 |
if parent != repo.lookup(repo |
|
|
1916 | if parent != repo.lookup(repo[None].branch()): | |
|
1920 | 1917 | msg = _('%s - use "hg update" instead') % msg |
|
1921 | 1918 | raise util.Abort(msg) |
|
1922 | 1919 | |
@@ -1973,9 +1970,9 b' def parents(ui, repo, file_=None, **opts' | |||
|
1973 | 1970 | """ |
|
1974 | 1971 | rev = opts.get('rev') |
|
1975 | 1972 | if rev: |
|
1976 |
ctx = repo |
|
|
1973 | ctx = repo[rev] | |
|
1977 | 1974 | else: |
|
1978 |
ctx = repo |
|
|
1975 | ctx = repo[None] | |
|
1979 | 1976 | |
|
1980 | 1977 | if file_: |
|
1981 | 1978 | m = cmdutil.match(repo, (file_,), opts) |
@@ -2297,7 +2294,7 b' def resolve(ui, repo, *pats, **opts):' | |||
|
2297 | 2294 | elif opts.get("unmark"): |
|
2298 | 2295 | ms.mark(f, "u") |
|
2299 | 2296 | else: |
|
2300 |
wctx = repo |
|
|
2297 | wctx = repo[None] | |
|
2301 | 2298 | mctx = wctx.parents()[-1] |
|
2302 | 2299 | ms.resolve(f, wctx, mctx) |
|
2303 | 2300 | |
@@ -2348,7 +2345,7 b' def revert(ui, repo, *pats, **opts):' | |||
|
2348 | 2345 | if not opts['rev'] and p2 != nullid: |
|
2349 | 2346 | raise util.Abort(_('uncommitted merge - please provide a ' |
|
2350 | 2347 | 'specific revision')) |
|
2351 |
ctx = repo |
|
|
2348 | ctx = repo[opts['rev']] | |
|
2352 | 2349 | node = ctx.node() |
|
2353 | 2350 | mf = ctx.manifest() |
|
2354 | 2351 | if node == parent: |
@@ -2466,7 +2463,7 b' def revert(ui, repo, *pats, **opts):' | |||
|
2466 | 2463 | if pmf is None: |
|
2467 | 2464 | # only need parent manifest in this unlikely case, |
|
2468 | 2465 | # so do not read by default |
|
2469 |
pmf = repo |
|
|
2466 | pmf = repo[parent].manifest() | |
|
2470 | 2467 | if abs in pmf: |
|
2471 | 2468 | if mfentry: |
|
2472 | 2469 | # if version of file is same in parent and target |
@@ -2668,9 +2665,9 b' def status(ui, repo, *pats, **opts):' | |||
|
2668 | 2665 | changestates = zip(states, 'MAR!?IC', stat) |
|
2669 | 2666 | |
|
2670 | 2667 | if (opts['all'] or opts['copies']) and not opts['no_status']: |
|
2671 |
ctxn = repo |
|
|
2672 |
ctx1 = repo |
|
|
2673 |
ctx2 = repo |
|
|
2668 | ctxn = repo[nullid] | |
|
2669 | ctx1 = repo[node1] | |
|
2670 | ctx2 = repo[node2] | |
|
2674 | 2671 | added = stat[1] |
|
2675 | 2672 | if node2 is None: |
|
2676 | 2673 | added = stat[0] + stat[1] # merged? |
@@ -2744,7 +2741,7 b' def tag(ui, repo, name1, *names, **opts)' | |||
|
2744 | 2741 | if not rev_ and repo.dirstate.parents()[1] != nullid: |
|
2745 | 2742 | raise util.Abort(_('uncommitted merge - please provide a ' |
|
2746 | 2743 | 'specific revision')) |
|
2747 |
r = repo |
|
|
2744 | r = repo[rev_].node() | |
|
2748 | 2745 | |
|
2749 | 2746 | if not message: |
|
2750 | 2747 | message = (_('Added tag %s for changeset %s') % |
@@ -463,7 +463,7 b' class workingctx(changectx):' | |||
|
463 | 463 | self._user = self._repo.ui.username() |
|
464 | 464 | if parents: |
|
465 | 465 | p1, p2 = parents |
|
466 |
self._parents = [self._repo |
|
|
466 | self._parents = [changectx(self._repo, p) for p in (p1, p2)] | |
|
467 | 467 | if changes: |
|
468 | 468 | self._status = list(changes) |
|
469 | 469 | |
@@ -687,7 +687,7 b' class memctx(object):' | |||
|
687 | 687 | self._user = user or self._repo.ui.username() |
|
688 | 688 | parents = [(p or nullid) for p in parents] |
|
689 | 689 | p1, p2 = parents |
|
690 |
self._parents = [self._repo |
|
|
690 | self._parents = [changectx(self._repo, p) for p in (p1, p2)] | |
|
691 | 691 | files = list(files) |
|
692 | 692 | files.sort() |
|
693 | 693 | self._status = [files, [], [], [], []] |
@@ -69,6 +69,6 b' def graph(repo, start_rev, stop_rev):' | |||
|
69 | 69 | edges.append((col, next.index(p), colors[p])) |
|
70 | 70 | |
|
71 | 71 | # Yield and move on |
|
72 |
yield (repo |
|
|
72 | yield (repo[curr_rev], (idx, color), edges) | |
|
73 | 73 | revs = next |
|
74 | 74 | curr_rev -= 1 |
@@ -331,8 +331,8 b' class hgweb(object):' | |||
|
331 | 331 | linenumber="% 8s" % lineno) |
|
332 | 332 | |
|
333 | 333 | r = self.repo |
|
334 |
c1 = r |
|
|
335 |
c2 = r |
|
|
334 | c1 = r[node1] | |
|
335 | c2 = r[node2] | |
|
336 | 336 | date1 = util.datestr(c1.date()) |
|
337 | 337 | date2 = util.datestr(c2.date()) |
|
338 | 338 |
@@ -113,7 +113,7 b' def _search(web, tmpl, query):' | |||
|
113 | 113 | for i in xrange(cl.count() - 1, 0, -100): |
|
114 | 114 | l = [] |
|
115 | 115 | for j in xrange(max(0, i - 100), i + 1): |
|
116 |
ctx = web.repo |
|
|
116 | ctx = web.repo[j] | |
|
117 | 117 | l.append(ctx) |
|
118 | 118 | l.reverse() |
|
119 | 119 | for e in l: |
@@ -170,7 +170,7 b' def changelog(web, req, tmpl, shortlog =' | |||
|
170 | 170 | else: |
|
171 | 171 | hi = web.repo.changelog.count() - 1 |
|
172 | 172 | try: |
|
173 |
ctx = web.repo |
|
|
173 | ctx = web.repo[hi] | |
|
174 | 174 | except RepoError: |
|
175 | 175 | return _search(web, tmpl, hi) # XXX redirect to 404 page? |
|
176 | 176 | |
@@ -178,7 +178,7 b' def changelog(web, req, tmpl, shortlog =' | |||
|
178 | 178 | cl = web.repo.changelog |
|
179 | 179 | l = [] # build a list in forward order for efficiency |
|
180 | 180 | for i in xrange(start, end): |
|
181 |
ctx = web.repo |
|
|
181 | ctx = web.repo[i] | |
|
182 | 182 | n = ctx.node() |
|
183 | 183 | showtags = webutil.showtag(web.repo, tmpl, 'changelogtag', n) |
|
184 | 184 | |
@@ -299,7 +299,7 b' def manifest(web, req, tmpl):' | |||
|
299 | 299 | yield {"file": full, |
|
300 | 300 | "parity": parity.next(), |
|
301 | 301 | "basename": f, |
|
302 |
"date": fctx. |
|
|
302 | "date": fctx.date(), | |
|
303 | 303 | "size": fctx.size(), |
|
304 | 304 | "permissions": mf.flags(full)} |
|
305 | 305 | |
@@ -343,7 +343,7 b' def tags(web, req, tmpl):' | |||
|
343 | 343 | count = count + 1 |
|
344 | 344 | yield {"parity": parity.next(), |
|
345 | 345 | "tag": k, |
|
346 |
"date": web.repo |
|
|
346 | "date": web.repo[n].date(), | |
|
347 | 347 | "node": hex(n)} |
|
348 | 348 | |
|
349 | 349 | return tmpl("tags", |
@@ -371,7 +371,7 b' def summary(web, req, tmpl):' | |||
|
371 | 371 | parity=parity.next(), |
|
372 | 372 | tag=k, |
|
373 | 373 | node=hex(n), |
|
374 |
date=web.repo |
|
|
374 | date=web.repo[n].date()) | |
|
375 | 375 | |
|
376 | 376 | def branches(**map): |
|
377 | 377 | parity = paritygen(web.stripecount) |
@@ -381,17 +381,16 b' def summary(web, req, tmpl):' | |||
|
381 | 381 | l.sort() |
|
382 | 382 | |
|
383 | 383 | for r,n,t in l: |
|
384 | ctx = web.repo.changectx(n) | |
|
385 | 384 | yield {'parity': parity.next(), |
|
386 | 385 | 'branch': t, |
|
387 | 386 | 'node': hex(n), |
|
388 |
'date': |
|
|
387 | 'date': web.repo[n].date()} | |
|
389 | 388 | |
|
390 | 389 | def changelist(**map): |
|
391 | 390 | parity = paritygen(web.stripecount, offset=start-end) |
|
392 | 391 | l = [] # build a list in forward order for efficiency |
|
393 | 392 | for i in xrange(start, end): |
|
394 |
ctx = web.repo |
|
|
393 | ctx = web.repo[i] | |
|
395 | 394 | n = ctx.node() |
|
396 | 395 | hn = hex(n) |
|
397 | 396 |
@@ -120,11 +120,10 b' def changectx(repo, req):' | |||
|
120 | 120 | changeid = repo.changelog.count() - 1 |
|
121 | 121 | |
|
122 | 122 | try: |
|
123 |
ctx = repo |
|
|
123 | ctx = repo[changeid] | |
|
124 | 124 | except RepoError: |
|
125 | 125 | man = repo.manifest |
|
126 |
|
|
|
127 | ctx = repo.changectx(man.linkrev(mn)) | |
|
126 | ctx = repo[man.linkrev(man.lookup(changeid))] | |
|
128 | 127 | |
|
129 | 128 | return ctx |
|
130 | 129 | |
@@ -135,8 +134,7 b' def filectx(repo, req):' | |||
|
135 | 134 | else: |
|
136 | 135 | changeid = req.form['filenode'][0] |
|
137 | 136 | try: |
|
138 |
ctx = repo |
|
|
139 | fctx = ctx.filectx(path) | |
|
137 | fctx = repo[changeid][path] | |
|
140 | 138 | except RepoError: |
|
141 | 139 | fctx = repo.filectx(path, fileid=changeid) |
|
142 | 140 |
@@ -117,6 +117,11 b' class localrepository(repo.repository):' | |||
|
117 | 117 | else: |
|
118 | 118 | raise AttributeError, name |
|
119 | 119 | |
|
120 | def __getitem__(self, changeid): | |
|
121 | if changeid == None: | |
|
122 | return context.workingctx(self) | |
|
123 | return context.changectx(self, changeid) | |
|
124 | ||
|
120 | 125 | def url(self): |
|
121 | 126 | return 'file:' + self.root |
|
122 | 127 | |
@@ -330,7 +335,7 b' class localrepository(repo.repository):' | |||
|
330 | 335 | last = {} |
|
331 | 336 | ret = [] |
|
332 | 337 | for node in heads: |
|
333 |
c = self |
|
|
338 | c = self[node] | |
|
334 | 339 | rev = c.rev() |
|
335 | 340 | try: |
|
336 | 341 | fnode = c.filenode('.hgtags') |
@@ -436,7 +441,7 b' class localrepository(repo.repository):' | |||
|
436 | 441 | |
|
437 | 442 | def _updatebranchcache(self, partial, start, end): |
|
438 | 443 | for r in xrange(start, end): |
|
439 |
c = self |
|
|
444 | c = self[r] | |
|
440 | 445 | b = c.branch() |
|
441 | 446 | partial[b] = c.node() |
|
442 | 447 | |
@@ -484,13 +489,11 b' class localrepository(repo.repository):' | |||
|
484 | 489 | return filelog.filelog(self.sopener, f) |
|
485 | 490 | |
|
486 | 491 | def changectx(self, changeid): |
|
487 | if changeid == None: | |
|
488 | return context.workingctx(self) | |
|
489 | return context.changectx(self, changeid) | |
|
492 | return self[changeid] | |
|
490 | 493 | |
|
491 | 494 | def parents(self, changeid=None): |
|
492 | 495 | '''get list of changectxs for parents of changeid''' |
|
493 |
return self |
|
|
496 | return self[changeid].parents() | |
|
494 | 497 | |
|
495 | 498 | def filectx(self, path, changeid=None, fileid=None): |
|
496 | 499 | """changeid can be a changeset revision, node, or tag. |
@@ -1005,7 +1008,7 b' class localrepository(repo.repository):' | |||
|
1005 | 1008 | if lookup: |
|
1006 | 1009 | fixup = [] |
|
1007 | 1010 | # do a full compare of any files that might have changed |
|
1008 |
ctx = self. |
|
|
1011 | ctx = self['.'] | |
|
1009 | 1012 | ff = self.dirstate.flagfunc(ctx.flags) |
|
1010 | 1013 | for f in lookup: |
|
1011 | 1014 | if (f not in ctx or ff(f) != ctx.flags(f) |
@@ -1181,7 +1184,8 b' class localrepository(repo.repository):' | |||
|
1181 | 1184 | return [n for (r, n) in heads] |
|
1182 | 1185 | |
|
1183 | 1186 | def branchheads(self, branch=None, start=None): |
|
1184 | branch = branch is None and self.changectx(None).branch() or branch | |
|
1187 | if branch is None: | |
|
1188 | branch = self[None].branch() | |
|
1185 | 1189 | branches = self.branchtags() |
|
1186 | 1190 | if branch not in branches: |
|
1187 | 1191 | return [] |
@@ -1219,7 +1223,7 b' class localrepository(repo.repository):' | |||
|
1219 | 1223 | if rev in ancestors: |
|
1220 | 1224 | ancestors.update(self.changelog.parentrevs(rev)) |
|
1221 | 1225 | ancestors.remove(rev) |
|
1222 |
elif self |
|
|
1226 | elif self[rev].branch() == branch: | |
|
1223 | 1227 | heads.append(rev) |
|
1224 | 1228 | ancestors.update(self.changelog.parentrevs(rev)) |
|
1225 | 1229 | heads = [self.changelog.node(rev) for rev in heads] |
@@ -409,7 +409,7 b' def update(repo, node, branchmerge, forc' | |||
|
409 | 409 | |
|
410 | 410 | wlock = repo.wlock() |
|
411 | 411 | try: |
|
412 |
wc = repo |
|
|
412 | wc = repo[None] | |
|
413 | 413 | if node is None: |
|
414 | 414 | # tip of current branch |
|
415 | 415 | try: |
@@ -421,7 +421,7 b' def update(repo, node, branchmerge, forc' | |||
|
421 | 421 | raise util.Abort(_("branch %s not found") % wc.branch()) |
|
422 | 422 | overwrite = force and not branchmerge |
|
423 | 423 | pl = wc.parents() |
|
424 |
p1, p2 = pl[0], repo |
|
|
424 | p1, p2 = pl[0], repo[node] | |
|
425 | 425 | pa = p1.ancestor(p2) |
|
426 | 426 | fp1, fp2, xp1, xp2 = p1.node(), p2.node(), str(p1), str(p2) |
|
427 | 427 | fastforward = False |
@@ -1180,7 +1180,7 b' def diff(repo, node1=None, node2=None, m' | |||
|
1180 | 1180 | |
|
1181 | 1181 | # reading the data for node1 early allows it to play nicely |
|
1182 | 1182 | # with repo.status and the revlog cache. |
|
1183 |
ctx1 = repo |
|
|
1183 | ctx1 = repo[node1] | |
|
1184 | 1184 | # force manifest reading |
|
1185 | 1185 | man1 = ctx1.manifest() |
|
1186 | 1186 | date1 = util.datestr(ctx1.date()) |
@@ -1192,7 +1192,7 b' def diff(repo, node1=None, node2=None, m' | |||
|
1192 | 1192 | if not modified and not added and not removed: |
|
1193 | 1193 | return |
|
1194 | 1194 | |
|
1195 |
ctx2 = repo |
|
|
1195 | ctx2 = repo[node2] | |
|
1196 | 1196 | |
|
1197 | 1197 | if repo.ui.quiet: |
|
1198 | 1198 | r = None |
@@ -1201,7 +1201,7 b' def diff(repo, node1=None, node2=None, m' | |||
|
1201 | 1201 | r = [hexfunc(node) for node in [node1, node2] if node] |
|
1202 | 1202 | |
|
1203 | 1203 | if opts.git: |
|
1204 |
copy, diverge = copies.copies(repo, ctx1, ctx2, repo |
|
|
1204 | copy, diverge = copies.copies(repo, ctx1, ctx2, repo[nullid]) | |
|
1205 | 1205 | for k, v in copy.items(): |
|
1206 | 1206 | copy[v] = k |
|
1207 | 1207 | |
@@ -1280,7 +1280,7 b" def export(repo, revs, template='hg-%h.p" | |||
|
1280 | 1280 | revwidth = max([len(str(rev)) for rev in revs]) |
|
1281 | 1281 | |
|
1282 | 1282 | def single(rev, seqno, fp): |
|
1283 |
ctx = repo |
|
|
1283 | ctx = repo[rev] | |
|
1284 | 1284 | node = ctx.node() |
|
1285 | 1285 | parents = [p.node() for p in ctx.parents() if p] |
|
1286 | 1286 | branch = ctx.branch() |
General Comments 0
You need to be logged in to leave comments.
Login now