import json
import re
import StringIO
+import atexit
NAME_RE = re.compile('^([^<>]+)')
AUTHOR_RE = re.compile('^([^<>]+?)? ?<([^<>]*)>$')
return self.last_mark
def is_marked(self, rev):
- return str(rev) in self.marks
+ return rev in self.marks
def new_mark(self, rev, mark):
self.marks[rev] = mark
else:
mode = '100644'
- # is the blog already exported?
+ # is the blob already exported?
if h in filenodes:
mark = filenodes[h]
final.append((mode, mark, path))
return string
def parse_commit(parser):
- global marks, blob_marks, bmarks, parsed_refs
+ global marks, blob_marks, parsed_refs
global mode
parents = []
for ref, revid in parsed_refs.iteritems():
if ref == 'refs/heads/master':
repo.generate_revision_history(revid, marks.get_tip('master'))
- revno, revid = repo.last_revision_info()
if peer:
- if hasattr(peer, "import_last_revision_info_and_tags"):
- peer.import_last_revision_info_and_tags(repo, revno, revid)
- else:
- peer.import_last_revision_info(repo.repository, revno, revid)
+ try:
+ repo.push(peer, stop_revision=revid)
+ except bzrlib.errors.DivergedBranches:
+ print "error %s non-fast forward" % ref
+ continue
else:
wt = repo.bzrdir.open_workingtree()
wt.update()
print "ok %s" % ref
+
print
def do_capabilities(parser):
blob_marks = {}
parsed_refs = {}
files_cache = {}
+ marks = None
gitdir = os.environ['GIT_DIR']
dirname = os.path.join(gitdir, 'bzr', alias)
die('unhandled command: %s' % line)
sys.stdout.flush()
+def bye():
+ if not marks:
+ return
marks.store()
+atexit.register(bye)
sys.exit(main(sys.argv))