Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add notes based on current notes ref #59

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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