Renamed c, a, d, u to modified, added, removed, unknown for users of changes()
authorThomas Arendsen Hein <thomas@intevation.de>
Thu, 12 Jan 2006 13:35:09 +0100
changeset 1618 ff339dd21976
parent 1617 ece5d785e87a
child 1619 1ba0d7041ac4
Renamed c, a, d, u to modified, added, removed, unknown for users of changes()
contrib/hbisect.py
contrib/hgk.py
hgext/gpg.py
mercurial/commands.py
mercurial/hgweb.py
mercurial/localrepo.py
--- a/contrib/hbisect.py	Thu Jan 12 12:22:28 2006 +0100
+++ b/contrib/hbisect.py	Thu Jan 12 13:35:09 2006 +0100
@@ -21,8 +21,8 @@
     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)
 
--- a/contrib/hgk.py	Thu Jan 12 12:22:28 2006 +0100
+++ b/contrib/hgk.py	Thu Jan 12 13:35:09 2006 +0100
@@ -14,13 +14,13 @@
         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 @@
     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 @@
         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 @@
         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)
     ##
 
--- a/hgext/gpg.py	Thu Jan 12 12:22:28 2006 +0100
+++ b/hgext/gpg.py	Thu Jan 12 13:35:09 2006 +0100
@@ -160,8 +160,7 @@
         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"
--- a/mercurial/commands.py	Thu Jan 12 12:22:28 2006 +0100
+++ b/mercurial/commands.py	Thu Jan 12 13:35:09 2006 +0100
@@ -263,13 +263,13 @@
 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 @@
     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 @@
         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 @@
         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 @@
     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 @@
     """
     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 @@
            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 @@
     """
 
     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 @@
         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)"))
--- a/mercurial/hgweb.py	Thu Jan 12 12:22:28 2006 +0100
+++ b/mercurial/hgweb.py	Thu Jan 12 13:35:09 2006 +0100
@@ -265,19 +265,20 @@
         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)
--- a/mercurial/localrepo.py	Thu Jan 12 12:22:28 2006 +0100
+++ b/mercurial/localrepo.py	Thu Jan 12 13:35:09 2006 +0100
@@ -355,9 +355,9 @@
                 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 @@
         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 @@
         # 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]