Commits

David Wilhelm  committed 5e37099

reporegistry: fix the subrepo name lookup

Problem spotted and fixed by Angel Ezquerra. Previously, the
.hgsub name was incorrectly compared to the subrepo basename,
so subrepos not at the top level caused a list lookup failure.

  • Participants
  • Parent commits b28f9eb
  • Branches stable

Comments (0)

Files changed (1)

File tortoisehg/hgqt/reporegistry.py

         repo = hg.repository(ui.ui(), ip.rootpath())
         ctx = repo['.']
         wfile = '.hgsub'
-        if wfile in ctx:
-            data = ctx[wfile].data().strip()
+        if wfile not in ctx:
+            return self.sortbypath()
+        data = ctx[wfile].data().strip()
         data = data.split('\n')
-        hgsuborder = [x.split('=')[0].strip() for x in data]
-        keyfunc = lambda x: hgsuborder.index(x.shortname())
+        getsubpath = lambda x: x.split('=')[0].strip()
+        abspath = lambda x: util.normpath(repo.wjoin(x))
+        hgsuborder = [abspath(getsubpath(x)) for x in data]
+        def keyfunc(x):
+            try:
+                return hgsuborder.index(util.normpath(x.rootpath()))
+            except:
+                # If an item is not found, place it at the top
+                return 0
         self.tview.model().sortchilds(ip.childs, keyfunc)
 
     @pyqtSlot(QString, QString)