Show More
@@ -80,8 +80,8 b' def dodiff(ui, repo, diffcmd, pats, opts' | |||
|
80 | 80 | |
|
81 | 81 | node1, node2 = commands.revpair(ui, repo, opts['rev']) |
|
82 | 82 | files, matchfn, anypats = commands.matchpats(repo, pats, opts) |
|
83 |
modified, added, removed, deleted, unknown = repo. |
|
|
84 | node1, node2, files, match=matchfn) | |
|
83 | modified, added, removed, deleted, unknown = repo.status( | |
|
84 | node1, node2, files, match=matchfn)[:5] | |
|
85 | 85 | if not (modified or added or removed): |
|
86 | 86 | return 0 |
|
87 | 87 |
@@ -221,7 +221,7 b' def sign(ui, repo, *revs, **opts):' | |||
|
221 | 221 | repo.opener("localsigs", "ab").write(sigmessage) |
|
222 | 222 | return |
|
223 | 223 | |
|
224 |
for x in repo. |
|
|
224 | for x in repo.status()[:5]: | |
|
225 | 225 | if ".hgsigs" in x and not opts["force"]: |
|
226 | 226 | raise util.Abort(_("working copy of .hgsigs is changed " |
|
227 | 227 | "(please commit .hgsigs manually " |
@@ -23,10 +23,10 b' def lookup_rev(ui, repo, rev=None):' | |||
|
23 | 23 | return parents.pop() |
|
24 | 24 | |
|
25 | 25 | def check_clean(ui, repo): |
|
26 |
|
|
|
27 |
|
|
|
28 |
|
|
|
29 |
|
|
|
26 | modified, added, removed, deleted, unknown = repo.status()[:5] | |
|
27 | if modified or added or removed: | |
|
28 | ui.warn("Repository is not clean, please commit or revert\n") | |
|
29 | sys.exit(1) | |
|
30 | 30 | |
|
31 | 31 | class bisect(object): |
|
32 | 32 | """dichotomic search in the DAG of changesets""" |
@@ -14,7 +14,7 b' def dodiff(fp, ui, repo, node1, node2, f' | |||
|
14 | 14 | return time.asctime(time.gmtime(c[2][0])) |
|
15 | 15 | |
|
16 | 16 | if not changes: |
|
17 |
changes = repo. |
|
|
17 | changes = repo.status(node1, node2, files, match=match)[:5] | |
|
18 | 18 | modified, added, removed, deleted, unknown = changes |
|
19 | 19 | if files: |
|
20 | 20 | modified, added, removed = map(lambda x: filterfiles(files, x), |
@@ -67,12 +67,12 b' def difftree(ui, repo, node1=None, node2' | |||
|
67 | 67 | if node2: |
|
68 | 68 | change = repo.changelog.read(node2) |
|
69 | 69 | mmap2 = repo.manifest.read(change[0]) |
|
70 |
modified, added, removed, deleted, unknown = repo. |
|
|
70 | modified, added, removed, deleted, unknown = repo.status(node1, node2)[:5] | |
|
71 | 71 | def read(f): return repo.file(f).read(mmap2[f]) |
|
72 | 72 | date2 = date(change) |
|
73 | 73 | else: |
|
74 | 74 | date2 = time.asctime() |
|
75 |
modified, added, removed, deleted, unknown = repo. |
|
|
75 | modified, added, removed, deleted, unknown = repo.status(node1)[:5] | |
|
76 | 76 | if not node1: |
|
77 | 77 | node1 = repo.dirstate.parents()[0] |
|
78 | 78 | def read(f): return file(os.path.join(repo.root, f)).read() |
@@ -533,19 +533,20 b' class queue:' | |||
|
533 | 533 | raise util.Abort(_("queue top not at same revision as working directory")) |
|
534 | 534 | return top |
|
535 | 535 | return None |
|
536 | def check_localchanges(self, repo): | |
|
537 |
|
|
|
538 |
if |
|
|
539 | raise util.Abort(_("local changes found, refresh first")) | |
|
536 | def check_localchanges(self, repo, force=False, refresh=True): | |
|
537 | m, a, r, d = repo.status()[:4] | |
|
538 | if m or a or r or d: | |
|
539 | if not force: | |
|
540 | if refresh: | |
|
541 | raise util.Abort(_("local changes found, refresh first")) | |
|
542 | else: | |
|
543 | raise util.Abort(_("local changes found")) | |
|
544 | return m, a, r, d | |
|
540 | 545 | def new(self, repo, patch, msg=None, force=None): |
|
541 | 546 | if os.path.exists(self.join(patch)): |
|
542 | 547 | raise util.Abort(_('patch "%s" already exists') % patch) |
|
543 | commitfiles = [] | |
|
544 | (c, a, r, d, u) = repo.changes(None, None) | |
|
545 | if c or a or d or r: | |
|
546 | if not force: | |
|
547 | raise util.Abort(_("local changes found, refresh first")) | |
|
548 | commitfiles = c + a + r | |
|
548 | m, a, r, d = self.check_localchanges(repo, force) | |
|
549 | commitfiles = m + a + r | |
|
549 | 550 | self.check_toppatch(repo) |
|
550 | 551 | wlock = repo.wlock() |
|
551 | 552 | insert = self.full_series_end() |
@@ -659,9 +660,7 b' class queue:' | |||
|
659 | 660 | revnum = chlog.rev(rev) |
|
660 | 661 | |
|
661 | 662 | if update: |
|
662 | (c, a, r, d, u) = repo.changes(None, None) | |
|
663 | if c or a or d or r: | |
|
664 | raise util.Abort(_("local changes found")) | |
|
663 | self.check_localchanges(repo, refresh=False) | |
|
665 | 664 | urev = self.qparents(repo, rev) |
|
666 | 665 | hg.clean(repo, urev, wlock=wlock) |
|
667 | 666 | repo.dirstate.write() |
@@ -899,15 +898,15 b' class queue:' | |||
|
899 | 898 | qp = self.qparents(repo, rev) |
|
900 | 899 | changes = repo.changelog.read(qp) |
|
901 | 900 | mmap = repo.manifest.read(changes[0]) |
|
902 |
|
|
|
901 | m, a, r, d, u = repo.status(qp, top)[:5] | |
|
903 | 902 | if d: |
|
904 | 903 | raise util.Abort("deletions found between repo revs") |
|
905 |
for f in |
|
|
904 | for f in m: | |
|
906 | 905 | getfile(f, mmap[f]) |
|
907 | 906 | for f in r: |
|
908 | 907 | getfile(f, mmap[f]) |
|
909 | 908 | util.set_exec(repo.wjoin(f), mmap.execf(f)) |
|
910 |
repo.dirstate.update( |
|
|
909 | repo.dirstate.update(m + r, 'n') | |
|
911 | 910 | for f in a: |
|
912 | 911 | try: os.unlink(repo.wjoin(f)) |
|
913 | 912 | except: raise |
@@ -970,30 +969,30 b' class queue:' | |||
|
970 | 969 | # patch already |
|
971 | 970 | # |
|
972 | 971 | # this should really read: |
|
973 |
# |
|
|
972 | # mm, dd, aa, aa2, uu = repo.status(tip, patchparent)[:5] | |
|
974 | 973 | # but we do it backwards to take advantage of manifest/chlog |
|
975 |
# caching against the next repo. |
|
|
974 | # caching against the next repo.status call | |
|
976 | 975 | # |
|
977 |
|
|
|
976 | mm, aa, dd, aa2, uu = repo.status(patchparent, tip)[:5] | |
|
978 | 977 | if short: |
|
979 |
filelist = |
|
|
978 | filelist = mm + aa + dd | |
|
980 | 979 | else: |
|
981 | 980 | filelist = None |
|
982 |
|
|
|
981 | m, a, r, d, u = repo.status(files=filelist)[:5] | |
|
983 | 982 | |
|
984 | 983 | # we might end up with files that were added between tip and |
|
985 | 984 | # the dirstate parent, but then changed in the local dirstate. |
|
986 | 985 | # in this case, we want them to only show up in the added section |
|
987 |
for x in |
|
|
986 | for x in m: | |
|
988 | 987 | if x not in aa: |
|
989 |
|
|
|
988 | mm.append(x) | |
|
990 | 989 | # we might end up with files added by the local dirstate that |
|
991 | 990 | # were deleted by the patch. In this case, they should only |
|
992 | 991 | # show up in the changed section. |
|
993 | 992 | for x in a: |
|
994 | 993 | if x in dd: |
|
995 | 994 | del dd[dd.index(x)] |
|
996 |
|
|
|
995 | mm.append(x) | |
|
997 | 996 | else: |
|
998 | 997 | aa.append(x) |
|
999 | 998 | # make sure any files deleted in the local dirstate |
@@ -1004,23 +1003,23 b' class queue:' | |||
|
1004 | 1003 | del aa[aa.index(x)] |
|
1005 | 1004 | forget.append(x) |
|
1006 | 1005 | continue |
|
1007 |
elif x in |
|
|
1008 |
del |
|
|
1006 | elif x in mm: | |
|
1007 | del mm[mm.index(x)] | |
|
1009 | 1008 | dd.append(x) |
|
1010 | 1009 | |
|
1011 |
|
|
|
1010 | m = list(util.unique(mm)) | |
|
1012 | 1011 | r = list(util.unique(dd)) |
|
1013 | 1012 | a = list(util.unique(aa)) |
|
1014 |
filelist = list(util.unique( |
|
|
1013 | filelist = list(util.unique(m + r + a)) | |
|
1015 | 1014 | self.printdiff(repo, patchparent, files=filelist, |
|
1016 |
changes=( |
|
|
1015 | changes=(m, a, r, [], u), fp=patchf) | |
|
1017 | 1016 | patchf.close() |
|
1018 | 1017 | |
|
1019 | 1018 | changes = repo.changelog.read(tip) |
|
1020 | 1019 | repo.dirstate.setparents(*cparents) |
|
1021 | 1020 | repo.dirstate.update(a, 'a') |
|
1022 | 1021 | repo.dirstate.update(r, 'r') |
|
1023 |
repo.dirstate.update( |
|
|
1022 | repo.dirstate.update(m, 'n') | |
|
1024 | 1023 | repo.dirstate.forget(forget) |
|
1025 | 1024 | |
|
1026 | 1025 | if not msg: |
@@ -21,7 +21,7 b' class AmbiguousCommand(Exception):' | |||
|
21 | 21 | """Exception raised if command shortcut matches more than one command.""" |
|
22 | 22 | |
|
23 | 23 | def bail_if_changed(repo): |
|
24 |
modified, added, removed, deleted |
|
|
24 | modified, added, removed, deleted = repo.status()[:4] | |
|
25 | 25 | if modified or added or removed or deleted: |
|
26 | 26 | raise util.Abort(_("outstanding uncommitted changes")) |
|
27 | 27 | |
@@ -443,7 +443,7 b' class changeset_printer(object):' | |||
|
443 | 443 | self.ui.status(_("date: %s\n") % date) |
|
444 | 444 | |
|
445 | 445 | if self.ui.debugflag: |
|
446 |
files = self.repo. |
|
|
446 | files = self.repo.status(log.parents(changenode)[0], changenode)[:3] | |
|
447 | 447 | for key, value in zip([_("files:"), _("files+:"), _("files-:")], |
|
448 | 448 | files): |
|
449 | 449 | if value: |
@@ -969,8 +969,7 b' def commit(ui, repo, *pats, **opts):' | |||
|
969 | 969 | addremove_lock(ui, repo, pats, opts) |
|
970 | 970 | fns, match, anypats = matchpats(repo, pats, opts) |
|
971 | 971 | if pats: |
|
972 | modified, added, removed, deleted, unknown = ( | |
|
973 | repo.changes(files=fns, match=match)) | |
|
972 | modified, added, removed = repo.status(files=fns, match=match)[:3] | |
|
974 | 973 | files = modified + added + removed |
|
975 | 974 | else: |
|
976 | 975 | files = [] |
@@ -1636,7 +1635,7 b' def identify(ui, repo):' | |||
|
1636 | 1635 | return |
|
1637 | 1636 | |
|
1638 | 1637 | hexfunc = ui.verbose and hex or short |
|
1639 |
modified, added, removed, deleted |
|
|
1638 | modified, added, removed, deleted = repo.status()[:4] | |
|
1640 | 1639 | output = ["%s%s" % |
|
1641 | 1640 | ('+'.join([hexfunc(parent) for parent in parents]), |
|
1642 | 1641 | (modified or added or removed or deleted) and "+" or "")] |
@@ -2247,7 +2246,7 b' def remove(ui, repo, *pats, **opts):' | |||
|
2247 | 2246 | raise util.Abort(_('no files specified')) |
|
2248 | 2247 | files, matchfn, anypats = matchpats(repo, pats, opts) |
|
2249 | 2248 | exact = dict.fromkeys(files) |
|
2250 |
mardu = map(dict.fromkeys, repo. |
|
|
2249 | mardu = map(dict.fromkeys, repo.status(files=files, match=matchfn))[:5] | |
|
2251 | 2250 | modified, added, removed, deleted, unknown = mardu |
|
2252 | 2251 | remove, forget = [], [] |
|
2253 | 2252 | for src, abs, rel, exact in walk(repo, pats, opts): |
@@ -2370,7 +2369,7 b' def revert(ui, repo, *pats, **opts):' | |||
|
2370 | 2369 | names[abs] = (rel, exact) |
|
2371 | 2370 | target_only[abs] = True |
|
2372 | 2371 | |
|
2373 |
changes = repo. |
|
|
2372 | changes = repo.status(match=names.has_key, wlock=wlock)[:5] | |
|
2374 | 2373 | modified, added, removed, deleted, unknown = map(dict.fromkeys, changes) |
|
2375 | 2374 | |
|
2376 | 2375 | revert = ([], _('reverting %s\n')) |
@@ -198,7 +198,7 b' class localrepository(repo.repository):' | |||
|
198 | 198 | self.hook('tag', node=node, tag=name, local=local) |
|
199 | 199 | return |
|
200 | 200 | |
|
201 |
for x in self. |
|
|
201 | for x in self.status()[:5]: | |
|
202 | 202 | if '.hgtags' in x: |
|
203 | 203 | raise util.Abort(_('working copy of .hgtags is changed ' |
|
204 | 204 | '(please commit .hgtags manually)')) |
@@ -532,7 +532,7 b' class localrepository(repo.repository):' | |||
|
532 | 532 | else: |
|
533 | 533 | self.ui.warn(_("%s not tracked!\n") % f) |
|
534 | 534 | else: |
|
535 |
modified, added, removed, deleted, unknown = self. |
|
|
535 | modified, added, removed, deleted, unknown = self.status(match=match)[:5] | |
|
536 | 536 | commit = modified + added |
|
537 | 537 | remove = removed |
|
538 | 538 | |
@@ -751,16 +751,6 b' class localrepository(repo.repository):' | |||
|
751 | 751 | l.sort() |
|
752 | 752 | return (modified, added, removed, deleted, unknown, ignored, clean) |
|
753 | 753 | |
|
754 | def changes(self, node1=None, node2=None, files=[], match=util.always, | |
|
755 | wlock=None, list_ignored=False, list_clean=False): | |
|
756 | '''DEPRECATED - use status instead''' | |
|
757 | marduit = self.status(node1, node2, files, match, wlock, | |
|
758 | list_ignored, list_clean) | |
|
759 | if list_ignored: | |
|
760 | return marduit[:-1] | |
|
761 | else: | |
|
762 | return marduit[:-2] | |
|
763 | ||
|
764 | 754 | def add(self, list, wlock=None): |
|
765 | 755 | if not wlock: |
|
766 | 756 | wlock = self.wlock() |
@@ -75,7 +75,7 b' def update(repo, node, branchmerge=False' | |||
|
75 | 75 | raise util.Abort(_("update spans branches, use 'hg merge' " |
|
76 | 76 | "or 'hg update -C' to lose changes")) |
|
77 | 77 | |
|
78 |
modified, added, removed, deleted, unknown = repo. |
|
|
78 | modified, added, removed, deleted, unknown = repo.status()[:5] | |
|
79 | 79 | if branchmerge and not forcemerge: |
|
80 | 80 | if modified or added or removed: |
|
81 | 81 | raise util.Abort(_("outstanding uncommitted changes")) |
@@ -267,13 +267,13 b' def diff(repo, node1=None, node2=None, f' | |||
|
267 | 267 | if not node1: |
|
268 | 268 | node1 = repo.dirstate.parents()[0] |
|
269 | 269 | # reading the data for node1 early allows it to play nicely |
|
270 |
# with repo. |
|
|
270 | # with repo.status and the revlog cache. | |
|
271 | 271 | change = repo.changelog.read(node1) |
|
272 | 272 | mmap = repo.manifest.read(change[0]) |
|
273 | 273 | date1 = util.datestr(change[2]) |
|
274 | 274 | |
|
275 | 275 | if not changes: |
|
276 |
changes = repo. |
|
|
276 | changes = repo.status(node1, node2, files, match=match)[:5] | |
|
277 | 277 | modified, added, removed, deleted, unknown = changes |
|
278 | 278 | if files: |
|
279 | 279 | def filterfiles(filters): |
@@ -459,7 +459,7 b' class changeset_templater(object):' | |||
|
459 | 459 | yield x |
|
460 | 460 | |
|
461 | 461 | if self.ui.debugflag: |
|
462 |
files = self.repo. |
|
|
462 | files = self.repo.status(log.parents(changenode)[0], changenode)[:3] | |
|
463 | 463 | def showfiles(**args): |
|
464 | 464 | for x in showlist('file', files[0], **args): yield x |
|
465 | 465 | def showadds(**args): |
General Comments 0
You need to be logged in to leave comments.
Login now