Skip to content

Commit

Permalink
Ensure last_note is always correct
Browse files Browse the repository at this point in the history
Proposed by @felipec in felipec#56 (comment) to prevent a `git fast-import` crash from crashing git-remote-hg.
  • Loading branch information
fgb authored Aug 18, 2016
1 parent 822c6e4 commit f2a02f9
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions git-remote-hg
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,16 @@ class Marks:
'last-note': self.last_note }

def store(self):
found = False
path = os.path.join(dirname, 'marks-git')
with open(path, "r") as f:
for line in f:
if line.startswith(':%u ' % self.last_note):
found = True
break
if not found:
warn("Last note note found")
self.last_note = None
json.dump(self.dict(), open(self.path, 'w'))

def __str__(self):
Expand Down

0 comments on commit f2a02f9

Please sign in to comment.