Commits

Andrew Godwin committed 849446c

Fix 500 when there's no default branch in a repo at all

Comments (0)

Files changed (1)

heechee/repo/hg.py

             return root
         
         # Trunk
-        self._tree_for_branch("default", revision, "trunk", root)
+        try:
+            self._tree_for_branch("default", revision, "trunk", root)
+        except NoBranchError:
+            # No trunk yet, so make an empty one.
+            Directory(name="trunk", parent=root)
         
         # Branches
         branches = Directory(name="branches", parent=root)
         self.possibly_load()
         self._children = value
     
-    children = property(_get_children, _set_children)
+    children = property(_get_children, _set_children)