diff hg_delta_editor.py @ 124:291925677a9f

tag_repo: remove gentags command, extend repo.tags(), HgChangeEditor now takes either repo or repo_path
author Luke Opperman <luke@loppear.com>
date Thu, 04 Dec 2008 13:10:40 -0600
parents 58de7aea8a77
children 4d42dbbb5127
line wrap: on
line diff
--- a/hg_delta_editor.py
+++ b/hg_delta_editor.py
@@ -58,7 +58,8 @@ class HgChangeReceiver(delta.Editor):
         f.close()
         self.revmap[revnum, branch] = node_hash
 
-    def __init__(self, path, ui_=None, subdir='', author_host='',
+    def __init__(self, path=None, repo=None, ui_=None,
+                 subdir='', author_host='',
                  tag_locations=['tags']):
         """path is the path to the target hg repo.
 
@@ -68,8 +69,15 @@ class HgChangeReceiver(delta.Editor):
         if not ui_:
             ui_ = ui.ui()
         self.ui = ui_
-        self.path = path
-        self.__setup_repo(path)
+        if repo:
+            self.repo = repo
+            self.path = os.path.normpath(os.path.join(self.repo.path, '..'))
+        elif path:
+            self.path = path
+            self.__setup_repo(path)
+        else:
+            raise TypeError("Expected either path or repo argument")
+
         self.subdir = subdir
         if self.subdir and self.subdir[0] == '/':
             self.subdir = self.subdir[1:]