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