hg remove implicit for whole tree commits?
robin.farine at terminus.org
Mon Aug 8 03:31:26 CDT 2005
On Monday 08 August 2005 07.53, Thomas Arendsen Hein wrote:
> > Perhaps hg status could display a 'D' for deleted but not
> > removed files?
> I think a '!' would be a good status character, because
> 1. R(emoved) and D(eleted) may be confused easily
> 2. ! is kind of a warning that something is wrong here.
Agreed. And the fact that '!' is a punctuation mark like '?' maps
well to the duality of their meaning in Mercurial, good choice.
> Here is a first patch to dirstate.changes() which will not change
> the real functionality, but internally already does everything
> what's needed. It is not yet in my public tree.
I see two vestiges from the old code (comments below), could you
> diff -r fbe964ae7325 mercurial/hg.py
> --- a/mercurial/hg.py Sun Aug 7 16:41:13 2005
> +++ b/mercurial/hg.py Mon Aug 8 07:51:58 2005
> @@ -487,30 +487,38 @@
> def changes(self, files = None, match = util.always):
> dc = self.map.copy()
> - lookup, changed, added, unknown = , , , 
> + lookup, modified, added, removed = , , , 
> + deleted, unknown = , 
> for src, fn in self.walk(files, match):
> - try: s = os.stat(os.path.join(self.root, fn))
> - except: continue
> + try:
> + s = os.stat(os.path.join(self.root, fn))
> + except OSError:
> + s = None
> if fn in dc:
> c = dc[fn]
> del dc[fn]
Since you now handle !-files explicitely, the 'del dc[fn]' can
be either removed or you could verify that dc is empty before
returning (and raise a software error exception if not).
> + if s:
> elif c == 'r':
> - unknown.append(fn)
> - elif c != s.st_size or (c ^ s.st_mode) & 0100:
> - changed.append(fn)
> - elif c != s.st_mode or c != s.st_mtime:
> - lookup.append(fn)
> - else:
> - if match(fn): unknown.append(fn)
> - return (lookup, changed, added, filter(match, dc.keys()), unknown)
> + removed.append(fn)
> + else:
> + deleted.append(fn)
> + elif s and match(fn):
Here we have an fn that is not in dc, so doesn't the walk() code
already ensure the match(fn) condition?
> + unknown.append(fn)
> + return (lookup, modified, added, removed + deleted, unknown)
> # used to avoid circular references so destructors work
> def opener(base):
More information about the Mercurial