Mercurial > public > mercurial-scm > hg
comparison mercurial/commands.py @ 1757:23012d48ae91
merge with crew.
author | Vadim Gelfer <vadim.gelfer@gmail.com> |
---|---|
date | Mon, 20 Feb 2006 11:07:09 -0800 |
parents | f29857aaa053 a8f7791e3680 |
children | 7eb1934f83fb |
comparison
equal
deleted
inserted
replaced
1756:f29857aaa053 | 1757:23012d48ae91 |
---|---|
113 revs.reverse() | 113 revs.reverse() |
114 for rev in revs: | 114 for rev in revs: |
115 yield rev | 115 yield rev |
116 | 116 |
117 minrev, maxrev = min(revs), max(revs) | 117 minrev, maxrev = min(revs), max(revs) |
118 for file in files: | 118 for file_ in files: |
119 filelog = repo.file(file) | 119 filelog = repo.file(file_) |
120 # A zero count may be a directory or deleted file, so | 120 # A zero count may be a directory or deleted file, so |
121 # try to find matching entries on the slow path. | 121 # try to find matching entries on the slow path. |
122 if filelog.count() == 0: | 122 if filelog.count() == 0: |
123 slowpath = True | 123 slowpath = True |
124 break | 124 break |
125 for rev in filerevgen(filelog): | 125 for rev in filerevgen(filelog): |
126 if rev <= maxrev: | 126 if rev <= maxrev: |
127 if rev < minrev: | 127 if rev < minrev: |
128 break | 128 break |
129 fncache.setdefault(rev, []) | 129 fncache.setdefault(rev, []) |
130 fncache[rev].append(file) | 130 fncache[rev].append(file_) |
131 wanted[rev] = 1 | 131 wanted[rev] = 1 |
132 if slowpath: | 132 if slowpath: |
133 # The slow path checks files modified in every changeset. | 133 # The slow path checks files modified in every changeset. |
134 def changerevgen(): | 134 def changerevgen(): |
135 for i in xrange(repo.changelog.count() - 1, -1, -window): | 135 for i in xrange(repo.changelog.count() - 1, -1, -window): |
445 if cmd == "shortlist" and not f.startswith("^"): | 445 if cmd == "shortlist" and not f.startswith("^"): |
446 continue | 446 continue |
447 f = f.lstrip("^") | 447 f = f.lstrip("^") |
448 if not ui.debugflag and f.startswith("debug"): | 448 if not ui.debugflag and f.startswith("debug"): |
449 continue | 449 continue |
450 d = "" | |
451 doc = e[0].__doc__ | 450 doc = e[0].__doc__ |
452 if not doc: | 451 if not doc: |
453 doc = _("(No help text available)") | 452 doc = _("(No help text available)") |
454 h[f] = doc.splitlines(0)[0].rstrip() | 453 h[f] = doc.splitlines(0)[0].rstrip() |
455 cmds[f] = c.lstrip("^") | 454 cmds[f] = c.lstrip("^") |
723 try: | 722 try: |
724 # we use a lock here because if we race with commit, we | 723 # we use a lock here because if we race with commit, we |
725 # can end up with extra data in the cloned revlogs that's | 724 # can end up with extra data in the cloned revlogs that's |
726 # not pointed to by changesets, thus causing verify to | 725 # not pointed to by changesets, thus causing verify to |
727 # fail | 726 # fail |
728 l1 = lock.lock(os.path.join(source, ".hg", "lock")) | 727 l1 = other.lock() |
729 except OSError: | 728 except lock.LockException: |
730 copy = False | 729 copy = False |
731 | 730 |
732 if copy: | 731 if copy: |
733 # we lock here to avoid premature writing to the target | 732 # we lock here to avoid premature writing to the target |
734 os.mkdir(os.path.join(dest, ".hg")) | 733 os.mkdir(os.path.join(dest, ".hg")) |
984 """find the ancestor revision of two revisions in a given index""" | 983 """find the ancestor revision of two revisions in a given index""" |
985 r = revlog.revlog(util.opener(os.getcwd()), index, "") | 984 r = revlog.revlog(util.opener(os.getcwd()), index, "") |
986 a = r.ancestor(r.lookup(rev1), r.lookup(rev2)) | 985 a = r.ancestor(r.lookup(rev1), r.lookup(rev2)) |
987 ui.write("%d:%s\n" % (r.rev(a), hex(a))) | 986 ui.write("%d:%s\n" % (r.rev(a), hex(a))) |
988 | 987 |
988 def debugrebuildstate(ui, repo, rev=None): | |
989 """rebuild the dirstate as it would look like for the given revision""" | |
990 if not rev: | |
991 rev = repo.changelog.tip() | |
992 else: | |
993 rev = repo.lookup(rev) | |
994 change = repo.changelog.read(rev) | |
995 n = change[0] | |
996 files = repo.manifest.readflags(n) | |
997 wlock = self.repo.wlock() | |
998 repo.dirstate.rebuild(rev, files.iteritems()) | |
999 | |
989 def debugcheckstate(ui, repo): | 1000 def debugcheckstate(ui, repo): |
990 """validate the correctness of the current dirstate""" | 1001 """validate the correctness of the current dirstate""" |
991 parent1, parent2 = repo.dirstate.parents() | 1002 parent1, parent2 = repo.dirstate.parents() |
992 repo.dirstate.read() | 1003 repo.dirstate.read() |
993 dc = repo.dirstate.map | 1004 dc = repo.dirstate.map |
1288 m = matches[rev][fn] | 1299 m = matches[rev][fn] |
1289 for lnum, cstart, cend, line in matchlines(body): | 1300 for lnum, cstart, cend, line in matchlines(body): |
1290 s = linestate(line, lnum, cstart, cend) | 1301 s = linestate(line, lnum, cstart, cend) |
1291 m[s] = s | 1302 m[s] = s |
1292 | 1303 |
1304 # FIXME: prev isn't used, why ? | |
1293 prev = {} | 1305 prev = {} |
1294 ucache = {} | 1306 ucache = {} |
1295 def display(fn, rev, states, prevstates): | 1307 def display(fn, rev, states, prevstates): |
1296 diff = list(sets.Set(states).symmetric_difference(sets.Set(prevstates))) | 1308 diff = list(sets.Set(states).symmetric_difference(sets.Set(prevstates))) |
1297 diff.sort(lambda x, y: cmp(x.linenum, y.linenum)) | 1309 diff.sort(lambda x, y: cmp(x.linenum, y.linenum)) |
2371 ('A', 'after', None, _('record a copy that has already occurred')), | 2383 ('A', 'after', None, _('record a copy that has already occurred')), |
2372 ('f', 'force', None, | 2384 ('f', 'force', None, |
2373 _('forcibly copy over an existing managed file'))], | 2385 _('forcibly copy over an existing managed file'))], |
2374 _('hg copy [OPTION]... [SOURCE]... DEST')), | 2386 _('hg copy [OPTION]... [SOURCE]... DEST')), |
2375 "debugancestor": (debugancestor, [], _('debugancestor INDEX REV1 REV2')), | 2387 "debugancestor": (debugancestor, [], _('debugancestor INDEX REV1 REV2')), |
2388 "debugrebuildstate": | |
2389 (debugrebuildstate, | |
2390 [('r', 'rev', "", _("revision to rebuild to"))], | |
2391 _('debugrebuildstate [-r REV] [REV]')), | |
2376 "debugcheckstate": (debugcheckstate, [], _('debugcheckstate')), | 2392 "debugcheckstate": (debugcheckstate, [], _('debugcheckstate')), |
2377 "debugconfig": (debugconfig, [], _('debugconfig')), | 2393 "debugconfig": (debugconfig, [], _('debugconfig')), |
2378 "debugsetparents": (debugsetparents, [], _('debugsetparents REV1 [REV2]')), | 2394 "debugsetparents": (debugsetparents, [], _('debugsetparents REV1 [REV2]')), |
2379 "debugstate": (debugstate, [], _('debugstate')), | 2395 "debugstate": (debugstate, [], _('debugstate')), |
2380 "debugdata": (debugdata, [], _('debugdata FILE REV')), | 2396 "debugdata": (debugdata, [], _('debugdata FILE REV')), |