remote-helpers: improve marks usage
authorFelipe Contreras <felipe.contreras@gmail.com>
Sat, 25 May 2013 02:30:00 +0000 (21:30 -0500)
committerJunio C Hamano <gitster@pobox.com>
Tue, 28 May 2013 15:02:24 +0000 (08:02 -0700)
Always convert to strings (they are unicode because they come from JSON).

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/remote-helpers/git-remote-bzr
contrib/remote-helpers/git-remote-hg
index 10300c63d1a71aecd0f8d2273d276f36773e6b1e..f0e5be1d24ac12b9288f2d634363e9fa848e4ee0 100755 (executable)
@@ -116,7 +116,10 @@ class Marks:
         self.last_mark = mark
 
     def get_tip(self, branch):
-        return self.tips.get(branch, None)
+        try:
+            return str(self.tips[branch])
+        except KeyError:
+            return None
 
     def set_tip(self, branch, tip):
         self.tips[branch] = tip
index bd545aa380d3751fdfbc416cb20947035bb4ec8b..1e61f4327a338dc406958e68b0c2563bddbc6744 100755 (executable)
@@ -165,7 +165,7 @@ class Marks:
         return self.marks[rev]
 
     def to_rev(self, mark):
-        return self.rev_marks[mark]
+        return str(self.rev_marks[mark])
 
     def next_mark(self):
         self.last_mark += 1
@@ -185,7 +185,10 @@ class Marks:
         return rev in self.marks
 
     def get_tip(self, branch):
-        return self.tips.get(branch, None)
+        try:
+            return str(self.tips[branch])
+        except KeyError:
+            return None
 
     def set_tip(self, branch, tip):
         self.tips[branch] = tip