diff --git a/contrib/hbisect.py b/contrib/hbisect.py --- a/contrib/hbisect.py +++ b/contrib/hbisect.py @@ -21,8 +21,8 @@ def lookup_rev(ui, repo, rev=None): return parents.pop() def check_clean(ui, repo): - c, a, d, u = repo.changes() - if c or a or d: + modified, added, removed, unknown = repo.changes() + if modified or added or removed: ui.warn("Repository is not clean, please commit or revert\n") sys.exit(1) diff --git a/contrib/hgk.py b/contrib/hgk.py --- a/contrib/hgk.py +++ b/contrib/hgk.py @@ -14,13 +14,13 @@ def dodiff(fp, ui, repo, node1, node2, f return time.asctime(time.gmtime(c[2][0])) if not changes: - (c, a, d, u) = repo.changes(node1, node2, files, match=match) - else: - (c, a, d, u) = changes + changes = repo.changes(node1, node2, files, match=match) + modified, added, removed, unknown = changes if files: - c, a, d = map(lambda x: filterfiles(files, x), (c, a, d)) + modified, added, removed = map(lambda x: filterfiles(x, files), + (modified, added, removed)) - if not c and not a and not d: + if not modified and not added and not removed: return if node2: @@ -40,19 +40,19 @@ def dodiff(fp, ui, repo, node1, node2, f mmap = repo.manifest.read(change[0]) date1 = date(change) - for f in c: + for f in modified: to = None if f in mmap: to = repo.file(f).read(mmap[f]) tn = read(f) fp.write("diff --git a/%s b/%s\n" % (f, f)) fp.write(mdiff.unidiff(to, date1, tn, date2, f, None, text=text)) - for f in a: + for f in added: to = None tn = read(f) fp.write("diff --git /dev/null b/%s\n" % (f)) fp.write(mdiff.unidiff(to, date1, tn, date2, f, None, text=text)) - for f in d: + for f in removed: to = repo.file(f).read(mmap[f]) tn = None fp.write("diff --git a/%s /dev/null\n" % (f)) @@ -67,12 +67,12 @@ def difftree(ui, repo, node1=None, node2 if node2: change = repo.changelog.read(node2) mmap2 = repo.manifest.read(change[0]) - (c, a, d, u) = repo.changes(node1, node2) + modified, added, removed, unknown = repo.changes(node1, node2) def read(f): return repo.file(f).read(mmap2[f]) date2 = date(change) else: date2 = time.asctime() - (c, a, d, u) = repo.changes(node1, None) + modified, added, removed, unknown = repo.changes(node1) if not node1: node1 = repo.dirstate.parents()[0] def read(f): return file(os.path.join(repo.root, f)).read() @@ -82,13 +82,13 @@ def difftree(ui, repo, node1=None, node2 date1 = date(change) empty = "0" * 40; - for f in c: + for f in modified: # TODO get file permissions print ":100664 100664 %s %s M\t%s\t%s" % (hg.hex(mmap[f]), hg.hex(mmap2[f]), f, f) - for f in a: + for f in added: print ":000000 100664 %s %s N\t%s\t%s" % (empty, hg.hex(mmap2[f]), f, f) - for f in d: + for f in removed: print ":100664 000000 %s %s D\t%s\t%s" % (hg.hex(mmap[f]), empty, f, f) ## diff --git a/hgext/gpg.py b/hgext/gpg.py --- a/hgext/gpg.py +++ b/hgext/gpg.py @@ -160,8 +160,7 @@ def sign(ui, repo, *revs, **opts): repo.opener("localsigs", "ab").write(sigmessage) return - (c, a, d, u) = repo.changes() - for x in (c, a, d, u): + for x in repo.changes(): if ".hgsigs" in x and not opts["force"]: raise util.Abort("working copy of .hgsigs is changed " "(please commit .hgsigs manually" diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -263,13 +263,13 @@ def make_file(repo, r, pat, node=None, def dodiff(fp, ui, repo, node1, node2, files=None, match=util.always, changes=None, text=False): if not changes: - (c, a, d, u) = repo.changes(node1, node2, files, match=match) - else: - (c, a, d, u) = changes + changes = repo.changes(node1, node2, files, match=match) + modified, added, removed, unknown = changes if files: - c, a, d = map(lambda x: filterfiles(files, x), (c, a, d)) + modified, added, removed = map(lambda x: filterfiles(x, files), + (modified, added, removed)) - if not c and not a and not d: + if not modified and not added and not removed: return if node2: @@ -295,17 +295,17 @@ def dodiff(fp, ui, repo, node1, node2, f mmap = repo.manifest.read(change[0]) date1 = util.datestr(change[2]) - for f in c: + for f in modified: to = None if f in mmap: to = repo.file(f).read(mmap[f]) tn = read(f) fp.write(mdiff.unidiff(to, date1, tn, date2, f, r, text=text)) - for f in a: + for f in added: to = None tn = read(f) fp.write(mdiff.unidiff(to, date1, tn, date2, f, r, text=text)) - for f in d: + for f in removed: to = repo.file(f).read(mmap[f]) tn = None fp.write(mdiff.unidiff(to, date1, tn, date2, f, r, text=text)) @@ -785,8 +785,10 @@ def commit(ui, repo, *pats, **opts): addremove(ui, repo, *pats, **opts) fns, match, anypats, cwd = matchpats(repo, pats, opts) if pats: - c, a, d, u = repo.changes(files=fns, match=match) - files = c + a + [fn for fn in d if repo.dirstate.state(fn) == 'r'] + modified, added, removed, unknown = ( + repo.changes(files=fns, match=match)) + files = (modified + added + + [fn for fn in removed if repo.dirstate.state(fn) == 'r']) else: files = [] try: @@ -1379,9 +1381,9 @@ def identify(ui, repo): return hexfunc = ui.verbose and hex or short - (c, a, d, u) = repo.changes() + modified, added, removed, unknown = repo.changes() output = ["%s%s" % ('+'.join([hexfunc(parent) for parent in parents]), - (c or a or d) and "+" or "")] + (modified or added or removed) and "+" or "")] if not ui.quiet: # multiple tags for a single parent separated by '/' @@ -1410,8 +1412,8 @@ def import_(ui, repo, patch1, *patches, patches = (patch1,) + patches if not opts['force']: - (c, a, d, u) = repo.changes() - if c or a or d: + modified, added, removed, unknown = repo.changes() + if modified or added or removed: raise util.Abort(_("outstanding uncommitted changes")) d = opts["base"] @@ -1827,13 +1829,13 @@ def remove(ui, repo, pat, *pats, **opts) """ names = [] def okaytoremove(abs, rel, exact): - c, a, d, u = repo.changes(files = [abs]) + modified, added, removed, unknown = repo.changes(files=[abs]) reason = None - if c: + if modified: reason = _('is modified') - elif a: + elif added: reason = _('has been marked for add') - elif u: + elif unknown: reason = _('is not managed') if reason: if exact: @@ -1891,9 +1893,9 @@ def revert(ui, repo, *pats, **opts): repo.dirstate.parents()[0] files, choose, anypats, cwd = matchpats(repo, pats, opts) - (c, a, d, u) = repo.changes(match=choose) - repo.forget(a) - repo.undelete(d) + modified, added, removed, unknown = repo.changes(match=choose) + repo.forget(added) + repo.undelete(removed) return repo.update(node, False, True, choose, False) @@ -2024,13 +2026,14 @@ def status(ui, repo, *pats, **opts): """ files, matchfn, anypats, cwd = matchpats(repo, pats, opts) - (c, a, d, u) = [[util.pathto(cwd, x) for x in n] - for n in repo.changes(files=files, match=matchfn)] + modified, added, removed, unknown = [ + [util.pathto(cwd, x) for x in n] + for n in repo.changes(files=files, match=matchfn)] - changetypes = [(_('modified'), 'M', c), - (_('added'), 'A', a), - (_('removed'), 'R', d), - (_('unknown'), '?', u)] + changetypes = [(_('modified'), 'M', modified), + (_('added'), 'A', added), + (_('removed'), 'R', removed), + (_('unknown'), '?', unknown)] end = opts['print0'] and '\0' or '\n' @@ -2078,8 +2081,7 @@ def tag(ui, repo, name, rev_=None, **opt repo.opener("localtags", "a").write("%s %s\n" % (r, name)) return - (c, a, d, u) = repo.changes() - for x in (c, a, d, u): + for x in repo.changes(): if ".hgtags" in x: raise util.Abort(_("working copy of .hgtags is changed " "(please commit .hgtags manually)")) diff --git a/mercurial/hgweb.py b/mercurial/hgweb.py --- a/mercurial/hgweb.py +++ b/mercurial/hgweb.py @@ -265,19 +265,20 @@ class hgweb(object): date1 = util.datestr(change1[2]) date2 = util.datestr(change2[2]) - c, a, d, u = r.changes(node1, node2) + modified, added, removed, unknown = r.changes(node1, node2) if files: - c, a, d = map(lambda x: filterfiles(x, files), (c, a, d)) + modified, added, removed = map(lambda x: filterfiles(x, files), + (modified, added, removed)) - for f in c: + for f in modified: to = r.file(f).read(mmap1[f]) tn = r.file(f).read(mmap2[f]) yield diffblock(mdiff.unidiff(to, date1, tn, date2, f), f, tn) - for f in a: + for f in added: to = None tn = r.file(f).read(mmap2[f]) yield diffblock(mdiff.unidiff(to, date1, tn, date2, f), f, tn) - for f in d: + for f in removed: to = r.file(f).read(mmap1[f]) tn = None yield diffblock(mdiff.unidiff(to, date1, tn, date2, f), f, tn) diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -355,9 +355,9 @@ class localrepository(object): else: self.ui.warn(_("%s not tracked!\n") % f) else: - (c, a, d, u) = self.changes(match=match) - commit = c + a - remove = d + modified, added, removed, unknown = self.changes(match=match) + commit = modified + added + remove = removed p1, p2 = self.dirstate.parents() c1 = self.changelog.read(p1) @@ -1392,13 +1392,13 @@ class localrepository(object): ma = self.manifest.read(man) mfa = self.manifest.readflags(man) - (c, a, d, u) = self.changes() + modified, added, removed, unknown = self.changes() if allow and not forcemerge: - if c or a or d: + if modified or added or removed: raise util.Abort(_("outstanding uncommited changes")) if not forcemerge and not force: - for f in u: + for f in unknown: if f in m2: t1 = self.wread(f) t2 = self.file(f).read(m2[f]) @@ -1425,16 +1425,16 @@ class localrepository(object): # construct a working dir manifest mw = m1.copy() mfw = mf1.copy() - umap = dict.fromkeys(u) + umap = dict.fromkeys(unknown) - for f in a + c + u: + for f in added + modified + unknown: mw[f] = "" mfw[f] = util.is_exec(self.wjoin(f), mfw.get(f, False)) if moddirstate: wlock = self.wlock() - for f in d: + for f in removed: if f in mw: del mw[f]