Mercurial > hg
changeset 6201:305d4450036a
Extend/correct acc40572da5b regarding -qA and ignored files.
hg status -qA will now hide untracked files as described in the doc string.
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Sun, 02 Mar 2008 13:52:34 +0100 |
parents | acc40572da5b |
children | 0ab0da2215d7 |
files | mercurial/commands.py mercurial/dirstate.py mercurial/localrepo.py tests/test-help.out tests/test-status |
diffstat | 5 files changed, 35 insertions(+), 28 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/commands.py Sat Mar 01 22:30:03 2008 +0100 +++ b/mercurial/commands.py Sun Mar 02 13:52:34 2008 +0100 @@ -2493,8 +2493,8 @@ -i (ignored), -C (copies) or -A is given. Unless options described with "show only ..." are given, the options -mardu are used. - Option -q/--quiet hides untracked files unless explicitly - requested by -u. + Option -q/--quiet hides untracked (unknown and ignored) files + unless explicitly requested with -u/--unknown or -i/-ignored. NOTE: status may appear to disagree with diff if permissions have changed or a merge has occurred. The standard diff format does not @@ -2522,9 +2522,17 @@ cwd = (pats and repo.getcwd()) or '' modified, added, removed, deleted, unknown, ignored, clean = [ n for n in repo.status(node1=node1, node2=node2, files=files, - match=matchfn, - list_ignored=all or opts['ignored'], - list_clean=all or opts['clean'])] + match=matchfn, + list_ignored=opts['ignored'] + or all and not ui.quiet, + list_clean=opts['clean'] or all, + list_unknown=opts['unknown'] + or not (ui.quiet or + opts['modified'] or + opts['added'] or + opts['removed'] or + opts['deleted'] or + opts['ignored']))] changetypes = (('modified', 'M', modified), ('added', 'A', added), @@ -2541,11 +2549,6 @@ if all or opts[ct[0]]] or changetypes): - # skip unknown files if -q, but -u and -A have priority over -q - if (not opts['unknown']) and (not opts['all']): - if opt == 'unknown' and ui.quiet: - continue - if opts['no_status']: format = "%%s%s" % end else:
--- a/mercurial/dirstate.py Sat Mar 01 22:30:03 2008 +0100 +++ b/mercurial/dirstate.py Sun Mar 02 13:52:34 2008 +0100 @@ -383,8 +383,8 @@ for src, f, st in self.statwalk(files, match, badmatch=badmatch): yield src, f - def statwalk(self, files=None, match=util.always, ignored=False, - badmatch=None, directories=False): + def statwalk(self, files=None, match=util.always, unknown=True, + ignored=False, badmatch=None, directories=False): ''' walk recursively through the directory tree, finding all files matched by the match function @@ -412,6 +412,7 @@ return False return match(file_) + # TODO: don't walk unknown directories if unknown and ignored are False ignore = self._ignore dirignore = self._dirignore if ignored: @@ -527,7 +528,7 @@ if imatch(k): yield 'm', k, None - def status(self, files, match, list_ignored, list_clean): + def status(self, files, match, list_ignored, list_clean, list_unknown=True): lookup, modified, added, unknown, ignored = [], [], [], [], [] removed, deleted, clean = [], [], [] @@ -545,14 +546,15 @@ dadd = deleted.append cadd = clean.append - for src, fn, st in self.statwalk(files, match, ignored=list_ignored): + for src, fn, st in self.statwalk(files, match, unknown=list_unknown, + ignored=list_ignored): if fn in dmap: type_, mode, size, time, foo = dmap[fn] else: if (list_ignored or fn in files) and self._dirignore(fn): if list_ignored: iadd(fn) - else: + elif list_unknown: uadd(fn) continue if src == 'm':
--- a/mercurial/localrepo.py Sat Mar 01 22:30:03 2008 +0100 +++ b/mercurial/localrepo.py Sun Mar 02 13:52:34 2008 +0100 @@ -959,7 +959,7 @@ yield src, fn def status(self, node1=None, node2=None, files=[], match=util.always, - list_ignored=False, list_clean=False): + list_ignored=False, list_clean=False, list_unknown=True): """return status of files between two nodes or node and working directory If node1 is None, use the first dirstate parent instead. @@ -995,7 +995,8 @@ if not node2: (lookup, modified, added, removed, deleted, unknown, ignored, clean) = self.dirstate.status(files, match, - list_ignored, list_clean) + list_ignored, list_clean, + list_unknown) # are we comparing working dir against its parent? if compareworking:
--- a/tests/test-help.out Sat Mar 01 22:30:03 2008 +0100 +++ b/tests/test-help.out Sun Mar 02 13:52:34 2008 +0100 @@ -222,8 +222,8 @@ -i (ignored), -C (copies) or -A is given. Unless options described with "show only ..." are given, the options -mardu are used. - Option -q/--quiet hides untracked files unless explicitly - requested by -u. + Option -q/--quiet hides untracked (unknown and ignored) files + unless explicitly requested with -u/--unknown or -i/-ignored. NOTE: status may appear to disagree with diff if permissions have changed or a merge has occurred. The standard diff format does not
--- a/tests/test-status Sat Mar 01 22:30:03 2008 +0100 +++ b/tests/test-status Sun Mar 02 13:52:34 2008 +0100 @@ -82,13 +82,14 @@ } # assert flag1 flag2 [0-same | 1-different] -assert "-q" "-mard" 0 -assert "-A" "-mardicCu" 0 -assert "-qA" "-mardicCu" 0 -assert "-qAu" "-A" 0 -assert "-qA" "-A" 0 -assert "-qu" "-u" 0 -assert "-q" "-u" 1 -assert "-m" "-a" 1 -assert "-r" "-d" 1 +assert "-q" "-mard" 0 +assert "-A" "-marduicC" 0 +assert "-qA" "-mardcC" 0 +assert "-qAui" "-A" 0 +assert "-qAu" "-marducC" 0 +assert "-qAi" "-mardicC" 0 +assert "-qu" "-u" 0 +assert "-q" "-u" 1 +assert "-m" "-a" 1 +assert "-r" "-d" 1