nautilus: fix actions when the menu is invoked outside a repository
authorGermán Póo-Caamaño <gpoo@calcifer.org>
Sun, 20 Jul 2008 09:40:32 -0400
changeset 1180 1c95c2301e5f
parent 1179 15415a973353
child 1181 ab9654ce0550
nautilus: fix actions when the menu is invoked outside a repository
contrib/nautilus-thg.py
--- a/contrib/nautilus-thg.py	Sun Jul 20 09:33:06 2008 -0400
+++ b/contrib/nautilus-thg.py	Sun Jul 20 09:40:32 2008 -0400
@@ -168,8 +168,13 @@
         repo = self.get_repo_for_path(path)
         cwd = os.path.isdir(path) and path or os.path.dirname(path)
 
+        if repo is None:
+            root = repo.root
+        else:
+            root = cwd
+
         cmdopts  = [sys.executable, self.hgproc]
-        cmdopts += ['--root', repo.root]
+        cmdopts += ['--root', root]
         cmdopts += ['--cwd', cwd]
         cmdopts += ['--command', hgcmd]