schacon / hg-git

mercurial to git bridge, pushed to directly from the hg-git plugin in Hg
GNU General Public License v2.0
620 stars 72 forks source link

merge to branch rather than default branch #320

Open rammuralidhar opened 7 years ago

rammuralidhar commented 7 years ago

We have requirement where we need to pull changes to branch rather than "default branch".

If I do hg pull , the commit gets pulled to the default branch even though my checkout branch is branch other than "default".

I changed "git2hg.py" -

def extract_hg_metadata(message, git_extra,repo): split = message.split("\n--HG--\n", 1)

Renames are explicitly stored in Mercurial but inferred in Git. For

# commits that originated in Git we'd like to optionally infer rename
# information to store in Mercurial, but for commits that originated in
# Mercurial we'd like to disable this. How do we tell whether the commit
# originated in Mercurial or in Git? We rely on the presence of extra hg-git
# fields in the Git commit.
# - Commits exported by hg-git versions past 0.7.0 always store at least one
#   hg-git field.
# - For commits exported by hg-git versions before 0.7.0, this becomes a
#   heuristic: if the commit has any extra hg fields, it definitely originated
#   in Mercurial. If the commit doesn't, we aren't really sure.
# If we think the commit originated in Mercurial, we set renames to a
# dict. If we don't, we set renames to None. Callers can then determine
# whether to infer rename information.
renames = None
extra = {}
file = repo.opener('branch')

**branch = None.**

to

branch = test

The commit seems to go the branch named "test", but it is creating multiple heads,

Any feedback on avoiding multiple heads will be appreciated..