felipec / git-remote-hg

Transparent bidirectional bridge between Git and Mercurial for Git
GNU General Public License v2.0
369 stars 87 forks source link

How to map hg tags & branches to git branches? #40

Closed MarkCallow closed 8 years ago

MarkCallow commented 9 years ago

I am a first time user of git-remote-hg. I cloned an hg repo whose web browser view shows more than 20 branches and also a large number of tags, none of which is called "master".

git branch --list

shows a single branch master.

How can I confirm that this master branch maps to default in origin? Does it? As there is no master branch in the remote hg repo I am guessing that this is what must be happening.

git remote show origin

shows

searching for changes
adding changesets
adding manifests
adding file changes
added 5 changesets with 6 changes to 6 files
* remote origin
  Fetch URL: hg::http://hg.libsdl.org/SDL
  Push  URL: hg::http://hg.libsdl.org/SDL
  HEAD branch: master
  Remote branches:
    branches/SDL-1.2 tracked
    branches/default tracked
    master           tracked
  Local branch configured for 'git pull':
    master merges with remote master
  Local ref configured for 'git push':
    master pushes to master (create)

The items under branches are the first 2 branches listed by the web browser view of the origin depot. Is there any way to get these branches to show up as regular git branches so that git branch shows them?

I don't need them right now but is there any way to include the other branches from the remote?

Is there any way to create git branches corresponding to the hg tags?

The multiple statements implying there is something called master at the remote are very confusing.

I'm sure I can't be the only person with these questions. Is there documentation somewhere that I failed to find?

BTW, you need to have hg installed so the comment on the home page to the effect that you simply need to copy the script to somewhere in your $PATH is wrong.

fingolfin commented 8 years ago

@msc- The documentation you failed to find probably is the git documentation (which definitely exists) ;-). I recommend reading up on git remotes, and remote tracking branches. A possible place to do so (google for more):

Concerning your concrete issue: Try git branch -a to see all branches, including remote branches. I'll give a full example based on your specific situation:

$ git clone hg::http://hg.libsdl.org/SDL
Cloning into 'SDL'...
requesting all changes
adding changesets
adding manifests
adding file changes
added 9943 changesets with 41179 changes to 4835 files (+1 heads)
progress revision 99 'master' (100/8458)
...
Checking connectivity... done.
$ cd SDL
$ git branch -a
* master
  remotes/origin/HEAD -> origin/master
  remotes/origin/branches/SDL-1.2
  remotes/origin/branches/default
  remotes/origin/master
$ git checkout branches/SDL-1.2
Branch branches/SDL-1.2 set up to track remote branch branches/SDL-1.2 from origin.
Switched to a new branch 'branches/SDL-1.2'
$ git branch -a
* branches/SDL-1.2
  master
  remotes/origin/HEAD -> origin/master
  remotes/origin/branches/SDL-1.2
  remotes/origin/branches/default
  remotes/origin/master
$

You also write:

BTW, you need to have hg installed so the comment on the home page to the effect that you simply need to copy the script to somewhere in your $PATH is wrong

This has been addressed (together with many other issues) in my fork of git-remote-hg, see https://github.com/fingolfin/git-remote-hg