Skip to content

Commit

Permalink
Add notes based on current notes ref
Browse files Browse the repository at this point in the history
  • Loading branch information
mnauw committed Jul 2, 2016
1 parent 822c6e4 commit 8f9d279
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions git-remote-hg
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,12 @@ def get_config_bool(config, default=False):
else:
return default

def rev_parse(rev):
cmd = ['git', 'rev-parse', '--verify', '-q', rev]
process = subprocess.Popen(cmd, stdout=subprocess.PIPE)
output, _ = process.communicate()
return output

class Marks:

def __init__(self, path, repo):
Expand Down Expand Up @@ -602,8 +608,11 @@ def export_ref(repo, name, kind, head):
desc = "Notes for %s\n" % (name)
print "data %d" % (len(desc))
print desc
if marks.last_note:
print "from :%u" % marks.last_note
# continue incrementally on current notes branch (whenever possible)
# to avoid wiping out present content upon fetch of new repo
current_note = rev_parse(ref)
if current_note:
print 'from %s^0' % (ref)

for rev in pending_revs:
notes.add(rev)
Expand Down

0 comments on commit 8f9d279

Please sign in to comment.