[PATCH] hgwebdir: shows nested repos (issue1336)

Benoît Allard benoit at aeteurope.nl
Wed Oct 22 02:42:44 CDT 2008


# HG changeset patch
# User Benoit Allard <benoit at aeteurope.nl>
# Date 1224527391 -7200
# Node ID 8460c5df109c883365b190ff7ea4f2422d75c02e
# Parent  8bbbba2a1a9c035d0b600daff822ba2811457b04
hgwebdir: shows sub-repositories (issue1336)

diff -r 8bbbba2a1a9c -r 8460c5df109c mercurial/util.py
--- a/mercurial/util.py	Mon Oct 20 14:58:49 2008 +0200
+++ b/mercurial/util.py	Mon Oct 20 20:29:51 2008 +0200
@@ -1852,7 +1852,7 @@
          _add_dir_if_not_there(seen_dirs, path)
      for root, dirs, files in os.walk(path, topdown=True, 
onerror=errhandler):
          if '.hg' in dirs:
-            dirs[:] = [] # don't descend further
+            dirs.remove('.hg') # don't recurse inside the .hg directory
              yield root # found a repository
              qroot = os.path.join(root, '.hg', 'patches')
              if os.path.isdir(os.path.join(qroot, '.hg')):
diff -r 8bbbba2a1a9c -r 8460c5df109c tests/test-walkrepo.py
--- a/tests/test-walkrepo.py	Mon Oct 20 14:58:49 2008 +0200
+++ b/tests/test-walkrepo.py	Mon Oct 20 20:29:51 2008 +0200
@@ -12,6 +12,12 @@
  mkdir('subdir')
  chdir('subdir')
  hg.repository(u, 'sub1', create=1)
+chdir('sub1')
+hg.repository(u,'inside_sub1',create=1)
+chdir('.hg')
+hg.repository(u,'patches',create=1)
+chdir(os.path.pardir)
+chdir(os.path.pardir)
  mkdir('subsubdir')
  chdir('subsubdir')
  hg.repository(u, 'subsub1', create=1)
@@ -22,12 +28,12 @@

  def runtest():
      reposet = frozenset(walkrepos('.', followsym=True))
-    if sym and (len(reposet) != 3):
+    if sym and (len(reposet) != 5):
          print "reposet = %r" % (reposet,)
-        raise SystemExit(1, "Found %d repositories when I should have 
found 3" % (len(reposet),))
-    if (not sym) and (len(reposet) != 2):
+        raise SystemExit(1, "Found %d repositories when I should have 
found 5" % (len(reposet),))
+    if (not sym) and (len(reposet) != 4):
          print "reposet = %r" % (reposet,)
-        raise SystemExit(1, "Found %d repositories when I should have 
found 2" % (len(reposet),))
+        raise SystemExit(1, "Found %d repositories when I should have 
found 4" % (len(reposet),))
      sub1set = frozenset((pjoin('.', 'sub1'),
                           pjoin('.', 'circle', 'subdir', 'sub1')))
      if len(sub1set & reposet) != 1:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 4197 bytes
Desc: S/MIME Cryptographic Signature
Url : http://selenic.com/pipermail/mercurial-devel/attachments/20081022/331be3e6/attachment.bin 


More information about the Mercurial-devel mailing list