# HG changeset patch # User Matt Mackall # Date 2008-06-27 18:43:29 # Node ID 4faaa0535ea7cf760c664c5c9315b9dd41832afb # Parent 9d2ab50803e95157b4c3cb6f01debbf993401ce8 status: clean up all users for unknown files diff --git a/hgext/extdiff.py b/hgext/extdiff.py --- a/hgext/extdiff.py +++ b/hgext/extdiff.py @@ -122,8 +122,7 @@ def dodiff(ui, repo, diffcmd, diffopts, ''' 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 diff --git a/hgext/gpg.py b/hgext/gpg.py --- a/hgext/gpg.py +++ b/hgext/gpg.py @@ -239,7 +239,7 @@ def sign(ui, repo, *revs, **opts): 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 " diff --git a/hgext/hgk.py b/hgext/hgk.py --- a/hgext/hgk.py +++ b/hgext/hgk.py @@ -55,9 +55,7 @@ def difftree(ui, repo, node1=None, node2 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: diff --git a/hgext/keyword.py b/hgext/keyword.py --- a/hgext/keyword.py +++ b/hgext/keyword.py @@ -253,12 +253,12 @@ class kwfilelog(filelog.filelog): 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 @@ def _kwfwrite(ui, repo, expand, *pats, * 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 @@ def files(ui, repo, *pats, **opts): 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)] diff --git a/hgext/mq.py b/hgext/mq.py --- a/hgext/mq.py +++ b/hgext/mq.py @@ -852,7 +852,7 @@ class queue: 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 @@ class queue: 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 @@ class queue: # 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 @@ class queue: 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 @@ class queue: 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()) diff --git a/hgext/record.py b/hgext/record.py --- a/hgext/record.py +++ b/hgext/record.py @@ -405,8 +405,8 @@ def dorecord(ui, repo, committer, *pats, 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 @@ def dorecord(ui, repo, committer, *pats, 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 diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -1158,8 +1158,7 @@ def commit(ui, repo, commitfunc, pats, o 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(): diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -2197,7 +2197,7 @@ def remove(ui, repo, *pats, **opts): 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 = [], [] diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -488,7 +488,7 @@ class workingctx(changectx): 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() diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -972,7 +972,7 @@ class localrepository(repo.repository): 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. diff --git a/mercurial/patch.py b/mercurial/patch.py --- a/mercurial/patch.py +++ b/mercurial/patch.py @@ -1189,8 +1189,8 @@ def diff(repo, node1=None, node2=None, m 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