[ANN] pidgin git import v6

Felipe Contreras felipe.contreras at gmail.com
Tue May 29 15:23:10 EDT 2012


On Tue, May 29, 2012 at 9:10 PM, Richard Laager <rlaager at wiktel.com> wrote:
> On Tue, 2012-05-29 at 19:10 +0200, Felipe Contreras wrote:
>> In addition, this can be easily converted to mercurial with a trivial
>> hack to 'hg-git'.
>
> What sort of hack is required?

I did this:

--- git_handler.py	2012-05-21 04:26:35.813669905 +0200
+++ git_handler.py	2012-05-21 04:32:29.553683661 +0200
@@ -89,6 +89,12 @@
         self.load_map()
         self.load_tags()

+        self.mtn_branch_map = {}
+        with open("/tmp/branches_map.txt", "r") as f:
+            for l in f:
+                orig, new = l.rstrip("\n").split(" = ")
+                self.mtn_branch_map[orig] = new
+
     # make the git data directory
     def init_if_missing(self):
         if os.path.exists(self.gitdir):
@@ -1077,6 +1083,17 @@
                 if command == 'extra':
                     before, after = data.split(" : ", 1)
                     extra[before] = urllib.unquote(after)
+
+        start = message.find('Monotone-Branch: ')
+        if start >= 0:
+            tmp = message[start + 17:]
+            end = tmp.find('\n')
+            branch = tmp[:end]
+            try:
+                branch = self.mtn_branch_map[branch]
+            except KeyError:
+                pass
+
         return (message, renames, branch, extra)

     def get_file(self, commit, f):

-- 
Felipe Contreras




More information about the Devel mailing list