Commits

Anonymous committed 8db74ab

context: add hg init command

  • Participants
  • Parent commits 52b3a44

Comments (0)

Files changed (1)

File tortoise/contextmenu.py

         print "_get_commands() on %s" % ", ".join(self._filenames)        
 
         # open repo
+        result = []
         tree = None
         u = ui.ui()
         rpath = self._folder or self._filenames[0]
         root = find_root(rpath)
         if root is None:
             print "%s: not in repo" % rpath
-            return []
+            result.append((_("Create repo here"),
+                           _("create a new repository in this directory"),
+                           self._init))
+            return result
 
         print "file = %s\nroot = %s" % (rpath, root)
         
         try:
             tree = hg.repository(u, path=root)
         except repo.RepoError:
-            print "%s: can't repo" % dir
+            print "%s: can't open repo" % dir
             return []
 
         print "_get_commands(): adding hg commands"
         
-        result = []
         if tree is not None:
             # commit tool - enabled by extensions.qct
             status = not u.config("extensions", "qct") is None
                         shellquote(dest))
         gpopen.run(cmdline)
 
+    def _init(self, parent_window):
+        self._run_dialog('init', True)
+
     def _status(self, parent_window):
         self._run_dialog('status')