remote-helpers: improve marks usage

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>

Felipe Contreras committed May 24, 2013 at 21:30 UTC 8316d18da324f44b93faf36cddbf19411b53d101
2 files changed +9 -3
contrib/remote-helpers/git-remote-bzr
+4 -1
@@ -116,7 +116,10 @@ class Marks:
116 self.last_mark = mark
117
118 def get_tip(self, branch):
119 - return self.tips.get(branch, None)
119 + try:
120 + return str(self.tips[branch])
121 + except KeyError:
122 + return None
123
124 def set_tip(self, branch, tip):
125 self.tips[branch] = tip
contrib/remote-helpers/git-remote-hg
+5 -2
@@ -165,7 +165,7 @@ class Marks:
165 return self.marks[rev]
166
167 def to_rev(self, mark):
168 - return self.rev_marks[mark]
168 + return str(self.rev_marks[mark])
169
170 def next_mark(self):
171 self.last_mark += 1
@@ -185,7 +185,10 @@ class Marks:
185 return rev in self.marks
186
187 def get_tip(self, branch):
188 - return self.tips.get(branch, None)
188 + try:
189 + return str(self.tips[branch])
190 + except KeyError:
191 + return None
192
193 def set_tip(self, branch, tip):
194 self.tips[branch] = tip