changeset 6760:4faaa0535ea7

status: clean up all users for unknown files
author Matt Mackall <mpm@selenic.com>
date Fri, 27 Jun 2008 13:43:29 -0500
parents 9d2ab50803e9
children cb981fc955fb
files hgext/extdiff.py hgext/gpg.py hgext/hgk.py hgext/keyword.py hgext/mq.py hgext/record.py mercurial/cmdutil.py mercurial/commands.py mercurial/context.py mercurial/localrepo.py mercurial/patch.py
diffstat 11 files changed, 25 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/extdiff.py	Thu Jun 26 18:49:45 2008 -0500
+++ b/hgext/extdiff.py	Fri Jun 27 13:43:29 2008 -0500
@@ -122,8 +122,7 @@
     '''
     node1, node2 = cmdutil.revpair(repo, opts['rev'])
     matcher = cmdutil.match(repo, pats, opts)
-    modified, added, removed, deleted, unknown = repo.status(
-        node1, node2, matcher)[:5]
+    modified, added, removed = repo.status(node1, node2, matcher)[:3]
     if not (modified or added or removed):
         return 0
 
--- a/hgext/gpg.py	Thu Jun 26 18:49:45 2008 -0500
+++ b/hgext/gpg.py	Fri Jun 27 13:43:29 2008 -0500
@@ -239,7 +239,7 @@
         repo.opener("localsigs", "ab").write(sigmessage)
         return
 
-    for x in repo.status()[:5]:
+    for x in repo.status(unknown=True)[:5]:
         if ".hgsigs" in x and not opts["force"]:
             raise util.Abort(_("working copy of .hgsigs is changed "
                                "(please commit .hgsigs manually "
--- a/hgext/hgk.py	Thu Jun 26 18:49:45 2008 -0500
+++ b/hgext/hgk.py	Fri Jun 27 13:43:29 2008 -0500
@@ -55,9 +55,7 @@
         mmap = repo[node1].manifest()
         mmap2 = repo[node2].manifest()
         m = cmdutil.match(repo, files)
-        status = repo.status(node1, node2, match=m)[:5]
-        modified, added, removed, deleted, unknown = status
-
+        modified, added, removed  = repo.status(node1, node2, m)[:3]
         empty = short(nullid)
 
         for f in modified:
--- a/hgext/keyword.py	Thu Jun 26 18:49:45 2008 -0500
+++ b/hgext/keyword.py	Fri Jun 27 13:43:29 2008 -0500
@@ -253,12 +253,12 @@
             return t2 != text
         return revlog.revlog.cmp(self, node, text)
 
-def _status(ui, repo, kwt, *pats, **opts):
+def _status(ui, repo, kwt, unknown, *pats, **opts):
     '''Bails out if [keyword] configuration is not active.
     Returns status of working directory.'''
     if kwt:
         matcher = cmdutil.match(repo, pats, opts)
-        return repo.status(match=matcher, clean=True)
+        return repo.status(match=matcher, unknown=unknown, clean=True)
     if ui.configitems('keyword'):
         raise util.Abort(_('[keyword] patterns cannot match'))
     raise util.Abort(_('no [keyword] patterns configured'))
@@ -268,15 +268,15 @@
     if repo.dirstate.parents()[1] != nullid:
         raise util.Abort(_('outstanding uncommitted merge'))
     kwt = kwtools['templater']
-    status = _status(ui, repo, kwt, *pats, **opts)
-    modified, added, removed, deleted, unknown, ignored, clean = status
+    status = _status(ui, repo, kwt, False, *pats, **opts)
+    modified, added, removed, deleted = status[:4]
     if modified or added or removed or deleted:
         raise util.Abort(_('outstanding uncommitted changes'))
     wlock = lock = None
     try:
         wlock = repo.wlock()
         lock = repo.lock()
-        kwt.overwrite(None, expand, clean)
+        kwt.overwrite(None, expand, status[6])
     finally:
         del wlock, lock
 
@@ -380,11 +380,9 @@
     That is, files matched by [keyword] config patterns but not symlinks.
     '''
     kwt = kwtools['templater']
-    status = _status(ui, repo, kwt, *pats, **opts)
+    status = _status(ui, repo, kwt, opts.get('untracked'), *pats, **opts)
     modified, added, removed, deleted, unknown, ignored, clean = status
-    files = modified + added + clean
-    if opts.get('untracked'):
-        files += unknown
+    files = modified + added + clean + unknown
     files.sort()
     wctx = repo[None]
     kwfiles = [f for f in files if kwt.iskwfile(f, wctx.flags)]
--- a/hgext/mq.py	Thu Jun 26 18:49:45 2008 -0500
+++ b/hgext/mq.py	Fri Jun 27 13:43:29 2008 -0500
@@ -852,7 +852,7 @@
                 self.ui.warn(_('cleaning up working directory...'))
                 node = repo.dirstate.parents()[0]
                 hg.revert(repo, node, None)
-                unknown = repo.status()[4]
+                unknown = repo.status(unknown=True)[4]
                 # only remove unknown files that we know we touched or
                 # created while patching
                 for f in unknown:
@@ -933,7 +933,7 @@
                 qp = self.qparents(repo, rev)
                 changes = repo.changelog.read(qp)
                 mmap = repo.manifest.read(changes[0])
-                m, a, r, d, u = repo.status(qp, top)[:5]
+                m, a, r, d = repo.status(qp, top)[:4]
                 if d:
                     raise util.Abort("deletions found between repo revs")
                 for f in m:
@@ -1066,11 +1066,11 @@
                 # patch already
                 #
                 # this should really read:
-                #   mm, dd, aa, aa2, uu = repo.status(tip, patchparent)[:5]
+                #   mm, dd, aa, aa2 = repo.status(tip, patchparent)[:4]
                 # but we do it backwards to take advantage of manifest/chlog
                 # caching against the next repo.status call
                 #
-                mm, aa, dd, aa2, uu = repo.status(patchparent, tip)[:5]
+                mm, aa, dd, aa2 = repo.status(patchparent, tip)[:4]
                 changes = repo.changelog.read(tip)
                 man = repo.manifest.read(changes[0])
                 aaa = aa[:]
@@ -1078,7 +1078,7 @@
                     match = cmdutil.matchfiles(repo, mm + aa + dd)
                 else:
                     match = cmdutil.matchall(repo)
-                m, a, r, d, u = repo.status(match=match)[:5]
+                m, a, r, d = repo.status(match=match)[:4]
 
                 # we might end up with files that were added between
                 # tip and the dirstate parent, but then changed in the
@@ -1111,7 +1111,7 @@
                 m = util.unique(mm)
                 r = util.unique(dd)
                 a = util.unique(aa)
-                c = [filter(matchfn, l) for l in (m, a, r, [], u)]
+                c = [filter(matchfn, l) for l in (m, a, r)]
                 match = cmdutil.matchfiles(repo, util.unique(c[0] + c[1] + c[2]))
                 patch.diff(repo, patchparent, match=match,
                            fp=patchf, changes=c, opts=self.diffopts())
--- a/hgext/record.py	Thu Jun 26 18:49:45 2008 -0500
+++ b/hgext/record.py	Fri Jun 27 13:43:29 2008 -0500
@@ -405,8 +405,8 @@
         if match.files():
             changes = None
         else:
-            changes = repo.status(match=match)[:5]
-            modified, added, removed = changes[:3]
+            changes = repo.status(match=match)[:3]
+            modified, added, removed = changes
             match = cmdutil.matchfiles(repo, modified + added + removed)
         diffopts = mdiff.diffopts(git=True, nodates=True)
         fp = cStringIO.StringIO()
@@ -431,7 +431,7 @@
 
         if changes is None:
             match = cmdutil.matchfiles(repo, newfiles)
-            changes = repo.status(match=match)[:5]
+            changes = repo.status(match=match)
         modified = dict.fromkeys(changes[0])
 
         # 2. backup changed files, so we can restore them in the end
--- a/mercurial/cmdutil.py	Thu Jun 26 18:49:45 2008 -0500
+++ b/mercurial/cmdutil.py	Fri Jun 27 13:43:29 2008 -0500
@@ -1158,8 +1158,7 @@
 
     m = match(repo, pats, opts)
     if pats:
-        status = repo.status(match=m)
-        modified, added, removed, deleted, unknown = status[:5]
+        modified, added, removed = repo.status(match=m)[:3]
         files = modified + added + removed
         slist = None
         for f in m.files():
--- a/mercurial/commands.py	Thu Jun 26 18:49:45 2008 -0500
+++ b/mercurial/commands.py	Fri Jun 27 13:43:29 2008 -0500
@@ -2197,7 +2197,7 @@
         raise util.Abort(_('no files specified'))
 
     m = cmdutil.match(repo, pats, opts)
-    mardu = map(dict.fromkeys, repo.status(match=m))[:5]
+    mardu = map(dict.fromkeys, repo.status(match=m, unknown=True))[:5]
     modified, added, removed, deleted, unknown = mardu
 
     remove, forget = [], []
--- a/mercurial/context.py	Thu Jun 26 18:49:45 2008 -0500
+++ b/mercurial/context.py	Fri Jun 27 13:43:29 2008 -0500
@@ -488,7 +488,7 @@
 
     def __getattr__(self, name):
         if name == '_status':
-            self._status = self._repo.status()
+            self._status = self._repo.status(unknown=True)
             return self._status
         if name == '_manifest':
             self._buildmanifest()
--- a/mercurial/localrepo.py	Thu Jun 26 18:49:45 2008 -0500
+++ b/mercurial/localrepo.py	Fri Jun 27 13:43:29 2008 -0500
@@ -972,7 +972,7 @@
                 yield fn
 
     def status(self, node1=None, node2=None, match=None,
-               ignored=False, clean=False, unknown=True):
+               ignored=False, clean=False, unknown=False):
         """return status of files between two nodes or node and working directory
 
         If node1 is None, use the first dirstate parent instead.
--- a/mercurial/patch.py	Thu Jun 26 18:49:45 2008 -0500
+++ b/mercurial/patch.py	Fri Jun 27 13:43:29 2008 -0500
@@ -1189,8 +1189,8 @@
     date1 = util.datestr(ctx1.date())
 
     if not changes:
-        changes = repo.status(node1, node2, match=match)[:5]
-    modified, added, removed, deleted, unknown = changes
+        changes = repo.status(node1, node2, match=match)
+    modified, added, removed = changes[:3]
 
     if not modified and not added and not removed:
         return