1. Martin Vejnár
  2. trac-hgdirmanager

Commits

Martin Vejnár  committed e7ba70a

Link repos.

  • Participants
  • Parent commits c90b3c3
  • Branches default

Comments (0)

Files changed (1)

File hgdirmanager/hgdirmanager.py

View file
             info['url'] = url_prefix + relpath
             repos.append((relpath, info))
 
+        def add_link(fname):
+            fin = open(fname, 'r')
+
+            try:
+                landing_page, wiki, repo = fin
+            except:
+                return
+
+            relpath = os.path.relpath(fname, basepath)
+            info = {
+                'type': 'link',
+                'hidden': True,
+                'url': repo,
+                'landing': landing_page,
+                'wiki': wiki
+                }
+
+            repos.append((relpath, info))
+            pass
+
         if recurse:
             for topdir, dirs, files in os.walk(basepath):
                 if '.hg' in dirs:
                     add_repo(topdir)
         else:
             for name in os.listdir(basepath):
-                if os.path.isdir(os.path.join(basepath, name, '.hg')):
+                if not os.path.isdir(os.path.join(basepath, name)):
+                    add_link(os.path.join(basepath, name))
+                elif os.path.isdir(os.path.join(basepath, name, '.hg')):
                     add_repo(os.path.join(basepath, name))
 
         return repos