Closed techtonik closed 12 years ago
Moving refs in non-bare repos can fail. Nothing can be done on the hg-git side.
If you want support (rather than reporting a bug or feature request), I suggest you try the hg-git Google Group.
On 11/17/2011 12:04 AM, anatoly techtonik wrote:
I am not a Git expert, that's why I use Mercurial + Hg-Git. But it doesn't make your life easier, because you still have to look for workarounds for Git errors like this one.
I fetched openFrameworks repository (which is huge) using Git, then cloned it locally with Hg, made commits and tried to push back into local repository, but it failed:
$ hg push pushing to /home/user07/p/openFrameworks creating and sending data abort: git remote error: refs/heads/master failed to update
Full Traceback:
$ hg push --traceback --debug -v pushing to /home/user07/p/openFrameworks creating and sending data Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 87, in _runcatch return _dispatch(req) File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 679, in _dispatch cmdpats, cmdoptions) File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 454, in runcommand ret = _runcommand(ui, options, cmd, d) File "/usr/lib/python2.7/dist-packages/mercurial/extensions.py", line 182, in wrap return wrapper(origfn, *args, **kwargs) File "/usr/lib/python2.7/dist-packages/hgext/color.py", line 368, in colorcmd return orig(ui_, opts, cmd, cmdfunc) File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 733, in _runcommand return checkargs() File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 687, in checkargs return cmdfunc() File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 676, in<lambda> d = lambda: util.checksignature(func)(ui, *args, **cmdoptions) File "/usr/lib/python2.7/dist-packages/mercurial/util.py", line 385, in check return func(*args, **kwargs) File "/usr/lib/python2.7/dist-packages/mercurial/commands.py", line 3884, in push newbranch=opts.get('new_branch')) File "/home/user07/p/hg-git/hggit/hgrepo.py", line 22, in push git.push(remote.path, revs, force) File "/home/user07/p/hg-git/hggit/git_handler.py", line 227, in push changed_refs = self.upload_pack(remote, revs, force) File "/home/user07/p/hg-git/hggit/git_handler.py", line 704, in upload_pack raise hgutil.Abort(_("git remote error: ") + str(e)) Abort: git remote error: refs/heads/master failed to update abort: git remote error: refs/heads/master failed to update
What should I do now? How to commit this stuff upstream? Can Hg-Git do something about this automatically?
Reply to this email directly or view it on GitHub: https://github.com/schacon/hg-git/issues/236
Why are those refs being updated? Could it be a bug with Hg-Git? I didn't do anything complicated - just committed new revision into the clone .
durin42, something should be done about this. Pushing to non-bare repos is possible. So what if git gets confused about the state of the cwd, that's a problem on the git side. hg-git should push, with warnings about non-bare repos, and let the git side handle its mess.
No. Pushing into a non-bare repository is something you're supposed to not do. We won't do anything that willfully breaks the Git working copy.
hg-git is no remedy for Git illness.
Yeah, using hg-git to use git is like trying to use Google translate to read Don Quixote.
... Except that Don Quixote is a pleasure to read, in any language.
@jordigh: If you're cloning into hg from git, could this problem be avoided ("the git way") by simply doing your initial git clone with --bare?
e.g. if you're doing:
git clone http://path/to/whatever
hg git-clone /local/path/to/git/clone # or whatever the hg command is
...
then just change that first line to
git clone --bare http://path/to/whatever
Is that, perhaps, the bit that's missing?
I'm unsure -- I randomly saw you mentioning this on IRC, and I'm unfamiliar with hg-git... I'm just guessing that the above might be helpful to someone (possibly @techtonik) whose primary unfamiliarity is with git, instead. (I.e. attempting to translate what @durin42 says into something concrete and specific enough to hopefully be helpful.)
Your first assumption is broken. I'm not cloning from git. I happily started on hg. Then I wanted to convert my hg repo to git.
In order to do this, I must (correct me if I'm wrong):
1) Create an empty git repo. 2) Convert this to a bare repo somehow (or investigate if there is --some --option to git init to create a bare repo) 3) Push from hg to the bare git repo 4) Pull from the bare repo into the normal git repo
Pain in the butt... and all because git made a mess of things.
man git-init | grep bare
On Wed, Apr 4, 2012 at 9:01 AM, jordigh reply@reply.github.com wrote:
Your first assumption is broken. I'm not cloning from git. I happily started on hg. Then I wanted to convert my hg repo to git.
In order to do this, I must (correct me if I'm wrong):
1) Create an empty git repo. 2) Convert this to a bare repo somehow (or investigate if there is --some --option to git init to create a bare repo) 3) Push from hg to the bare git repo 4) Pull from the bare repo into the normal git repo
Pain in the butt... and all because git made a mess of things.
Reply to this email directly or view it on GitHub: https://github.com/schacon/hg-git/issues/236#issuecomment-4953923
durin42, okay, so you collapsed steps 1 and 2. That still requires 3 steps to do what I wish were a simpler operation.
I ran into this issue after failing to push gigabytes of commits to a newly initted remote. I didn't want to push that data again, but I found I could convert the repository to a bare one and then manually add a master ref on the remote. First, on the hg clone, resolve the master hash:
grep $(hg id -i) .hg/git-mapfile | awk '{print $1}'
Then save the result of that command into the remote in $repo/refs/heads/master.
I am not a Git expert, that's why I use Mercurial + Hg-Git. But it doesn't make your life easier, because you still have to look for workarounds for Git errors like this one.
I fetched openFrameworks repository (which is huge) using Git, then cloned it locally with Hg, made commits and tried to push back into local repository, but it failed:
Full Traceback:
What should I do now? How to commit this stuff upstream? Can Hg-Git do something about this automatically?