Show More
@@ -12,7 +12,7 b' for f in sys.argv[1:]:' | |||
|
12 | 12 | binopen = lambda fn: open(fn, 'rb') |
|
13 | 13 | r = revlog.revlog(binopen, f) |
|
14 | 14 | print "file:", f |
|
15 |
for i in |
|
|
15 | for i in r: | |
|
16 | 16 | n = r.node(i) |
|
17 | 17 | p = r.parents(n) |
|
18 | 18 | d = r.revision(n) |
@@ -118,7 +118,5 b' def hook(ui, repo, hooktype, node=None, ' | |||
|
118 | 118 | ui.debug(_('acl: changes have source "%s" - skipping\n') % source) |
|
119 | 119 | return |
|
120 | 120 | |
|
121 | start = repo.changelog.rev(bin(node)) | |
|
122 | end = repo.changelog.count() | |
|
123 | for rev in xrange(start, end): | |
|
121 | for rev in xrange(repo[node].rev(), len(repo)): | |
|
124 | 122 | c.check(repo.changelog.node(rev)) |
@@ -91,7 +91,7 b' def gather_stats(ui, repo, amap, revs=No' | |||
|
91 | 91 | cl = repo.changelog |
|
92 | 92 | |
|
93 | 93 | if not revs: |
|
94 |
revs = range( |
|
|
94 | revs = range(len(cl)) | |
|
95 | 95 | |
|
96 | 96 | nr_revs = len(revs) |
|
97 | 97 | cur_rev = 0 |
@@ -89,7 +89,7 b' def filelog_grapher(repo, path, start_re' | |||
|
89 | 89 | assert start_rev >= stop_rev |
|
90 | 90 | curr_rev = start_rev |
|
91 | 91 | revs = [] |
|
92 |
filerev = repo.file(path) |
|
|
92 | filerev = len(repo.file(path)) - 1 | |
|
93 | 93 | while filerev >= 0: |
|
94 | 94 | fctx = repo.filectx(path, fileid=filerev) |
|
95 | 95 | |
@@ -198,7 +198,7 b' def get_revs(repo, rev_opt):' | |||
|
198 | 198 | revs = revrange(repo, rev_opt) |
|
199 | 199 | return (max(revs), min(revs)) |
|
200 | 200 | else: |
|
201 |
return (repo |
|
|
201 | return (len(repo) - 1, 0) | |
|
202 | 202 | |
|
203 | 203 | def graphlog(ui, repo, path=None, **opts): |
|
204 | 204 | """show revision history alongside an ASCII revision graph |
@@ -175,7 +175,7 b' def catfile(ui, repo, type=None, r=None,' | |||
|
175 | 175 | # you can specify a commit to stop at by starting the sha1 with ^ |
|
176 | 176 | def revtree(ui, args, repo, full="tree", maxnr=0, parents=False): |
|
177 | 177 | def chlogwalk(): |
|
178 |
count = repo |
|
|
178 | count = len(repo) | |
|
179 | 179 | i = count |
|
180 | 180 | l = [0] * 100 |
|
181 | 181 | chunk = 100 |
@@ -178,6 +178,7 b' class kwtemplater(object):' | |||
|
178 | 178 | notify = self.ui.debug |
|
179 | 179 | else: # kwexpand/kwshrink |
|
180 | 180 | ctx = self.repo['.'] |
|
181 | mf = ctx.manifest() | |
|
181 | 182 | notify = self.ui.note |
|
182 | 183 | candidates = [f for f in files if self.iskwfile(f, ctx.flags)] |
|
183 | 184 | if candidates: |
@@ -2319,7 +2319,7 b' def reposetup(ui, repo):' | |||
|
2319 | 2319 | # we might as well use it, but we won't save it. |
|
2320 | 2320 | |
|
2321 | 2321 | # update the cache up to the tip |
|
2322 |
self._updatebranchcache(partial, start, cl |
|
|
2322 | self._updatebranchcache(partial, start, len(cl)) | |
|
2323 | 2323 | |
|
2324 | 2324 | return partial |
|
2325 | 2325 |
@@ -269,11 +269,11 b' def hook(ui, repo, hooktype, node=None, ' | |||
|
269 | 269 | node = bin(node) |
|
270 | 270 | ui.pushbuffer() |
|
271 | 271 | if hooktype == 'changegroup': |
|
272 |
start = repo |
|
|
273 |
end = repo |
|
|
272 | start = repo[node].rev() | |
|
273 | end = len(repo) | |
|
274 | 274 | count = end - start |
|
275 | 275 | for rev in xrange(start, end): |
|
276 |
n.node(repo. |
|
|
276 | n.node(repo[node].rev()) | |
|
277 | 277 | n.diff(node, repo.changelog.tip()) |
|
278 | 278 | else: |
|
279 | 279 | count = 1 |
@@ -98,7 +98,7 b' def macencode(s, cmd):' | |||
|
98 | 98 | |
|
99 | 99 | def forbidnewline(ui, repo, hooktype, node, newline, **kwargs): |
|
100 | 100 | halt = False |
|
101 |
for rev in xrange(repo |
|
|
101 | for rev in xrange(repo[node].rev(), len(repo)): | |
|
102 | 102 | c = repo[rev] |
|
103 | 103 | for f in c.files(): |
|
104 | 104 | if f not in c: |
@@ -34,7 +34,7 b' class bundlerevlog(revlog.revlog):' | |||
|
34 | 34 | for chunk in changegroup.chunkiter(bundlefile): |
|
35 | 35 | pos = bundlefile.tell() |
|
36 | 36 | yield chunk, pos - len(chunk) |
|
37 |
n = self |
|
|
37 | n = len(self) | |
|
38 | 38 | prev = None |
|
39 | 39 | for chunk, start in chunkpositer(): |
|
40 | 40 | size = len(chunk) |
@@ -82,7 +82,7 b' class changelog(revlog):' | |||
|
82 | 82 | "delay visibility of index updates to other readers" |
|
83 | 83 | self._realopener = self.opener |
|
84 | 84 | self.opener = self._delayopener |
|
85 |
self._delaycount = self |
|
|
85 | self._delaycount = len(self) | |
|
86 | 86 | self._delaybuf = [] |
|
87 | 87 | self._delayname = None |
|
88 | 88 | |
@@ -108,7 +108,7 b' class changelog(revlog):' | |||
|
108 | 108 | # if we're doing an initial clone, divert to another file |
|
109 | 109 | if self._delaycount == 0: |
|
110 | 110 | self._delayname = fp.name |
|
111 |
if not self |
|
|
111 | if not len(self): | |
|
112 | 112 | # make sure to truncate the file |
|
113 | 113 | mode = mode.replace('a', 'w') |
|
114 | 114 | return self._realopener(name + ".a", mode) |
@@ -192,4 +192,4 b' class changelog(revlog):' | |||
|
192 | 192 | list.sort() |
|
193 | 193 | l = [hex(manifest), user, parseddate] + list + ["", desc] |
|
194 | 194 | text = "\n".join(l) |
|
195 |
return self.addrevision(text, transaction, self |
|
|
195 | return self.addrevision(text, transaction, len(self), p1, p2) |
@@ -126,7 +126,7 b' def revpair(repo, revs):' | |||
|
126 | 126 | if revrangesep in revs[0]: |
|
127 | 127 | start, end = revs[0].split(revrangesep, 1) |
|
128 | 128 | start = revfix(repo, start, 0) |
|
129 |
end = revfix(repo, end, repo |
|
|
129 | end = revfix(repo, end, len(repo) - 1) | |
|
130 | 130 | else: |
|
131 | 131 | start = revfix(repo, revs[0], None) |
|
132 | 132 | elif len(revs) == 2: |
@@ -151,7 +151,7 b' def revrange(repo, revs):' | |||
|
151 | 151 | if revrangesep in spec: |
|
152 | 152 | start, end = spec.split(revrangesep, 1) |
|
153 | 153 | start = revfix(repo, start, 0) |
|
154 |
end = revfix(repo, end, repo |
|
|
154 | end = revfix(repo, end, len(repo) - 1) | |
|
155 | 155 | step = start > end and -1 or 1 |
|
156 | 156 | for rev in xrange(start, end+step, step): |
|
157 | 157 | if rev in seen: |
@@ -988,7 +988,7 b' def walkchangerevs(ui, repo, pats, chang' | |||
|
988 | 988 | m = match(repo, pats, opts) |
|
989 | 989 | follow = opts.get('follow') or opts.get('follow_first') |
|
990 | 990 | |
|
991 | if repo.changelog.count() == 0: | |
|
991 | if not len(repo): | |
|
992 | 992 | return [], m |
|
993 | 993 | |
|
994 | 994 | if follow: |
@@ -1007,9 +1007,9 b' def walkchangerevs(ui, repo, pats, chang' | |||
|
1007 | 1007 | if not slowpath: |
|
1008 | 1008 | # Only files, no patterns. Check the history of each file. |
|
1009 | 1009 | def filerevgen(filelog, node): |
|
1010 |
cl_count = repo |
|
|
1010 | cl_count = len(repo) | |
|
1011 | 1011 | if node is None: |
|
1012 |
last = filelog |
|
|
1012 | last = len(filelog) - 1 | |
|
1013 | 1013 | else: |
|
1014 | 1014 | last = filelog.rev(node) |
|
1015 | 1015 | for i, window in increasing_windows(last, nullrev): |
@@ -1032,7 +1032,7 b' def walkchangerevs(ui, repo, pats, chang' | |||
|
1032 | 1032 | minrev, maxrev = min(revs), max(revs) |
|
1033 | 1033 | for file_, node in iterfiles(): |
|
1034 | 1034 | filelog = repo.file(file_) |
|
1035 |
if filelog |
|
|
1035 | if not len(filelog): | |
|
1036 | 1036 | if node is None: |
|
1037 | 1037 | # A zero count may be a directory or deleted file, so |
|
1038 | 1038 | # try to find matching entries on the slow path. |
@@ -1058,8 +1058,7 b' def walkchangerevs(ui, repo, pats, chang' | |||
|
1058 | 1058 | |
|
1059 | 1059 | # The slow path checks files modified in every changeset. |
|
1060 | 1060 | def changerevgen(): |
|
1061 |
for i, window in increasing_windows(repo |
|
|
1062 | nullrev): | |
|
1061 | for i, window in increasing_windows(len(repo) - 1, nullrev): | |
|
1063 | 1062 | for j in xrange(i - window, i + 1): |
|
1064 | 1063 | yield j, change(j)[3] |
|
1065 | 1064 |
@@ -773,7 +773,7 b' def debugindex(ui, file_):' | |||
|
773 | 773 | r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_) |
|
774 | 774 | ui.write(" rev offset length base linkrev" + |
|
775 | 775 | " nodeid p1 p2\n") |
|
776 |
for i in |
|
|
776 | for i in r: | |
|
777 | 777 | node = r.node(i) |
|
778 | 778 | try: |
|
779 | 779 | pp = r.parents(node) |
@@ -787,7 +787,7 b' def debugindexdot(ui, file_):' | |||
|
787 | 787 | """dump an index DAG as a .dot file""" |
|
788 | 788 | r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_) |
|
789 | 789 | ui.write("digraph G {\n") |
|
790 |
for i in |
|
|
790 | for i in r: | |
|
791 | 791 | node = r.node(i) |
|
792 | 792 | pp = r.parents(node) |
|
793 | 793 | ui.write("\t%d -> %d\n" % (r.rev(pp[0]), i)) |
@@ -1762,7 +1762,7 b' def log(ui, repo, *pats, **opts):' | |||
|
1762 | 1762 | if opts['copies'] and opts['rev']: |
|
1763 | 1763 | endrev = max(cmdutil.revrange(repo, opts['rev'])) + 1 |
|
1764 | 1764 | else: |
|
1765 |
endrev = repo |
|
|
1765 | endrev = len(repo) | |
|
1766 | 1766 | rcache = {} |
|
1767 | 1767 | ncache = {} |
|
1768 | 1768 | def getrenamed(fn, rev): |
@@ -1774,7 +1774,7 b' def log(ui, repo, *pats, **opts):' | |||
|
1774 | 1774 | rcache[fn] = {} |
|
1775 | 1775 | ncache[fn] = {} |
|
1776 | 1776 | fl = repo.file(fn) |
|
1777 |
for i in |
|
|
1777 | for i in fl: | |
|
1778 | 1778 | node = fl.node(i) |
|
1779 | 1779 | lr = fl.linkrev(node) |
|
1780 | 1780 | renamed = fl.renamed(node) |
@@ -2794,7 +2794,7 b' def tip(ui, repo, **opts):' | |||
|
2794 | 2794 | that repository becomes the current tip. The "tip" tag is special |
|
2795 | 2795 | and cannot be renamed or assigned to a different changeset. |
|
2796 | 2796 | """ |
|
2797 |
cmdutil.show_changeset(ui, repo, opts).show( |
|
|
2797 | cmdutil.show_changeset(ui, repo, opts).show(len(repo) - 1) | |
|
2798 | 2798 | |
|
2799 | 2799 | def unbundle(ui, repo, fname1, *fnames, **opts): |
|
2800 | 2800 | """apply one or more changegroup files |
@@ -67,7 +67,7 b' def _findlimit(repo, a, b):' | |||
|
67 | 67 | # - quit when interesting revs is zero |
|
68 | 68 | |
|
69 | 69 | cl = repo.changelog |
|
70 |
working = cl |
|
|
70 | working = len(cl) # pseudo rev for the working directory | |
|
71 | 71 | if a is None: |
|
72 | 72 | a = working |
|
73 | 73 | if b is None: |
@@ -384,7 +384,7 b' class dirstate(object):' | |||
|
384 | 384 | def rebuild(self, parent, files): |
|
385 | 385 | self.clear() |
|
386 | 386 | for f in files: |
|
387 | if 'x' in files.flag(f): | |
|
387 | if 'x' in files.flags(f): | |
|
388 | 388 | self._map[f] = ('n', 0777, -1, 0, 0) |
|
389 | 389 | else: |
|
390 | 390 | self._map[f] = ('n', 0666, -1, 0, 0) |
@@ -20,12 +20,12 b' def bisect(changelog, state):' | |||
|
20 | 20 | badrev = min([changelog.rev(n) for n in bad]) |
|
21 | 21 | goodrevs = [changelog.rev(n) for n in good] |
|
22 | 22 | # build ancestors array |
|
23 |
ancestors = [[]] * (changelog |
|
|
23 | ancestors = [[]] * (len(changelog) + 1) # an extra for [-1] | |
|
24 | 24 | |
|
25 | 25 | # clear good revs from array |
|
26 | 26 | for node in goodrevs: |
|
27 | 27 | ancestors[node] = None |
|
28 |
for rev in xrange(changelog |
|
|
28 | for rev in xrange(len(changelog), -1, -1): | |
|
29 | 29 | if ancestors[rev] is None: |
|
30 | 30 | for prev in clparents(rev): |
|
31 | 31 | ancestors[prev] = None |
@@ -110,7 +110,7 b' def _search(web, tmpl, query):' | |||
|
110 | 110 | qw = query.lower().split() |
|
111 | 111 | |
|
112 | 112 | def revgen(): |
|
113 |
for i in xrange(cl |
|
|
113 | for i in xrange(len(cl) - 1, 0, -100): | |
|
114 | 114 | l = [] |
|
115 | 115 | for j in xrange(max(0, i - 100), i + 1): |
|
116 | 116 | ctx = web.repo[j] |
@@ -168,7 +168,7 b' def changelog(web, req, tmpl, shortlog =' | |||
|
168 | 168 | if 'rev' in req.form: |
|
169 | 169 | hi = req.form['rev'][0] |
|
170 | 170 | else: |
|
171 |
hi = web.repo |
|
|
171 | hi = len(web.repo) - 1 | |
|
172 | 172 | try: |
|
173 | 173 | ctx = web.repo[hi] |
|
174 | 174 | except RepoError: |
@@ -205,7 +205,7 b' def changelog(web, req, tmpl, shortlog =' | |||
|
205 | 205 | |
|
206 | 206 | maxchanges = shortlog and web.maxshortchanges or web.maxchanges |
|
207 | 207 | cl = web.repo.changelog |
|
208 |
count = cl |
|
|
208 | count = len(cl) | |
|
209 | 209 | pos = ctx.rev() |
|
210 | 210 | start = max(0, pos - maxchanges + 1) |
|
211 | 211 | end = min(count, start + maxchanges) |
@@ -409,7 +409,7 b' def summary(web, req, tmpl):' | |||
|
409 | 409 | yield l |
|
410 | 410 | |
|
411 | 411 | cl = web.repo.changelog |
|
412 |
count = cl |
|
|
412 | count = len(cl) | |
|
413 | 413 | start = max(0, count - web.maxchanges) |
|
414 | 414 | end = min(count, start + web.maxchanges) |
|
415 | 415 | |
@@ -498,7 +498,7 b' def filelog(web, req, tmpl):' | |||
|
498 | 498 | fctx = webutil.filectx(web.repo, req) |
|
499 | 499 | f = fctx.path() |
|
500 | 500 | fl = fctx.filelog() |
|
501 |
count = fl |
|
|
501 | count = len(fl) | |
|
502 | 502 | pagelen = web.maxshortchanges |
|
503 | 503 | pos = fctx.filerev() |
|
504 | 504 | start = max(0, pos - pagelen + 1) |
@@ -579,7 +579,7 b' def graph(web, req, tmpl):' | |||
|
579 | 579 | rev = webutil.changectx(web.repo, req).rev() |
|
580 | 580 | bg_height = 39 |
|
581 | 581 | |
|
582 |
max_rev = web.repo |
|
|
582 | max_rev = len(web.repo) - 1 | |
|
583 | 583 | revcount = min(max_rev, int(req.form.get('revcount', [25])[0])) |
|
584 | 584 | revnode = web.repo.changelog.node(rev) |
|
585 | 585 | revnode_hex = hex(revnode) |
@@ -588,7 +588,7 b' def graph(web, req, tmpl):' | |||
|
588 | 588 | lessrev = max(0, rev - revcount / 2) |
|
589 | 589 | |
|
590 | 590 | maxchanges = web.maxshortchanges or web.maxchanges |
|
591 |
count = web.repo |
|
|
591 | count = len(web.repo) | |
|
592 | 592 | changenav = webutil.revnavgen(rev, maxchanges, count, web.repo.changectx) |
|
593 | 593 | |
|
594 | 594 | tree = list(graphmod.graph(web.repo, rev, rev - revcount)) |
@@ -112,12 +112,11 b' def cleanpath(repo, path):' | |||
|
112 | 112 | return util.canonpath(repo.root, '', path) |
|
113 | 113 | |
|
114 | 114 | def changectx(repo, req): |
|
115 | changeid = "tip" | |
|
115 | 116 | if 'node' in req.form: |
|
116 | 117 | changeid = req.form['node'][0] |
|
117 | 118 | elif 'manifest' in req.form: |
|
118 | 119 | changeid = req.form['manifest'][0] |
|
119 | else: | |
|
120 | changeid = repo.changelog.count() - 1 | |
|
121 | 120 | |
|
122 | 121 | try: |
|
123 | 122 | ctx = repo[changeid] |
@@ -122,6 +122,16 b' class localrepository(repo.repository):' | |||
|
122 | 122 | return context.workingctx(self) |
|
123 | 123 | return context.changectx(self, changeid) |
|
124 | 124 | |
|
125 | def __nonzero__(self): | |
|
126 | return True | |
|
127 | ||
|
128 | def __len__(self): | |
|
129 | return len(self.changelog) | |
|
130 | ||
|
131 | def __iter__(self): | |
|
132 | for i in xrange(len(self)): | |
|
133 | yield i | |
|
134 | ||
|
125 | 135 | def url(self): |
|
126 | 136 | return 'file:' + self.root |
|
127 | 137 | |
@@ -368,7 +378,7 b' class localrepository(repo.repository):' | |||
|
368 | 378 | return self.nodetagscache.get(node, []) |
|
369 | 379 | |
|
370 | 380 | def _branchtags(self, partial, lrev): |
|
371 |
tiprev = self |
|
|
381 | tiprev = len(self) - 1 | |
|
372 | 382 | if lrev != tiprev: |
|
373 | 383 | self._updatebranchcache(partial, lrev+1, tiprev+1) |
|
374 | 384 | self._writebranchcache(partial, self.changelog.tip(), tiprev) |
@@ -413,8 +423,7 b' class localrepository(repo.repository):' | |||
|
413 | 423 | try: |
|
414 | 424 | last, lrev = lines.pop(0).split(" ", 1) |
|
415 | 425 | last, lrev = bin(last), int(lrev) |
|
416 | if not (lrev < self.changelog.count() and | |
|
417 | self.changelog.node(lrev) == last): # sanity check | |
|
426 | if lrev >= len(self) or self[lrev].node() != last: | |
|
418 | 427 | # invalidate the cache |
|
419 | 428 | raise ValueError('invalidating branch cache (tip differs)') |
|
420 | 429 | for l in lines: |
@@ -834,7 +843,7 b' class localrepository(repo.repository):' | |||
|
834 | 843 | # check in files |
|
835 | 844 | new = {} |
|
836 | 845 | changed = [] |
|
837 |
linkrev = self |
|
|
846 | linkrev = len(self) | |
|
838 | 847 | commit.sort() |
|
839 | 848 | for f in commit: |
|
840 | 849 | self.ui.note(f + "\n") |
@@ -1638,7 +1647,7 b' class localrepository(repo.repository):' | |||
|
1638 | 1647 | # Nor do we know which filenodes are missing. |
|
1639 | 1648 | msng_filenode_set = {} |
|
1640 | 1649 | |
|
1641 |
junk = mnfst.index[mnfst |
|
|
1650 | junk = mnfst.index[len(mnfst) - 1] # Get around a bug in lazyindex | |
|
1642 | 1651 | junk = None |
|
1643 | 1652 | |
|
1644 | 1653 | # A changeset always belongs to itself, so the changenode lookup |
@@ -1838,7 +1847,7 b' class localrepository(repo.repository):' | |||
|
1838 | 1847 | # Go through all our files in order sorted by name. |
|
1839 | 1848 | for fname in changedfiles: |
|
1840 | 1849 | filerevlog = self.file(fname) |
|
1841 |
if filerevlog |
|
|
1850 | if not len(filerevlog): | |
|
1842 | 1851 | raise util.Abort(_("empty or missing revlog for %s") % fname) |
|
1843 | 1852 | # Toss out the filenodes that the recipient isn't really |
|
1844 | 1853 | # missing. |
@@ -1889,10 +1898,10 b' class localrepository(repo.repository):' | |||
|
1889 | 1898 | def identity(x): |
|
1890 | 1899 | return x |
|
1891 | 1900 | |
|
1892 |
def gennodelst( |
|
|
1893 |
for r in |
|
|
1894 |
n = |
|
|
1895 |
if |
|
|
1901 | def gennodelst(log): | |
|
1902 | for r in log: | |
|
1903 | n = log.node(r) | |
|
1904 | if log.linkrev(n) in revset: | |
|
1896 | 1905 | yield n |
|
1897 | 1906 | |
|
1898 | 1907 | def changed_file_collector(changedfileset): |
@@ -1924,7 +1933,7 b' class localrepository(repo.repository):' | |||
|
1924 | 1933 | |
|
1925 | 1934 | for fname in changedfiles: |
|
1926 | 1935 | filerevlog = self.file(fname) |
|
1927 |
if filerevlog |
|
|
1936 | if not len(filerevlog): | |
|
1928 | 1937 | raise util.Abort(_("empty or missing revlog for %s") % fname) |
|
1929 | 1938 | nodeiter = gennodelst(filerevlog) |
|
1930 | 1939 | nodeiter = list(nodeiter) |
@@ -1953,7 +1962,7 b' class localrepository(repo.repository):' | |||
|
1953 | 1962 | """ |
|
1954 | 1963 | def csmap(x): |
|
1955 | 1964 | self.ui.debug(_("add changeset %s\n") % short(x)) |
|
1956 |
return cl |
|
|
1965 | return len(cl) | |
|
1957 | 1966 | |
|
1958 | 1967 | def revmap(x): |
|
1959 | 1968 | return cl.rev(x) |
@@ -1976,11 +1985,11 b' class localrepository(repo.repository):' | |||
|
1976 | 1985 | trp = weakref.proxy(tr) |
|
1977 | 1986 | # pull off the changeset group |
|
1978 | 1987 | self.ui.status(_("adding changesets\n")) |
|
1979 |
cor = cl |
|
|
1988 | cor = len(cl) - 1 | |
|
1980 | 1989 | chunkiter = changegroup.chunkiter(source) |
|
1981 | 1990 | if cl.addgroup(chunkiter, csmap, trp) is None and not emptyok: |
|
1982 | 1991 | raise util.Abort(_("received changelog group is empty")) |
|
1983 |
cnr = cl |
|
|
1992 | cnr = len(cl) - 1 | |
|
1984 | 1993 | changesets = cnr - cor |
|
1985 | 1994 | |
|
1986 | 1995 | # pull off the manifest group |
@@ -2000,11 +2009,11 b' class localrepository(repo.repository):' | |||
|
2000 | 2009 | break |
|
2001 | 2010 | self.ui.debug(_("adding %s revisions\n") % f) |
|
2002 | 2011 | fl = self.file(f) |
|
2003 |
o = fl |
|
|
2012 | o = len(fl) | |
|
2004 | 2013 | chunkiter = changegroup.chunkiter(source) |
|
2005 | 2014 | if fl.addgroup(chunkiter, revmap, trp) is None: |
|
2006 | 2015 | raise util.Abort(_("received file revlog group is empty")) |
|
2007 |
revisions += fl |
|
|
2016 | revisions += len(fl) - o | |
|
2008 | 2017 | files += 1 |
|
2009 | 2018 | |
|
2010 | 2019 | # make changelog see real files again |
@@ -23,7 +23,7 b' def _collectfiles(repo, striprev):' | |||
|
23 | 23 | """find out the filelogs affected by the strip""" |
|
24 | 24 | files = {} |
|
25 | 25 | |
|
26 |
for x in xrange(striprev, repo |
|
|
26 | for x in xrange(striprev, len(repo)): | |
|
27 | 27 | for name in repo[x].files(): |
|
28 | 28 | if name in files: |
|
29 | 29 | continue |
@@ -37,7 +37,7 b' def _collectextranodes(repo, files, link' | |||
|
37 | 37 | """return the nodes that have to be saved before the strip""" |
|
38 | 38 | def collectone(revlog): |
|
39 | 39 | extra = [] |
|
40 |
startrev = count = revlog |
|
|
40 | startrev = count = len(revlog) | |
|
41 | 41 | # find the truncation point of the revlog |
|
42 | 42 | for i in xrange(0, count): |
|
43 | 43 | node = revlog.node(i) |
@@ -84,7 +84,7 b' def strip(ui, repo, node, backup="all"):' | |||
|
84 | 84 | tostrip = {striprev: 1} |
|
85 | 85 | saveheads = {} |
|
86 | 86 | savebases = [] |
|
87 |
for r in xrange(striprev + 1, cl |
|
|
87 | for r in xrange(striprev + 1, len(cl)): | |
|
88 | 88 | parents = cl.parentrevs(r) |
|
89 | 89 | if parents[0] in tostrip or parents[1] in tostrip: |
|
90 | 90 | # r is a descendant of striprev |
@@ -515,9 +515,11 b' class revlog(object):' | |||
|
515 | 515 | |
|
516 | 516 | def tip(self): |
|
517 | 517 | return self.node(len(self.index) - 2) |
|
518 |
def |
|
|
518 | def __len__(self): | |
|
519 | 519 | return len(self.index) - 1 |
|
520 | ||
|
520 | def __iter__(self): | |
|
521 | for i in xrange(len(self)): | |
|
522 | yield i | |
|
521 | 523 | def rev(self, node): |
|
522 | 524 | try: |
|
523 | 525 | return self.nodemap[node] |
@@ -620,12 +622,11 b' class revlog(object):' | |||
|
620 | 622 | lowestrev = nullrev |
|
621 | 623 | if (lowestrev == nullrev) and (heads is None): |
|
622 | 624 | # We want _all_ the nodes! |
|
623 |
return ([self.node(r) for r in |
|
|
624 | [nullid], list(self.heads())) | |
|
625 | return ([self.node(r) for r in self], [nullid], list(self.heads())) | |
|
625 | 626 | if heads is None: |
|
626 | 627 | # All nodes are ancestors, so the latest ancestor is the last |
|
627 | 628 | # node. |
|
628 |
highestrev = self |
|
|
629 | highestrev = len(self) - 1 | |
|
629 | 630 | # Set ancestors to None to signal that every node is an ancestor. |
|
630 | 631 | ancestors = None |
|
631 | 632 | # Set heads to an empty dictionary for later discovery of heads |
@@ -754,15 +755,15 b' class revlog(object):' | |||
|
754 | 755 | as if they had no children |
|
755 | 756 | """ |
|
756 | 757 | if start is None and stop is None: |
|
757 |
count = self |
|
|
758 | count = len(self) | |
|
758 | 759 | if not count: |
|
759 | 760 | return [nullid] |
|
760 | 761 | ishead = [1] * (count + 1) |
|
761 | 762 | index = self.index |
|
762 |
for r in |
|
|
763 | for r in self: | |
|
763 | 764 | e = index[r] |
|
764 | 765 | ishead[e[5]] = ishead[e[6]] = 0 |
|
765 |
return [self.node(r) for r in |
|
|
766 | return [self.node(r) for r in self if ishead[r]] | |
|
766 | 767 | |
|
767 | 768 | if start is None: |
|
768 | 769 | start = nullid |
@@ -774,7 +775,7 b' class revlog(object):' | |||
|
774 | 775 | heads = {startrev: 1} |
|
775 | 776 | |
|
776 | 777 | parentrevs = self.parentrevs |
|
777 |
for r in xrange(startrev + 1, self |
|
|
778 | for r in xrange(startrev + 1, len(self)): | |
|
778 | 779 | for p in parentrevs(r): |
|
779 | 780 | if p in reachable: |
|
780 | 781 | if r not in stoprevs: |
@@ -789,7 +790,7 b' class revlog(object):' | |||
|
789 | 790 | """find the children of a given node""" |
|
790 | 791 | c = [] |
|
791 | 792 | p = self.rev(node) |
|
792 |
for r in range(p + 1, self |
|
|
793 | for r in range(p + 1, len(self)): | |
|
793 | 794 | prevs = [pr for pr in self.parentrevs(r) if pr != nullrev] |
|
794 | 795 | if prevs: |
|
795 | 796 | for pr in prevs: |
@@ -818,8 +819,8 b' class revlog(object):' | |||
|
818 | 819 | if str(rev) != id: |
|
819 | 820 | raise ValueError |
|
820 | 821 | if rev < 0: |
|
821 |
rev = self |
|
|
822 |
if rev < 0 or rev >= self |
|
|
822 | rev = len(self) + rev | |
|
823 | if rev < 0 or rev >= len(self): | |
|
823 | 824 | raise ValueError |
|
824 | 825 | return self.node(rev) |
|
825 | 826 | except (ValueError, OverflowError): |
@@ -982,7 +983,7 b' class revlog(object):' | |||
|
982 | 983 | df = self.opener(self.datafile, 'w') |
|
983 | 984 | try: |
|
984 | 985 | calc = self._io.size |
|
985 |
for r in |
|
|
986 | for r in self: | |
|
986 | 987 | start = self.start(r) + (r + 1) * calc |
|
987 | 988 | length = self.length(r) |
|
988 | 989 | fp.seek(start) |
@@ -995,7 +996,7 b' class revlog(object):' | |||
|
995 | 996 | fp = self.opener(self.indexfile, 'w', atomictemp=True) |
|
996 | 997 | self.version &= ~(REVLOGNGINLINEDATA) |
|
997 | 998 | self._inline = False |
|
998 |
for i in |
|
|
999 | for i in self: | |
|
999 | 1000 | e = self._io.packentry(self.index[i], self.node, self.version, i) |
|
1000 | 1001 | fp.write(e) |
|
1001 | 1002 | |
@@ -1031,7 +1032,7 b' class revlog(object):' | |||
|
1031 | 1032 | if node in self.nodemap: |
|
1032 | 1033 | return node |
|
1033 | 1034 | |
|
1034 |
curr = self |
|
|
1035 | curr = len(self) | |
|
1035 | 1036 | prev = curr - 1 |
|
1036 | 1037 | base = self.base(prev) |
|
1037 | 1038 | offset = self.end(prev) |
@@ -1146,7 +1147,7 b' class revlog(object):' | |||
|
1146 | 1147 | """ |
|
1147 | 1148 | |
|
1148 | 1149 | #track the base of the current delta log |
|
1149 |
r = self |
|
|
1150 | r = len(self) | |
|
1150 | 1151 | t = r - 1 |
|
1151 | 1152 | node = None |
|
1152 | 1153 | |
@@ -1265,13 +1266,13 b' class revlog(object):' | |||
|
1265 | 1266 | trust that the caller has saved the revisions that shouldn't be |
|
1266 | 1267 | removed and that it'll readd them after this truncation. |
|
1267 | 1268 | """ |
|
1268 |
if self |
|
|
1269 | if len(self) == 0: | |
|
1269 | 1270 | return |
|
1270 | 1271 | |
|
1271 | 1272 | if isinstance(self.index, lazyindex): |
|
1272 | 1273 | self._loadindexmap() |
|
1273 | 1274 | |
|
1274 |
for rev in |
|
|
1275 | for rev in self: | |
|
1275 | 1276 | if self.index[rev][4] >= minlink: |
|
1276 | 1277 | break |
|
1277 | 1278 | else: |
@@ -1292,15 +1293,15 b' class revlog(object):' | |||
|
1292 | 1293 | # then reset internal state in memory to forget those revisions |
|
1293 | 1294 | self._cache = None |
|
1294 | 1295 | self._chunkcache = None |
|
1295 |
for x in xrange(rev, self |
|
|
1296 | for x in xrange(rev, len(self)): | |
|
1296 | 1297 | del self.nodemap[self.node(x)] |
|
1297 | 1298 | |
|
1298 | 1299 | del self.index[rev:-1] |
|
1299 | 1300 | |
|
1300 | 1301 | def checksize(self): |
|
1301 | 1302 | expected = 0 |
|
1302 |
if self |
|
|
1303 |
expected = max(0, self.end(self |
|
|
1303 | if len(self): | |
|
1304 | expected = max(0, self.end(len(self) - 1)) | |
|
1304 | 1305 | |
|
1305 | 1306 | try: |
|
1306 | 1307 | f = self.opener(self.datafile) |
@@ -1321,10 +1322,10 b' class revlog(object):' | |||
|
1321 | 1322 | di = actual - (i * s) |
|
1322 | 1323 | if self._inline: |
|
1323 | 1324 | databytes = 0 |
|
1324 |
for r in |
|
|
1325 | for r in self: | |
|
1325 | 1326 | databytes += max(0, self.length(r)) |
|
1326 | 1327 | dd = 0 |
|
1327 |
di = actual - self |
|
|
1328 | di = actual - len(self) * s - databytes | |
|
1328 | 1329 | except IOError, inst: |
|
1329 | 1330 | if inst.errno != errno.ENOENT: |
|
1330 | 1331 | raise |
@@ -65,13 +65,13 b' def _verify(repo):' | |||
|
65 | 65 | havecl = havemf = 1 |
|
66 | 66 | seen = {} |
|
67 | 67 | repo.ui.status(_("checking changesets\n")) |
|
68 | if repo.changelog.count() == 0 and repo.manifest.count() > 1: | |
|
68 | if not len(repo) and len(repo.manifest): | |
|
69 | 69 | havecl = 0 |
|
70 | 70 | err(0, _("empty or missing 00changelog.i")) |
|
71 | 71 | else: |
|
72 | 72 | checksize(repo.changelog, "changelog") |
|
73 | 73 | |
|
74 | for i in xrange(repo.changelog.count()): | |
|
74 | for i in repo: | |
|
75 | 75 | changesets += 1 |
|
76 | 76 | n = repo.changelog.node(i) |
|
77 | 77 | l = repo.changelog.linkrev(n) |
@@ -101,18 +101,18 b' def _verify(repo):' | |||
|
101 | 101 | |
|
102 | 102 | seen = {} |
|
103 | 103 | repo.ui.status(_("checking manifests\n")) |
|
104 | if repo.changelog.count() > 0 and repo.manifest.count() == 0: | |
|
104 | if len(repo) and not len(repo.manifest): | |
|
105 | 105 | havemf = 0 |
|
106 | 106 | err(0, _("empty or missing 00manifest.i")) |
|
107 | 107 | else: |
|
108 | 108 | checkversion(repo.manifest, "manifest") |
|
109 | 109 | checksize(repo.manifest, "manifest") |
|
110 | 110 | |
|
111 |
for i in |
|
|
111 | for i in repo.manifest: | |
|
112 | 112 | n = repo.manifest.node(i) |
|
113 | 113 | l = repo.manifest.linkrev(n) |
|
114 | 114 | |
|
115 |
if l < 0 or (havecl and l >= repo |
|
|
115 | if l < 0 or (havecl and l >= len(repo)): | |
|
116 | 116 | err(None, _("bad link (%d) at manifest revision %d") % (l, i)) |
|
117 | 117 | |
|
118 | 118 | if n in neededmanifests: |
@@ -182,19 +182,19 b' def _verify(repo):' | |||
|
182 | 182 | checkversion(fl, f) |
|
183 | 183 | checksize(fl, f) |
|
184 | 184 | |
|
185 |
if fl |
|
|
185 | if not len(fl): | |
|
186 | 186 | err(filelinkrevs[f][0], _("empty or missing revlog"), f) |
|
187 | 187 | continue |
|
188 | 188 | |
|
189 | 189 | seen = {} |
|
190 | 190 | nodes = {nullid: 1} |
|
191 |
for i in |
|
|
191 | for i in fl: | |
|
192 | 192 | revisions += 1 |
|
193 | 193 | n = fl.node(i) |
|
194 | 194 | flr = fl.linkrev(n) |
|
195 | 195 | |
|
196 | 196 | if flr < 0 or (havecl and flr not in filelinkrevs.get(f, [])): |
|
197 |
if flr < 0 or flr >= repo |
|
|
197 | if flr < 0 or flr >= len(repo): | |
|
198 | 198 | err(None, _("rev %d point to nonexistent changeset %d") |
|
199 | 199 | % (i, flr), f) |
|
200 | 200 | else: |
@@ -245,7 +245,7 b' def _verify(repo):' | |||
|
245 | 245 | rp = fl.renamed(n) |
|
246 | 246 | if rp: |
|
247 | 247 | fl2 = repo.file(rp[0]) |
|
248 |
if fl2 |
|
|
248 | if not len(fl2): | |
|
249 | 249 | err(flr, _("empty or missing copy source revlog %s:%s") |
|
250 | 250 | % (rp[0], short(rp[1])), f) |
|
251 | 251 | elif rp[1] == nullid: |
General Comments 0
You need to be logged in to leave comments.
Login now