storage:vcs:hg: remove grandchildren from Hg._vcs_listdir.
authorW. Trevor King <wking@tremily.us>
Thu, 23 Aug 2012 14:38:14 +0000 (10:38 -0400)
committerW. Trevor King <wking@tremily.us>
Thu, 23 Aug 2012 14:38:14 +0000 (10:38 -0400)
This fixes:

  From: Phil Schumm
  Date: Thu, 23 Aug 2012 08:15:21 -0500
  Subject: [Be-devel] -be diff- under Hg

  ...
  I've just noticed that -be diff- seems to yield different output
  under Git than it does under Hg (e.g., in a Mercurial +repository,
  -be diff- appears to show all changes as new bugs rather than
  modified).
  ...

libbe/storage/vcs/hg.py

index ce7cc905ae0d42a9a9d9762d8d4121ad5c8cfd51..2f4469db8736059b94129683efcbdfc16fd48893 100644 (file)
@@ -152,7 +152,10 @@ class Hg(base.VCS):
         output = self._u_invoke_client('manifest', '--rev', revision)
         files = output.splitlines()
         path = path.rstrip(os.path.sep) + os.path.sep
-        return [self._u_rel_path(f, path) for f in files if f.startswith(path)]
+        descendent_files = [self._u_rel_path(f, path) for f in files
+                            if f.startswith(path)]
+        return sorted(set(
+                f.split(os.path.sep, 1)[0] for f in descendent_files))
 
     def _vcs_commit(self, commitfile, allow_empty=False):
         args = ['commit', '--logfile', commitfile]