comparison mercurial/commands.py @ 2874:3d6efcbbd1c9

remove localrepository.changes. use localrepository.status instead.
author Vadim Gelfer <vadim.gelfer@gmail.com>
date Sat, 12 Aug 2006 16:40:12 -0700
parents 4ec58b157265
children 982c3237c63d
comparison
equal deleted inserted replaced
2873:4ec58b157265 2874:3d6efcbbd1c9
19 """Exception raised if command is not in the command table.""" 19 """Exception raised if command is not in the command table."""
20 class AmbiguousCommand(Exception): 20 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, unknown = repo.changes() 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
28 def relpath(repo, args): 28 def relpath(repo, args):
29 cwd = repo.getcwd() 29 cwd = repo.getcwd()
441 (self.repo.manifest.rev(changes[0]), hex(changes[0]))) 441 (self.repo.manifest.rev(changes[0]), hex(changes[0])))
442 self.ui.status(_("user: %s\n") % changes[1]) 442 self.ui.status(_("user: %s\n") % changes[1])
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.changes(log.parents(changenode)[0], changenode) 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:
450 self.ui.note("%-12s %s\n" % (key, " ".join(value))) 450 self.ui.note("%-12s %s\n" % (key, " ".join(value)))
451 else: 451 else:
967 967
968 if opts['addremove']: 968 if opts['addremove']:
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 = []
977 try: 976 try:
978 repo.commit(files, message, opts['user'], opts['date'], match, 977 repo.commit(files, message, opts['user'], opts['date'], match,
1634 if not parents: 1633 if not parents:
1635 ui.write(_("unknown\n")) 1634 ui.write(_("unknown\n"))
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, unknown = repo.changes() 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 "")]
1643 1642
1644 if not ui.quiet: 1643 if not ui.quiet:
2245 names = [] 2244 names = []
2246 if not opts['after'] and not pats: 2245 if not opts['after'] and not pats:
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.changes(files=files, match=matchfn)) 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):
2254 reason = None 2253 reason = None
2255 if abs not in deleted and opts['after']: 2254 if abs not in deleted and opts['after']:
2368 badmatch=names.has_key): 2367 badmatch=names.has_key):
2369 if abs in names: continue 2368 if abs in names: continue
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.changes(match=names.has_key, wlock=wlock) 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'))
2377 add = ([], _('adding %s\n')) 2376 add = ([], _('adding %s\n'))
2378 remove = ([], _('removing %s\n')) 2377 remove = ([], _('removing %s\n'))