Coder Social home page Coder Social logo

felipec / git Goto Github PK

View Code? Open in Web Editor NEW

This project forked from git/git

202.0 202.0 34.0 204.97 MB

Fork of Junio Hamano's git for users

License: Other

Makefile 0.78% Perl 5.54% CSS 0.05% Shell 37.71% C 49.96% C++ 0.13% Emacs Lisp 0.01% Python 0.87% Go 0.07% Tcl 4.05% JavaScript 0.24% M4 0.18% Roff 0.13% Batchfile 0.05% CMake 0.18% SmPL 0.06% ReScript 0.01%
git

git's People

Contributors

avar avatar bk2204 avatar bmwill avatar chriscool avatar denton-l avatar derrickstolee avatar drafnel avatar dscho avatar felipec avatar gitster avatar j6t avatar jiangxin avatar jnareb avatar jonathantanmy avatar jrn avatar mhagger avatar mjg avatar newren avatar npitre avatar paulusmack avatar pclouds avatar peff avatar rscharfe avatar spearce avatar stefanbeller avatar sunshineco avatar szeder avatar torvalds avatar trast avatar ttaylorr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

git's Issues

Unavailable URL results in cryptic error message

Say I make a typo and instead of

$ git clone hg::http://code.nsnam.org/ns-3-dev ns-3-dev-local-git

I write

$ git clone hg::http://code.nsnam.org/ns-3-devv ns-3-dev-local-git
Cloning into 'ns-3-dev-local-git'...
Traceback (most recent call last):
  File "/home/vedranm/bin/git-remote-hg", line 899, in 
    sys.exit(main(sys.argv))
  File "/home/vedranm/bin/git-remote-hg", line 866, in main
    repo = get_repo(url, alias)
  File "/home/vedranm/bin/git-remote-hg", line 319, in get_repo
    peer, dstpeer = hg.clone(myui, {}, url, local_path, update=True, pull=True)
  File "/usr/lib/python2.7/dist-packages/mercurial/hg.py", line 267, in clone
    srcpeer = peer(ui, peeropts, source)
  File "/usr/lib/python2.7/dist-packages/mercurial/hg.py", line 121, in peer
    return _peerorrepo(rui, path, create).peer()
  File "/usr/lib/python2.7/dist-packages/mercurial/hg.py", line 101, in _peerorrepo
    obj = _peerlookup(path).instance(ui, path, create)
  File "/usr/lib/python2.7/dist-packages/mercurial/httppeer.py", line 237, in instance
    inst._fetchcaps()
  File "/usr/lib/python2.7/dist-packages/mercurial/httppeer.py", line 57, in _fetchcaps
    self.caps = set(self._call('capabilities').split())
  File "/usr/lib/python2.7/dist-packages/mercurial/httppeer.py", line 170, in _call
    fp = self._callstream(cmd, **args)
  File "/usr/lib/python2.7/dist-packages/mercurial/httppeer.py", line 118, in _callstream
    resp = self.urlopener.open(req)
  File "/usr/lib/python2.7/urllib2.py", line 401, in open
    response = self._open(req, data)
  File "/usr/lib/python2.7/urllib2.py", line 419, in _open
    '_open', req)
  File "/usr/lib/python2.7/urllib2.py", line 379, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/dist-packages/mercurial/url.py", line 315, in http_open
    return self.do_open(httpconnection, req)
  File "/usr/lib/python2.7/dist-packages/mercurial/keepalive.py", line 257, in do_open
    raise urllib2.URLError(err)
urllib2.URLError: 
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/home/vedranm/bin/git-remote-hg", line 894, in bye
    marks.store()
NameError: global name 'marks' is not defined
Error in sys.exitfunc:
Traceback (most recent call last):
  File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/home/vedranm/bin/git-remote-hg", line 894, in bye
    marks.store()
NameError: global name 'marks' is not defined

Could this error be made a bit nicer?

removing hg remote leaves old refs around

Hi,

thanks for the awesome helpers.

It seems when deleting a hg remote X a lot of old references like "refs/hg/X/{bookmarks,branches}/*" stay around, meaning you'll still see them in git log --graph --all --decorate --oneline.

I'm not sure this is intended, but it's not very convenient. Just in case someone else runs into this: i got rid of them with git update-ref -d ref/hg/X/...

Absolute path causes 'git pull' to fail after move

I seems an absolute path is used somewhere and this causes certain commands to fail when you move a repository.

You can reproduce this thusly:

git clone hg::http://a.com/repository.git repository
mv repository ../
cd repository
git pull

This is the output of the failed pull.

$ git pull
Traceback (most recent call last): 
    File "/home/mjmdavis/bin/git-remote-hg", line 1231, in <module> 
    sys.exit(main(sys.argv)) 
    File "/home/mjmdavis/bin/git-remote-hg", line 1193, in main 
    repo = get_repo(url, alias) 
    File "/home/mjmdavis/bin/git-remote-hg", line 418, in get_repo 
    repo = hg.repository(myui, local_path) 
    File "/usr/lib/pymodules/python2.6/mercurial/hg.py", line 112, in repository 
    peer = _peerorrepo(ui, path, create) 
    File "/usr/lib/pymodules/python2.6/mercurial/hg.py", line 102, in _peerorrepo 
    obj = _peerlookup(path).instance(ui, path, create) 
    File "/usr/lib/pymodules/python2.6/mercurial/localrepo.py", line 2605, in instance 
    return localrepository(ui, util.urllocalpath(path), create) 
    File "/usr/lib/pymodules/python2.6/mercurial/localrepo.py", line 217, in __init__ 
    _('.hg/sharedpath points to nonexistent directory %s') % s) 
    mercurial.error.RepoError: .hg/sharedpath points to nonexistent directory /home/mjmdavis/code/repository/.git/hg/.hg 

Cannot push when using https authentication with git-remote-hg

I'm trying to use git-remote-hg with my fork of a project on codeplex. The clone url is https://hg.codeplex.com/forks/danliew/boogie. I'm using this as a submodule in my git project.

Cloning works absolutely fine :) . The problem is when I try to push I get this...

$ cd boogie/ # My submodule
$ git push origin
warning: hg.codeplex.com certificate with fingerprint da:92:fe:fd:56:3b:d8:88:38:08:d9:8b:5e:fb:9d:d7:4a:61:2e:9c not verified (check hostfingerprints or web.cacerts config setting)
searching for changes
no changes found
searching for changes
Traceback (most recent call last):
  File "/home/dsl11/dev/git-remote-hg/git-remote-hg", line 1254, in <module>
    sys.exit(main(sys.argv))
  File "/home/dsl11/dev/git-remote-hg/git-remote-hg", line 1238, in main
    do_export(parser)
  File "/home/dsl11/dev/git-remote-hg/git-remote-hg", line 1119, in do_export
    if not push(parser.repo, peer, parsed_refs, p_revs):
  File "/home/dsl11/dev/git-remote-hg/git-remote-hg", line 1007, in push
    ret = push_unsafe(repo, remote, parsed_refs, p_revs)
  File "/home/dsl11/dev/git-remote-hg/git-remote-hg", line 990, in push_unsafe
    return remote.unbundle(cg, remoteheads, 'push')
  File "/usr/lib/python2.7/site-packages/mercurial/wireproto.py", line 308, in unbundle
    ret, output = self._callpush("unbundle", cg, heads=heads)
  File "/usr/lib/python2.7/site-packages/mercurial/httppeer.py", line 201, in _callpush
    r = self._call(cmd, data=fp, headers=headers, **args)
  File "/usr/lib/python2.7/site-packages/mercurial/httppeer.py", line 171, in _call
    fp = self._callstream(cmd, **args)
  File "/usr/lib/python2.7/site-packages/mercurial/httppeer.py", line 118, in _callstream
    resp = self.urlopener.open(req)
  File "/usr/lib/python2.7/urllib2.py", line 410, in open
    response = meth(req, response)
  File "/usr/lib/python2.7/urllib2.py", line 523, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib/python2.7/urllib2.py", line 442, in error
    result = self._call_chain(*args)
  File "/usr/lib/python2.7/urllib2.py", line 382, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 897, in http_error_401
    url, req, headers)
  File "/usr/lib/python2.7/site-packages/mercurial/url.py", line 436, in http_error_auth_reqed
    self, auth_header, host, req, headers)
  File "/usr/lib/python2.7/urllib2.py", line 872, in http_error_auth_reqed
    response = self.retry_http_basic_auth(host, req, realm)
  File "/usr/lib/python2.7/urllib2.py", line 878, in retry_http_basic_auth
    user, pw = self.passwd.find_user_password(realm, host)
  File "/usr/lib/python2.7/site-packages/mercurial/url.py", line 36, in find_user_password
    raise util.Abort(_('http authorization required'))
mercurial.error.Abort: http authorization required

Normally Mercurial prompts me for a username or password. Anyway I thought I'd try an alternative...
I tried putting authentication information into a hgrc file at .git/modules/boogie/hg/.hg/hgrc with the following contents

[auth]
cc.prefix = hg.codeplex.com
cc.username = myusername
# Eurgh fixme this shouldn't live here.
cc.password = PASSWORD
cc.schemes = https

however this made no difference. It does seem like the file is being parsed (because if I put invalid syntax running git push origin fails with a message about problems parsing my hgrc file) but the authorisation information is not being used.

AFAIK the [auth] section I put in the hgrc file is correct because when I used that with a normal mercurial clone of the project pushing worked fine using these login credentials.

Any ideas on how to fix this would be appreciated.

Cloning local repos with relative paths does not work

Suppose I have a repository "git-repo". Cloning this locally with a relative path like this

  git clone git-repo git-clone

works fine; git resolves the relative path and my .git/config ends up contains a full path, so that e.g. "git pull" later on works.

This is not the case when I use remote-hg:

$ git clone hg::hg-repo hg-clone
Cloning into 'hg-clone'...
$ cd hg-clone
$ git pull
Traceback (most recent call last):
[...]
mercurial.error.RepoError: repository hg-repo not found
$

Not a terrible problem (I can just use a full path), but inconvenient; would be nice if this could be fixed.

HG 2.2.2 funnies?

Hi Felipe,

I was using version 1f92042 of git-remote-hg and it was kind of going ok. Then I tried updating to the latest version from your repo.

Creating a new clone, I get this error:

rodney@solaria:~/dev % git clone hg::ssh://[email protected]/me/myrepo myrepo2
Cloning into 'myrepo2'...
requesting all changes
adding changesets
adding manifests
adding file changes
added 392 changesets with 3684 changes to 2843 files (+3 heads)
searching for changes
no changes found
Traceback (most recent call last):
  File "/home/rodney/bin/git-remote-hg", line 1128, in <module>
    sys.exit(main(sys.argv))
  File "/home/rodney/bin/git-remote-hg", line 1096, in main
    repo = get_repo(url, alias)
  File "/home/rodney/bin/git-remote-hg", line 398, in get_repo
    bookmarks.updatefromremote(myui, repo, rb, url)
  File "/usr/lib/python2.7/dist-packages/mercurial/bookmarks.py", line 195, in updatefromremote
    rb = remote.listkeys('bookmarks')
AttributeError: 'dict' object has no attribute 'listkeys'

I was thinking this could be due to a change in mercurial. I am running version 2.2.2.

I worked around this problem by changing contrib/remote-helpers/git-remote-hg:398 to

        bookmarks.updatefromremote(myui, repo, peer, url)

However the next error I got was:

rodney@solaria:~/dev % git clone hg::ssh://[email protected]/me/myrepo myrepo2
Cloning into 'myrepo2'...
requesting all changes
adding changesets
adding manifests
adding file changes
added 392 changesets with 3684 changes to 2843 files (+3 heads)
searching for changes
no changes found
Traceback (most recent call last):
  File "/home/rodney/bin/git-remote-hg", line 1127, in <module>
    sys.exit(main(sys.argv))
  File "/home/rodney/bin/git-remote-hg", line 1109, in main
    do_list(parser)
  File "/home/rodney/bin/git-remote-hg", line 587, in do_list
    heads = [h for h in heads if not repo[h].closesbranch()]
AttributeError: 'changectx' object has no attribute 'closesbranch'

Not sure what to do now, apart from go back to the working version. Is there a specific mercurial version which is required?

Cheers,

Rodney

Mercurial keyring support

Would be nice to support the mercurial keyring extension so you don't have to specify passwords in plain text.

Biggest issue I have found so far is because interactive is 'off' it will not ask you for a password (just blows up with a repository error). It works once the password is stored in the keyring (ie if you checkout the repo in hg beforehand).

planet bzr repos cannot be cloned

I admit this is git/git@3d092bf not from your repo, but could I at least ask for your opinion whether I should file a report on the list for this:

matej@wycliff: tmp$ git clone bzr::https://people.gnome.org/~jdub/bzr/planet/devel/trunk/ planetplanet-devel
Cloning into 'planetplanet-devel'...
Traceback (most recent call last):
  File "/home/matej/.local/bin/git-remote-bzr", line 947, in <module>
    sys.exit(main(sys.argv))
  File "/home/matej/.local/bin/git-remote-bzr", line 931, in main
    do_import(parser)
  File "/home/matej/.local/bin/git-remote-bzr", line 399, in do_import
    export_branch(repo, name)
  File "/home/matej/.local/bin/git-remote-bzr", line 324, in export_branch
    prev = repo.revision_tree(parent)
  File "<string>", line 4, in revision_tree_read_locked
  File "/usr/lib64/python2.7/site-packages/bzrlib/vf_repository.py", line 1838, in revision_tree
    inv = self.get_inventory(revision_id)
  File "<string>", line 4, in get_inventory_read_locked
  File "/usr/lib64/python2.7/site-packages/bzrlib/vf_repository.py", line 1731, in get_inventory
    return self.iter_inventories([revision_id]).next()
  File "/usr/lib64/python2.7/site-packages/bzrlib/vf_repository.py", line 1751, in iter_inventories
    raise errors.NoSuchRevision(self, revid)
bzrlib.errors.NoSuchRevision: CHKInventoryRepository('file:///tmp/planetplanet-devel/.git/bzr/.bzr/repository/') has no revision Arch-1:[email protected]%planet--devel--1.0--patch-47
fatal: stream ends early
fast-import: dumping crash report to /tmp/planetplanet-devel/.git/fast_import_crash_10147
fatal: Error while running fast-import
matej@wycliff: tmp$ bzr clone https://people.gnome.org/~jdub/bzr/planet/devel/trunk/ planetplanet-devel
The command 'bzr clone' has been deprecated in bzr 2.4. Please use 'bzr branch' instead.
Working tree format 3 is deprecated and a better format is available.
It is recommended that you upgrade by running the command
  bzr upgrade https://people.gnome.org/~jdub/bzr/planet/devel/trunk/
Branched 54 revisions.                                                           
matej@wycliff: tmp$ 

Filenames with spaces cause fatal errors

After adding a Mercurial remote to an existing Git repo, and git --fetching to synchronise, a git push --tags fails in two separate locations due to the existence of filenames with spaces in the changesets.

The errors occur in the parse_commit(parser) function, where the diff stat lines are split on whitespace. The existence of a filename with a space character causes the error (and a similar error later on line 624):

Traceback (most recent call last):
  File "/usr/local/bin/git-remote-hg", line 805, in 
    sys.exit(main(sys.argv))
  File "/usr/local/bin/git-remote-hg", line 795, in main
    do_export(parser)
  File "/usr/local/bin/git-remote-hg", line 689, in do_export
    parse_commit(parser)
  File "/usr/local/bin/git-remote-hg", line 577, in parse_commit
    t, path = line.split(' ')
ValueError: too many values to unpack
error: fast-export died of signal 13
fatal: Error while running fast-export

Setting the maxsplit value for these splits is my quick fix, but there may be a better way for a more experienced python dev. I'll add a pull request just in case.

'Object xxxx already has a mark' when pushing to hg repo

I have used git-remote-hg for pushing changes to Hg based sourceforge project for a long time and all was working correct on old git-remote-hg versions (I've used the script version maintained in separate repo until it was included in your git fork).
Now cloning remote repo works fine, but any push local commits to hg repo ends with something like:

error: Object ��Á�§ê*Žœ\O,K|�ö>å=ÿ� already has a mark
error: Object c�ê��ÍÆa�{  é-Ù����2üÿ� already has a mark
error: Object �=· Û*šV?ÄÔÝ6Ý­æwÈ­£ÿ� already has a mark
error: Object º�}ª��®�

Steps to reproduce:

mkdir /tmp/t
cd /tmp/t
hg clone http://hg.code.sf.net/p/frontaccounting/mercurial h
git clone hg::h g
cd g
echo bb >> f
git add f
git commit -m 'add bb'
git push

The problems appears regardless I try to push to remote or local Hg repo.
Git version installed is 1.7.9.5, Hg 2.0.2 on ubuntu.
Let me know if you need more information.

push ignores --dry-run and -n options and does the push

@felipec, are you still pursuing the goal to include your excellent work into the official git repo?

Here's a bug I've encountered recently: essentially, git push to the mercurial repo ignores both --dry-run and -n options and continues with the actual push, even though it should only do a dry run without any changes to the parent repository.

Release

Would be possible to have a release of the git-remote-hg/bzr tools?

pushing local change with outstanding remote changes = problem

Today my git clone of a hg repos got into a bad state, and I don't know how to recover from that...

What happened is this: While I made local changes, a colleague of mine had pushed to the mercurial repo without me being aware of that. Hence, when I did a "git push", I (resp. git-remote-helper) ended up creating a second head on the default branch, alas luckily only in the local hg clone -- it dies trying to push to the remote, as hg will not normally allow you to push a second head. (Incidentally, this is also part of the story behind issue #9). I found no good way to recover this (in particular, "git pull" also did not work anymore, I think)

Anyway: Even if I remember to always "git pull" before "git push", there is a short window in which somebody else can make a push to the remote repo... and by Murphy's law, this will happen eventually. So it would seem important to me to properly deal with this situation. For starters, I would be happy if there was any way to overcome that that didn't require me to manually edit mark files in my local repo...

Perfect of course would be if this situation could be handled like the corresponding situation when trying to push to a git remote with conflicting changes. But I am not sure if this is feasible at all within the remote helper framework. BUt even if it is not possible or too much work right now, some way to resolve this should be provided. Perhaps there is already a way, if that is the case, I'd love to learn how!

Tagging doesn't work

It doesn't seem possible to push a tag to a remote hg repo. I tagged and pushed (with --tags), but when I pulled to my hg clone, the tag wasn't present.

git and hg have very different models for tagging, so maybe we should just live with this, but perhaps someone's got a clever idea?

Trying to Parse email as int.

Hello,

I was trying to import the mozilla repo (git clone hg::http://hg.mozilla.org/mozilla-central/) and I got the following error near the end.

...
progress revision 119800 'master' (119800/160129)
progress revision 119900 'master' (119900/160129)
progress revision 120000 'master' (120000/160129)
Traceback (most recent call last):
  File "/usr/local/bin/git-remote-hg", line 1255, in <module>
    sys.exit(main(sys.argv))
  File "/usr/local/bin/git-remote-hg", line 1237, in main
    do_import(parser)
  File "/usr/local/bin/git-remote-hg", line 676, in do_import
    export_head(repo)
  File "/usr/local/bin/git-remote-hg", line 577, in export_head
    export_ref(repo, g_head[0], 'bookmarks', g_head[1])
  File "/usr/local/bin/git-remote-hg", line 465, in export_ref
    committer = "%s %s %s" % (user, time, gittz(int(tz)))
ValueError: invalid literal for int() with base 10: '<[email protected]>'
fatal: stream ends early
fast-import: dumping crash report to /home/kevincox/mozilla-central/.git/fast_import_crash_18181
fatal: Error while running fast-import

(git returned 128)

Some system stats.

% git --version
git version 1.8.4.2
% python2 --version
Python 2.7.6

Let me know if you need any more information.

git pull fails with latest git-remote-bzr in repositories cloned with git-remote-bzr from 1.8.2

I did a git bisect between 1.8.2 and HEAD, running git pull in a clone of the CEDET bzr repo. Results are below

git bisect start '--' 'contrib/remote-helpers/git-remote-bzr'
# bad: [06c68b1e7ecdef9ce5c7172c4a10237c5a47bc66] remote-hg: remove files before modifications
git bisect bad 06c68b1e7ecdef9ce5c7172c4a10237c5a47bc66
# good: [239222f587ed06f96d90dd71c66d80a2b1e3dc9f] Git 1.8.2
git bisect good 239222f587ed06f96d90dd71c66d80a2b1e3dc9f
# bad: [e2ca33de640c2c59142dedc18a2e932866515d10] remote-bzr: add support for shared repo
git bisect bad e2ca33de640c2c59142dedc18a2e932866515d10
# good: [31a033f7417a30ca045d5c5a8f3c77a0bbebfe2b] remote-bzr: trivial cleanups
git bisect good 31a033f7417a30ca045d5c5a8f3c77a0bbebfe2b
# good: [a853903e898c55f0354031265f305c38fef56711] remote-bzr: add support to push URLs
git bisect good a853903e898c55f0354031265f305c38fef56711
# good: [a22c6b106b0cb1fac317b45de7f7dcb2427aadc6] remote-bzr: always try to update the worktree
git bisect good a22c6b106b0cb1fac317b45de7f7dcb2427aadc6
# good: [c3eae3a382df879870d4b2352d0028258d7f8305] remote-bzr: use branch variable when appropriate
git bisect good c3eae3a382df879870d4b2352d0028258d7f8305
# bad: [7d809f4f2d61de0a03253d57806d646beffc4931] remote-bzr: add support for bzr repos
git bisect bad 7d809f4f2d61de0a03253d57806d646beffc4931

Git commit IDs change in unwanted way

Hi,

I'm trying to sync https://github.com/nsnam/ns-3-dev-git with http://code.nsnam.org/ns-3-dev the following way

$ git clone https://github.com/nsnam/ns-3-dev-git
$ cd ns-3-dev-git

Last two commits are commit d88765d33826d4bc0b78cc0ae9e2a21090a5290e and commit 816c48ce8457e8996066bae0150726b5119bb6de.

Fine, let's add Hg remote repo.

$ git remote add code-nsnam hg::http://code.nsnam.org/ns-3-dev
$ git fetch code-nsnam
$ git checkout code-nsnam/master

Same commits now have IDs 72150d331d917fd606a786070f0611c481058ae9 and 9de0a52639373183e751a36bd1fc3f5f5034a0d3.

Why does this happen? Is this by design, or is it a bug? If it's a bug, can it be fixed?

push failed when git branch is different than bzr branch name

Hi,

I can't push to bzr when my git branch is different than the bzr branch:

# create bzr repo
bzr init-repo bzr-repo ; bzr init bzr-repo/foo 
cd bzr-repo/foo ; echo a > a ; bzr add a ; bzr commit -m 'init a'               
cd ../../

# create git repo
git init git-repo 
cd git-repo/

# add bzr remote
git remote add bzr bzr::/tmp/demo/bzr-repo
git config remote.bzr.bzr-branches foo
git remote update bzr

# checkout bzr branch with another name
git checkout --track -b bar bzr/foo

# try to push some changes to bzr...
echo b > b ; git add b ; git commit -m 'commit b'
git push bzr HEAD:foo

# output:
Traceback (most recent call last):
  File "/usr/bin/git-remote-bzr", line 947, in <module>
    sys.exit(main(sys.argv))
  File "/usr/bin/git-remote-bzr", line 933, in main
    do_export(parser)
  File "/usr/bin/git-remote-bzr", line 670, in do_export
    parse_commit(parser)
  File "/usr/bin/git-remote-bzr", line 585, in parse_commit
    branch = get_remote_branch(name)
  File "/usr/bin/git-remote-bzr", line 762, in get_remote_branch
    remote_branch = bzrlib.branch.Branch.open(branches[name])
KeyError: 'bar'

It's work fine if i do this instead:

# checkout bzr branch with the same name
git checkout --track -b foo bzr/foo
echo b > b ; git add b ; git commit -m 'commit b'
git push

# output
All changes applied successfully.
To bzr::/tmp/demo/bzr-repo
   3aaf539..17fa622  foo -> foo

Is there any way to have a different name for my git branch ?

Thanks

Changing from local to remote causes error

Hey,

I found this fantastic plugin and i immeaditly started moving my repositories over. I hit one problem though.

$ git clone hg::sphinx-hg sphinx
$ cd sphinx
$ remote add -f upstream hg::ssh://[email protected]/birkenfeld/sphinx/
Updating upstream
Traceback (most recent call last):
  File "/usr/local/bin/git-remote-hg", line 1223, in <module>
    sys.exit(main(sys.argv))
  File "/usr/local/bin/git-remote-hg", line 1185, in main
    repo = get_repo(url, alias)
  File "/usr/local/bin/git-remote-hg", line 408, in get_repo
    hg.share(myui, shared_path, local_path, update=False)
  File "/home/russell/.virtualenvs/hg/local/lib/python2.7/site-packages/mercurial/hg.py", line 142, in share
    srcrepo = repository(ui, source)
  File "/home/russell/.virtualenvs/hg/local/lib/python2.7/site-packages/mercurial/hg.py", line 112, in repository
    peer = _peerorrepo(ui, path, create)
  File "/home/russell/.virtualenvs/hg/local/lib/python2.7/site-packages/mercurial/hg.py", line 102, in _peerorrepo
    obj = _peerlookup(path).instance(ui, path, create)
  File "/home/russell/.virtualenvs/hg/local/lib/python2.7/site-packages/mercurial/localrepo.py", line 2440, in instance
    return localrepository(ui, util.urllocalpath(path), create)
  File "/home/russell/.virtualenvs/hg/local/lib/python2.7/site-packages/mercurial/localrepo.py", line 200, in __init__
    raise error.RepoError(_("repository %s not found") % path)
mercurial.error.RepoError: repository .git/hg not found
error: Could not fetch upstream

I tested with the debian default version
mercurial - 2.6.2
git - 1.8.1.3

and
mercurial - 19375
git - f8abaeb

From what i can tell, local repositories are treated differently, I'm assuming this is to save space. I didn't find this to be very intuitive, but the local repository function makes sense. Do you think there would be some way to support both?

I did manage to fix my repository's by copying the .hg directiory into .git/hg, but it took we a while to figure that out.

Thanks,
Russell

remote-bzr: Converted repository is missing files

When converting our repository at

bzr://cedet.bzr.sourceforge.net/bzrroot/cedet/code/trunk

a diff over the original and the just created git repository shows that the latter is missing over 30 files.

Push to hg repo not git-like

Thank you very much for this!

The only thing that I found a bit annoying was that after pushing, git status says my repo is still ahead of the remote. This is despite the fact that the remote contains the changes I’ve pushed. I need to do a git fetch in order to sync the two up. Pure git doesn’t have this behaviour. Perhaps git push should be changed to do git push && git fetch?

user@host:~/someRepo[master*] $ git commit -m “Some message”
user@host:~/someRepo[master+] $ git push
Everything up-to-date
user@host:~/someRepo[master+] $ git status
# On branch master
# Your branch is ahead of ‘origin/master’ by 4 commits.
#
nothing to commit, working directory clean
user@host:~/someRepo[master+] $ git fetch
From hg::ssh://remoteHost//path/to/someRepo
742c327..5fcb7a2 master -> origin/master
742c327..5fcb7a2 branches/default -> origin/branches/default
user@host:~/someRepo[master] $ git status
# On branch master
nothing to commit, working directory clean

HTTPS pushing support

It turns out we need to provide the authentication info somehow. Not sure how to do that properly.

error on pull: fatal: Invalid raw date "" in ident: remote-hg <>

Hi there.
I'm using using mercurial 2.7.1, git 1.7.9 and python 2.7.3 from cygwin. I'm trying to clone an existing hg repository, but see a fatal error. I provide below my sequence of events, I do an init first because if I just do a clone, the .git directory containing crashdumps is removed on failure and I can't read them.

$ git init sapphire; cd sapphire
$ git remote add origin hg::https://code.google.com/p/pi3diamond
$ git pull
requesting all changes
adding changesets
adding manifests
adding file changes
added 473 changesets with 1482 changes to 416 files (+6 heads)
progress revision 0 'jan' (0/268)
progress revision 100 'jan' (100/268)
progress revision 200 'jan' (200/268)
fatal: Invalid raw date "" in ident: remote-hg <>
fast-import: dumping crash report to .git/fast_import_crash_5936
fatal: Error while running fast-import
Traceback (most recent call last):
  File "/usr/bin/git-remote-hg", line 1240, in <module>
    sys.exit(main(sys.argv))
  File "/usr/bin/git-remote-hg", line 1222, in main
    do_import(parser)
  File "/usr/bin/git-remote-hg", line 676, in do_import
    export_branch(repo, branch)
  File "/usr/bin/git-remote-hg", line 571, in export_branch

Googling, I found a similar error messages produced by fast-export, at
frej/fast-export#15, which seems to be the result of a mangled author. I note that the list of authors from a cloned version of the mercurial repository

$ hg log --template '{author}\n' | sort | uniq > authors.txt

doesn't seem to have anything obviously problematic (spurious < or >), but contains one line just noting User, so wondered whether that might be a blank one? I tried looking for options to provide author mappings, but couldn't find one for remote helpers. I'm probably way off the mark here, but I've reached the limit of my understanding at any rate. Any ideas?

git-remote-hg with "git remote add -f ..."

Also posted to WordPress blog:

I tried to do a remote add with a fetch and got the following error:

git remote add -f extern/ipython-physics hg::https://bitbucket.org/birkenfeld/ipython-physics
Updating extern/ipython-physics
Traceback (most recent call last):
  File "/usr/bin/git-remote-hg", line 1024, in <module>
    sys.exit(main(sys.argv))
  File "/usr/bin/git-remote-hg", line 992, in main
    repo = get_repo(url, alias)
  File "/usr/bin/git-remote-hg", line 383, in get_repo
    os.mkdir(dirname)
OSError: [Errno 2] No such file or directory: '.git/hg/extern/ipython-physics'
error: Could not fetch extern/ipython-physics

A few variations such as just adding the remote then doing a separate fetch didn’t work either. I am able to clone the mercurial repo, however. Ultimately I’m trying to add a remote to an existing repo to then insert it as a subtree dependency. Suggestions as to how I could achieve this would be appreciated!

TIA

FWIW, the next things I'm going to try and execute are:

git merge -s ours --no-commit extern/ipython-physics/master
git read-tree --prefix=subtree/ipython-physics -u extern/ipython-physics/master
git commit -m "Subtree merged in ipython-physics"
git pull -s subtree extern/ipython-physics master

Fatal error thrown by felipec-git on fast-import of Hg assets

I am using this rev of felipec-git:

93d24ea
branch 'fc/master'

Our Hg -> Git sync process is now failing with the error:

fatal: mark :547140 not declared
fast-import: dumping crash report to /var/git/the_repo.git/fast_import_crash_31937

From the E-mailed error reports I get, it looks to me like a series of events occurred during sequential sync operations that corrupted an import, which then corrupted my repository.

The first notification with error report and crash log: [https://gist.github.com/shaunlessman/f75bc2d9e80ad80e0f6e]

The second notification, no error, no crash: [https://gist.github.com/shaunlessman/002222814d8691685737]

The third notification, no error, no crash: [https://gist.github.com/shaunlessman/c3a6469cd141b73aa112]

The fourth notification with error report and crash log: [https://gist.github.com/shaunlessman/34113470d5f3d8c47a90]

The fifth notification with error report and crash log: [https://gist.github.com/shaunlessman/04580a867c55a8ccd08c]

The sixth notification with error report and crash log: [https://gist.github.com/shaunlessman/97f8f10568a2032953a5]

Most notifications and crash logs after the 6th look like a minor variation of this: [https://gist.github.com/shaunlessman/ea58c856ea1e73e839b8]

The only information that seems to change in the last notification posted is an increment in the number reported via 'fatal: mark :547256 not declared' of around 60.

I'm guessing the problem is occurring on an import of the refs/hg/origin/branches/PROJECT-3118-Update branch, that seems to be a common theme in the crash logs as well.

EDIT: The sync script I use is [https://gist.github.com/shaunlessman/7a2841bcac7e318d2f91], it runs every 15mins

Cloning local repos does not work when Mercurial extensions are enabled

I've read through #2, but it looks like I'm experiencing a different issue:

dusty:testgitexport $ git clone hg::`pwd`/upstream gitclone
  Cloning into 'gitclone'...
  error: refs/remotes/origin/master does not point to a valid object!
  error: Trying to write ref refs/heads/master with nonexistent object 0000000000000000000000000000000000000000
  fatal: Cannot update the ref 'HEAD'.
  Traceback (most recent call last):
  File "/home/dusty/bin/git-remote-hg", line 805, in <module>
    sys.exit(main(sys.argv))
  File "/home/dusty/bin/git-remote-hg", line 801, in main
    marks.store()
  File "/home/dusty/bin/git-remote-hg", line 93, in store
    json.dump(self.dict(), open(self.path, 'w'))
  IOError: [Errno 2] No such file or directory: '/home/dusty/testgitexport/gitclone/.git/hg/origin/marks-hg'

upstream is the simplest possible repository with one commit.

git-remote-hg works fine with complicated upstream repos, but this simple local one fails. I got around the issue by running sshd on my local machine, but that isn't a long-term solution.

Creating new branches?

According to https://felipec.wordpress.com/2012/11/13/git-remote-hg-bzr-2/, "You can create and push new branches… everything."

So I must be doing something wrong:

$ mkdir upstream
$ cd upstream
$ hg init .
$ echo a > a
$ hg add a
$ hg commit -m "a"
$ cd ..
$ git clone hg::ssh://localhost//home/dusty/testgitremote/upstream gitclone
Cloning into 'gitclone'...
dusty@localhost's password: 
$ cd gitclone
$ git checkout -b "feature"
Switched to a new branch 'feature'
$ echo b > b
$ git add b
$ git commit -m "new file in branch"
[feature f9ddec1] new file in branch
 1 file changed, 1 insertion(+)
 create mode 100644 b
$ git checkout master
Switched to branch 'master'
$ echo c>a
$ git add a
$ git commit -m "change file in master"
[master d44c03e] change file in master
 1 file changed, 1 insertion(+), 1 deletion(-)
$ git push
dusty@localhost's password: 
Everything up-to-date
$ git checkout feature
Switched to branch 'feature'
$ git push -u origin feature
dusty@localhost's password: 
Traceback (most recent call last):
  File "/home/dusty/bin/git-remote-hg", line 805, in <module>
To hg::ssh://localhost//home/dusty/testgitremote/upstream
 * [new branch]      feature -> feature
    sys.exit(main(sys.argv))
  File "/home/dusty/bin/git-remote-hg", line 795, in main
    do_export(parser)
  File "/home/dusty/bin/git-remote-hg", line 721, in do_export
    parser.repo.push(peer, force=False)
  File "/usr/lib/python2.7/site-packages/mercurial/localrepo.py", line 1890, in push
Branch feature set up to track remote branch feature from origin.
    bool(inc))
  File "/usr/lib/python2.7/site-packages/mercurial/discovery.py", line 333, in checkheads
    raise util.Abort(error, hint=hint)
mercurial.error.Abort: push creates new remote head 1f7350d295b5!

I do have remote-hg.hg-git-compat=true in my git config --global -l

Heres the output of git remote show origin

* remote origin
  Fetch URL: hg::ssh://localhost//home/dusty/testgitremote/upstream
  Push  URL: hg::ssh://localhost//home/dusty/testgitremote/upstream
  HEAD branch: master
  Remote branches:
    feature tracked
    master  tracked
  Local branches configured for 'git pull':
    feature merges with remote feature
    master  merges with remote master
  Local refs configured for 'git push':
    feature pushes to feature (create)
    master  pushes to master  (create)

I was excited to see a project that claimed everything just worked, but so far, my experiments have not proven that statement.

blogpost update

Searching for a mercurial bridge online i came across your blogpost... http://felipec.wordpress.com/2012/11/13/git-remote-hg-bzr-2/

I ran into several problems not realizing i had used an older version (this repo) instead of https://raw.github.com/git/git/master/contrib/remote-helpers/git-remote-hg .

I think it would be cool if you updated that blog post, putting a notice on top to make people aware of the fact that this is in upstream git and maybe even point them there instead of to this repo (which contains the older version it seems).

Fetches after cloning fail if there's a tag on a commit which can't be found

I tried cloning the repo for bitlbee (http://code.bitlbee.org/bitlbee/) using the bzr remote helper. I'm on Debian 7.0, using git 1.8.2 and bzrlib 2.6.0~bzr6571. The clone is successful apart from this error:

WARNING: TODO: fetch tag '1.2.7-1'
error: refs/tags/1.2.7-1 does not point to a valid object!

and subsequent fetches fail with

WARNING: TODO: fetch tag '1.2.7-1'i
fatal: bad object 0000000000000000000000000000000000000000
error: bzr::http://code.bitlbee.org/bitlbee/ did not send all necessary objects

Looking the tags in bzr it appears that tag is on a commit which doesn't exist. I don't know bzr well enough to know if that's invalid; there are no warnings or errors when cloning the branch with bzr and bzr check doesn't complain about it either. The helper should probably ignore tags if they point to non-existent commits.

I worked out which commit the tag was probably supposed to be on and added it with git and I can now pull without errors, so it's possible to work around the problem.

problem with non-ascii in comitter name for git-remote-bzr

The comitter name contains an apostrophed e, which I suspect can be a problem.

The pull request causing the problem can be viewed here:
jave/xwidget-emacs#1

git push origin xwidget

DEBUG: initializing
DEBUG: fetching remote 'origin' 'bzr+ssh://[email protected]/emacs'
Updating bzr branches
DEBUG: pulling branch 'xwidget'
DEBUG: pulling branch 'xwidget'
Traceback (most recent call last):
File "/home/joakim/bin/git-remote-bzr", line 964, in
sys.exit(main(sys.argv))
File "/home/joakim/bin/git-remote-bzr", line 948, in main
do_export(parser)
File "/home/joakim/bin/git-remote-bzr", line 700, in do_export
parse_commit(parser)
File "/home/joakim/bin/git-remote-bzr", line 655, in parse_commit
builder = branch.get_commit_builder(parents, None, date, tz, committer, props, revid)
File "/usr/lib64/python2.7/site-packages/bzrlib/branch.py", line 734, in get_commit_builder
lossy)
File "/usr/lib64/python2.7/site-packages/bzrlib/vf_repository.py", line 1305, in get_commit_builder
lossy)
File "/usr/lib64/python2.7/site-packages/bzrlib/repofmt/pack_repo.py", line 110, in init
lossy=lossy)
File "/usr/lib64/python2.7/site-packages/bzrlib/vf_repository.py", line 117, in init
revision_id, lossy)
File "/usr/lib64/python2.7/site-packages/bzrlib/repository.py", line 104, in init
self._committer = committer.decode() # throw if non-ascii
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 2: ordinal not in range(128)
error: fast-export died of signal 13
fatal: Error while running fast-export

Problem pushing to remote Mercurial repo on Bitbucket, push to local file:// repo works normally

Hi,

I'm trying to push https://bitbucket.org/nsnam/ns-3-dev-git to https://bitbucket.org/nsnam/ns-3-dev with git-remote-hg. It will fail with KeyError exception even before it gets to "enter password" part.

However, if I have both repos locally, and I try to push to hg::file:// it prints out "Everything up to date" message and push works nicely.

I don't have enough experience with Git/Hg architecture to look into the issue myself. However, I would really like to use Git for ns-3 development, so I'm willing to help debugging this even if it requires recompiling Git, testing patches etc.

Git commits show up in the "draft" phase in BitBucket

I tried this out for the first time tonight. For the most part everything worked great. However when viewing the pushed commits on BitBucket they are in a draft phase instead of public. If I pull those commits in locally using hg they are public though (mercurial handles this case I believe since they came in externally.)

screenshot 2014-04-10 07 28 09

store HG SHA1s instead of integer revisions in the marks file

This was mentioned on dusty-phillips/gitifyhg#4 Basically, the marks mapping in gitifyhg is using integer revisions. This may be more efficient than using sha1s (test and confirm), but using the canonical sha1s as references instead.

Gitifyhg works fine without this change, but for future interreferencing, I suspect we would be better off changing it now than later.

git-remote-hg mysteriously fails

I was trying to do git fetch 'hg::https://bitbucket.org/mutt/mutt' and got the following error:

  warning: bitbucket.org certificate with fingerprint 67:b3:bf:9f:c5:38:0e:4c:dd:4e:8a:da:3d:11:1b:c2:a5:d1:6c:6b not verified (check hostfingerprints or web.cacerts config setting)
  requesting all changes
  adding changesets
  adding manifests
  adding file changes
  added 6357 changesets with 18001 changes to 536 files (+9 heads)
  progress revision 0 'master' (0/6348)
  progress revision 100 'master' (100/6348)
  progress revision 200 'master' (200/6348)
  progress revision 300 'master' (300/6348)
  progress revision 400 'master' (400/6348)
  progress revision 500 'master' (500/6348)
  progress revision 600 'master' (600/6348)
  progress revision 700 'master' (700/6348)
  progress revision 800 'master' (800/6348)
  progress revision 900 'master' (900/6348)
  progress revision 1000 'master' (1000/6348)
  progress revision 1100 'master' (1100/6348)
  progress revision 1200 'master' (1200/6348)
  progress revision 1300 'master' (1300/6348)
  progress revision 1400 'master' (1400/6348)
  progress revision 1500 'master' (1500/6348)
  progress revision 1600 'master' (1600/6348)
  progress revision 1700 'master' (1700/6348)
  progress revision 1800 'master' (1800/6348)
  progress revision 1900 'master' (1900/6348)
  progress revision 2000 'master' (2000/6348)
  progress revision 2100 'master' (2100/6348)
  progress revision 2200 'master' (2200/6348)
  progress revision 2300 'master' (2300/6348)
  progress revision 2400 'master' (2400/6348)
  progress revision 2500 'master' (2500/6348)
  progress revision 2600 'master' (2600/6348)
  progress revision 2700 'master' (2700/6348)
  progress revision 2800 'master' (2800/6348)
  progress revision 2900 'master' (2900/6348)
  progress revision 3000 'master' (3000/6348)
  progress revision 3100 'master' (3100/6348)
  progress revision 3200 'master' (3200/6348)
  progress revision 3300 'master' (3300/6348)
  progress revision 3400 'master' (3400/6348)
  progress revision 3500 'master' (3500/6348)
  progress revision 3600 'master' (3600/6348)
  progress revision 3700 'master' (3700/6348)
  progress revision 3800 'master' (3800/6348)
  progress revision 3900 'master' (3900/6348)
  progress revision 4000 'master' (4000/6348)
  progress revision 4100 'master' (4100/6348)
  progress revision 4200 'master' (4200/6348)
  progress revision 4300 'master' (4300/6348)
  progress revision 4400 'master' (4400/6348)
  progress revision 4500 'master' (4500/6348)
  progress revision 4600 'master' (4600/6348)
  progress revision 4700 'master' (4700/6348)
  progress revision 4800 'master' (4800/6348)
  progress revision 4900 'master' (4900/6348)
  progress revision 5000 'master' (5000/6348)
  progress revision 5100 'master' (5100/6348)
  progress revision 5200 'master' (5200/6348)
  progress revision 5300 'master' (5300/6348)
  progress revision 5400 'master' (5400/6348)
  progress revision 5500 'master' (5500/6348)
  progress revision 5600 'master' (5600/6348)
  progress revision 5700 'master' (5700/6348)
  progress revision 5800 'master' (5800/6348)
  progress revision 5900 'master' (5900/6348)
  progress revision 6000 'master' (6000/6348)
  progress revision 6100 'master' (6100/6348)
  progress revision 6200 'master' (6200/6348)
  progress revision 6300 'master' (6300/6348)
  fatal: bad object 0000000000000000000000000000000000000000
  error: hg::https://bitbucket.org/mutt/mutt did not send all necessary objects

Let me know if there's anything else I can do to help repro this.

Push to new launchpad branch using git-remote-bzr

I'm trying a typical Launchpad MP workflow using git-remote-bzr.

Cloned the lp repository, I commited changes, and now I need to push them to a new LP branch, to then make a merge proposal.

Using bzr, I would bzr push lp:~<user>/<project>/<branch>:

bzr push lp:~dreis-pt/contract-management/7.0-project_sla-dr

So I try:

git push bzr::lp:~dreis-pt/contract-management/7.0-project_sla-dr

But this results in:

Traceback (most recent call last):
  File "/usr/bin/git-remote-bzr", line 946, in <module>
    sys.exit(main(sys.argv))
  File "/usr/bin/git-remote-bzr", line 918, in main
    repo = get_repo(url, alias)
  File "/usr/bin/git-remote-bzr", line 804, in get_repo
    origin = bzrlib.bzrdir.BzrDir.open(url, possible_transports=transports)
  File "/usr/lib/python2.7/dist-packages/bzrlib/controldir.py", line 687, in open
    _unsupported=_unsupported)
  File "/usr/lib/python2.7/dist-packages/bzrlib/controldir.py", line 721, in open_from_transport
    return format.open(transport, _found=True)
  File "/usr/lib/python2.7/dist-packages/bzrlib/bzrdir.py", line 1499, in open
    return self._open(transport)
  File "/usr/lib/python2.7/dist-packages/bzrlib/remote.py", line 317, in _open
    return RemoteBzrDir(transport, self)
  File "/usr/lib/python2.7/dist-packages/bzrlib/remote.py", line 436, in __init__
    self._probe_bzrdir()
  File "/usr/lib/python2.7/dist-packages/bzrlib/remote.py", line 448, in _probe_bzrdir
    self._rpc_open_2_1(path)
  File "/usr/lib/python2.7/dist-packages/bzrlib/remote.py", line 457, in _rpc_open_2_1
    raise errors.NotBranchError(path=self.root_transport.base)
bzrlib.errors.NotBranchError: Not a branch: "bzr+ssh://bazaar.launchpad.net/~dreis-pt/contract-management/7.0-project_sla-dr/".

I did read the available docs but found no help on this.

Cloning hg repo from Octave project crashes fast-import

I've recently found your tool, git-remote-hg, and attempted to give it a try for a hg project: Octave. During a clone of its repository, the clone will fail. This is always reproducible. Here is the output from the clone:

$ git clone hg::http://www.octave.org/hg/octave
Cloning into 'octave'...
real URL is http://hg.savannah.gnu.org/hgweb/octave
requesting all changes
adding changesets
adding manifests
adding file changes
added 18588 changesets with 113227 changes to 12475 files
progress revision 0 'master' (0/18588)
progress revision 100 'master' (100/18588)
progress revision 200 'master' (200/18588)
progress revision 300 'master' (300/18588)
progress revision 400 'master' (400/18588)
progress revision 500 'master' (500/18588)
progress revision 600 'master' (600/18588)
progress revision 700 'master' (700/18588)
progress revision 800 'master' (800/18588)
progress revision 900 'master' (900/18588)
progress revision 1000 'master' (1000/18588)
progress revision 1100 'master' (1100/18588)
progress revision 1200 'master' (1200/18588)
progress revision 1300 'master' (1300/18588)
progress revision 1400 'master' (1400/18588)
progress revision 1500 'master' (1500/18588)
progress revision 1600 'master' (1600/18588)
progress revision 1700 'master' (1700/18588)
progress revision 1800 'master' (1800/18588)
progress revision 1900 'master' (1900/18588)
progress revision 2000 'master' (2000/18588)
progress revision 2100 'master' (2100/18588)
progress revision 2200 'master' (2200/18588)
progress revision 2300 'master' (2300/18588)
progress revision 2400 'master' (2400/18588)
progress revision 2500 'master' (2500/18588)
progress revision 2600 'master' (2600/18588)
progress revision 2700 'master' (2700/18588)
progress revision 2800 'master' (2800/18588)
progress revision 2900 'master' (2900/18588)
progress revision 3000 'master' (3000/18588)
progress revision 3100 'master' (3100/18588)
progress revision 3200 'master' (3200/18588)
progress revision 3300 'master' (3300/18588)
progress revision 3400 'master' (3400/18588)
progress revision 3500 'master' (3500/18588)
progress revision 3600 'master' (3600/18588)
progress revision 3700 'master' (3700/18588)
progress revision 3800 'master' (3800/18588)
progress revision 3900 'master' (3900/18588)
progress revision 4000 'master' (4000/18588)
progress revision 4100 'master' (4100/18588)
progress revision 4200 'master' (4200/18588)
progress revision 4300 'master' (4300/18588)
progress revision 4400 'master' (4400/18588)
progress revision 4500 'master' (4500/18588)
progress revision 4600 'master' (4600/18588)
progress revision 4700 'master' (4700/18588)
progress revision 4800 'master' (4800/18588)
progress revision 4900 'master' (4900/18588)
progress revision 5000 'master' (5000/18588)
progress revision 5100 'master' (5100/18588)
progress revision 5200 'master' (5200/18588)
progress revision 5300 'master' (5300/18588)
progress revision 5400 'master' (5400/18588)
progress revision 5500 'master' (5500/18588)
progress revision 5600 'master' (5600/18588)
progress revision 5700 'master' (5700/18588)
progress revision 5800 'master' (5800/18588)
progress revision 5900 'master' (5900/18588)
progress revision 6000 'master' (6000/18588)
progress revision 6100 'master' (6100/18588)
progress revision 6200 'master' (6200/18588)
progress revision 6300 'master' (6300/18588)
progress revision 6400 'master' (6400/18588)
progress revision 6500 'master' (6500/18588)
progress revision 6600 'master' (6600/18588)
progress revision 6700 'master' (6700/18588)
progress revision 6800 'master' (6800/18588)
progress revision 6900 'master' (6900/18588)
progress revision 7000 'master' (7000/18588)
progress revision 7100 'master' (7100/18588)
progress revision 7200 'master' (7200/18588)
progress revision 7300 'master' (7300/18588)
progress revision 7400 'master' (7400/18588)
progress revision 7500 'master' (7500/18588)
progress revision 7600 'master' (7600/18588)
progress revision 7700 'master' (7700/18588)
progress revision 7800 'master' (7800/18588)
progress revision 7900 'master' (7900/18588)
progress revision 8000 'master' (8000/18588)
progress revision 8100 'master' (8100/18588)
progress revision 8200 'master' (8200/18588)
progress revision 8300 'master' (8300/18588)
progress revision 8400 'master' (8400/18588)
progress revision 8500 'master' (8500/18588)
progress revision 8600 'master' (8600/18588)
progress revision 8700 'master' (8700/18588)
progress revision 8800 'master' (8800/18588)
progress revision 8900 'master' (8900/18588)
progress revision 9000 'master' (9000/18588)
progress revision 9100 'master' (9100/18588)
progress revision 9200 'master' (9200/18588)
progress revision 9300 'master' (9300/18588)
progress revision 9400 'master' (9400/18588)
progress revision 9500 'master' (9500/18588)
progress revision 9600 'master' (9600/18588)
progress revision 9700 'master' (9700/18588)
progress revision 9800 'master' (9800/18588)
progress revision 9900 'master' (9900/18588)
progress revision 10000 'master' (10000/18588)
progress revision 10100 'master' (10100/18588)
progress revision 10200 'master' (10200/18588)
progress revision 10300 'master' (10300/18588)
progress revision 10400 'master' (10400/18588)
progress revision 10500 'master' (10500/18588)
progress revision 10600 'master' (10600/18588)
progress revision 10700 'master' (10700/18588)
progress revision 10800 'master' (10800/18588)
progress revision 10900 'master' (10900/18588)
progress revision 11000 'master' (11000/18588)
progress revision 11100 'master' (11100/18588)
progress revision 11200 'master' (11200/18588)
progress revision 11300 'master' (11300/18588)
progress revision 11400 'master' (11400/18588)
progress revision 11500 'master' (11500/18588)
progress revision 11600 'master' (11600/18588)
progress revision 11700 'master' (11700/18588)
progress revision 11800 'master' (11800/18588)
progress revision 11900 'master' (11900/18588)
progress revision 12000 'master' (12000/18588)
progress revision 12100 'master' (12100/18588)
progress revision 12200 'master' (12200/18588)
progress revision 12300 'master' (12300/18588)
progress revision 12400 'master' (12400/18588)
progress revision 12500 'master' (12500/18588)
progress revision 12600 'master' (12600/18588)
progress revision 12700 'master' (12700/18588)
progress revision 12800 'master' (12800/18588)
progress revision 12900 'master' (12900/18588)
progress revision 13000 'master' (13000/18588)
progress revision 13100 'master' (13100/18588)
progress revision 13200 'master' (13200/18588)
progress revision 13300 'master' (13300/18588)
fatal: Empty path component found in input
fast-import: dumping crash report to /home/brarcher/workspace/octave/.git/fast_import_crash_27916
fatal: Error while running fast-import
Traceback (most recent call last):
  File "/usr/bin/git-remote-hg", line 1254, in <module>
    sys.exit(main(sys.argv))
  File "/usr/bin/git-remote-hg", line 1236, in main
    do_import(parser)
  File "/usr/bin/git-remote-hg", line 675, in do_import
    export_head(repo)
  File "/usr/bin/git-remote-hg", line 576, in export_head
    export_ref(repo, g_head[0], 'bookmarks', g_head[1])
  File "/usr/bin/git-remote-hg", line 507, in export_ref
    modified_final = export_files(c.filectx(f) for f in modified)
  File "/usr/bin/git-remote-hg", line 282, in export_files
    print d
IOError: [Errno 32] Broken pipe
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/usr/bin/git-remote-hg", line 1249, in bye
    marks.store()
  File "/usr/bin/git-remote-hg", line 162, in store
    json.dump(self.dict(), open(self.path, 'w'))
IOError: [Errno 2] No such file or directory: '/home/brarcher/workspace/octave/.git/hg/origin/marks-hg'
Error in sys.exitfunc:
Traceback (most recent call last):
  File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/usr/bin/git-remote-hg", line 1249, in bye
    marks.store()
  File "/usr/bin/git-remote-hg", line 162, in store
    json.dump(self.dict(), open(self.path, 'w'))
IOError: [Errno 2] No such file or directory: '/home/brarcher/workspace/octave/.git/hg/origin/marks-hg'

problem with clone of bzr when umlaut in filename in code

I run this command:
git clone "bzr::lp:openpetraorg"

and get this stacktrace:

progress revision timotheus.pokorra@solidcharity.com-20120227100551-0vj3q83rc3zp4v97 (4000/5872)
Traceback (most recent call last):
File "/usr/bin/git-remote-bzr", line 739, in
sys.exit(main(sys.argv))
File "/usr/bin/git-remote-bzr", line 730, in main
do_import(parser)
File "/usr/bin/git-remote-bzr", line 358, in do_import
export_branch(branch, name)
File "/usr/bin/git-remote-bzr", line 314, in export_branch
print "M %s :%u %s" % f
UnicodeEncodeError: 'ascii' codec can't encode character u'\xfc' in position 59: ordinal not in range(128)
fatal: stream ends early
fast-import: dumping crash report to /home/timotheusp/openpetragit2/openpetraorg/.git/fast_import_crash_13837
fatal: Error while running fast-import

I did some debugging, and the content of f in line 314 is:
('100644', 28670, u'webserver/Samples/UploadDemo/388px-Droste-H\xfclshoff_2.jpg')
The name in bzr is: 388px-Droste-Hülshoff_2.jpg

I tried already to encode the filename as ascii, with path.encode('ascii', 'replace') in export_files line 243, but that did not help. I do not know enough about python...

Thanks for this nice tool!

Something is wrong with git-stage docs

Forgive me if this is something on my end, like an old xmlto. When I build git-fc I get this error:

  XMLTO git-stage.1
  xmlto: /home/frew/code/git-fc/Documentation/git-stage.xml does not validate (status 3)
  xmlto: Fix document syntax or use --skip-validation option
  /home/frew/code/git-fc/Documentation/git-stage.xml:27: element refsect1: validity error : Element refsect1 content does not follow the DTD, expecting (refsect1info? , (title , subtitle? , titleabbrev?) , (((calloutlist | glosslist | bibliolist | itemizedlist | orderedlist | segmentedlist | simplelist | variablelist | caution | important | note | tip | warning | literallayout | programlisting | programlistingco | screen | screenco | screenshot | synopsis | cmdsynopsis | funcsynopsis | classsynopsis | fieldsynopsis | constructorsynopsis | destructorsynopsis | methodsynopsis | formalpara | para | simpara | address | blockquote | graphic | graphicco | mediaobject | mediaobjectco | informalequation | informalexample | informalfigure | informaltable | equation | example | figure | table | msgset | procedure | sidebar | qandaset | task | anchor | bridgehead | remark | highlights | abstract | authorblurb | epigraph | indexterm | beginpage)+ , refsect2*) | refsect2+)), got (title )
  Document /home/frew/code/git-fc/Documentation/git-stage.xml does not validate
  make[1]: *** [git-stage.1] Error 13
  make[1]: Leaving directory `/home/frew/code/git-fc/Documentation'
  make: *** [doc] Error 2

I suspect you don't typically do "make doc". If I get a chance I'll try to shoot a patch.

Crash during push to Hg repo

git-remote-hg sometimes crashes on pushing local commits to Hg repo with error:

Traceback (most recent call last):
  File "/usr/local/bin/git-remote-hg", line 1234, in <module>
    sys.exit(main(sys.argv))
  File "/usr/local/bin/git-remote-hg", line 1218, in main
    do_export(parser)
  File "/usr/local/bin/git-remote-hg", line 1021, in do_export
    parse_commit(parser)
  File "/usr/local/bin/git-remote-hg", line 731, in parse_commit
    f = { 'mode' : hgmode(m), 'data' : blob_marks[mark] }
KeyError: 13617

If you will try again after the crash, git answers with 'Everything up-to-day' message. The crash is replicable, but seems to depend both on commit as well as repo content. Moreover, when after the crash you will delete mark related to the failed commit in marks-git file, next push ends successfully.

Steps to reproduce (using clone of our SF net repository):

#!/bin/bash
mkdir ./t
cd ./t
hg clone http://hg.code.sf.net/p/frontaccounting/mercurial h
hg update unstable
git clone hg::h -b branches/unstable g
cd g
echo '--- a/purchasing/includes/purchasing_db.inc
+++ b/purchasing/includes/purchasing_db.inc
@@ -9,6 +9,8 @@
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
     See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
 ***********************************************************************/
+include_once($path_to_root . "/purchasing/includes/supp_trans_class.inc");
+
 include_once($path_to_root . "/includes/banking.inc");

 include_once($path_to_root . "/includes/date_functions.inc");

' | patch -p1
git commit -a -m "test"
git push

Tested on git 1.7.9.5 and 1.7.10.4.

File permissions get incorrectly changed

In a hg repository, we have an executable shell script that is. After doing a clone with git-remote-hg, I made a fix to that file, then committed it in my git clone, the pushed it.

This caused the file executable settings in the hg repository to change from 755 to 644. This was not visible to me on the git side (in my working directory, the script was still set executable).

This reproduces the error:

mkdir test.hg
cd test.hg
hg init
echo "echo Hello" > script
chmod a+x script
hg add script
hg ci -m "Add script" script

cd ..
git clone hg::test.hg test.git
cd test.git
echo "echo Goodbye" > script
git ci -m update script
git push
cd ../test.hg
hg update

The final update will render the script non-executable in the hg repository. Interestingly, at this point script is still executable in test.git, and it stays executable even after a "git pull". In a fresh git clone, it is non-executable, though.

Can't push to upstream branches other than default

How can I list or pull a named branch from the upstream mercurial repository?

git branch -r doesn't list any of the mercurial branches, even after running git-fetch. Is git-remote-hg only able to handle the default upstream branch, or am I missing something incredibly obvious?

How to debug a failed git clone?

I'm trying to clone a large private repository. It works if I have track-branches turned off, but if I have it enabled, I get the following error:

dusty:test $ git clone hg::/home/dusty/code/panoptic/
Cloning into 'panoptic'...
warning: templates not found /home/dusty/share/git-core/templates
progress revision 99 'master' (100/1797)
progress revision 199 'master' (200/1797)
progress revision 299 'master' (300/1797)
progress revision 399 'master' (400/1797)
progress revision 499 'master' (500/1797)
progress revision 599 'master' (600/1797)
progress revision 699 'master' (700/1797)
progress revision 799 'master' (800/1797)
progress revision 899 'master' (900/1797)
progress revision 999 'master' (1000/1797)
progress revision 1099 'master' (1100/1797)
progress revision 1199 'master' (1200/1797)
progress revision 1299 'master' (1300/1797)
progress revision 1399 'master' (1400/1797)
progress revision 1499 'master' (1500/1797)
progress revision 1599 'master' (1600/1797)
progress revision 1699 'master' (1700/1797)
Traceback (most recent call last):
  File "/home/dusty/code/git/contrib/remote-helpers/git-remote-hg", line 848, in <module>
    sys.exit(main(sys.argv))
  File "/home/dusty/code/git/contrib/remote-helpers/git-remote-hg", line 835, in main
    do_import(parser)
  File "/home/dusty/code/git/contrib/remote-helpers/git-remote-hg", line 552, in do_import
    export_branch(repo, branch)
  File "/home/dusty/code/git/contrib/remote-helpers/git-remote-hg", line 439, in export_branch
    export_ref(repo, branch, 'branches', head)
  File "/home/dusty/code/git/contrib/remote-helpers/git-remote-hg", line 340, in export_ref
    revs = xrange(tip, head.rev() + 1)
TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'
fatal: stream ends early
fast-import: dumping crash report to /home/dusty/test/panoptic/.git/fast_import_crash_20995
fatal: Error while running fast-import

I tried adding some debugging information as follows:

    if tip and tip == head.rev():
        # nothing to do
        return
    log(tip)
    log(head)
    log(head.rev())
    revs = xrange(tip, head.rev() + 1)
    count = 0

When I run it with this code enabled, I get the following:

progress revision 1699 'master' (1700/1797)
DEBUG: 0
DEBUG: 10cf14cad52b
DEBUG: 1796
DEBUG: 0
DEBUG: b99fea23c8ab
DEBUG: 1777
DEBUG: 0
DEBUG: 59ca1175e6e1
DEBUG: 1681
DEBUG: 0
DEBUG: 10cf14cad52b+
DEBUG: None
Traceback (most recent call last):
  File "/home/dusty/code/git/contrib/remote-helpers/git-remote-hg", line 850, in <module>
    sys.exit(main(sys.argv))
  File "/home/dusty/code/git/contrib/remote-helpers/git-remote-hg", line 837, in main
    do_import(parser)
  File "/home/dusty/code/git/contrib/remote-helpers/git-remote-hg", line 554, in do_import
    export_branch(repo, branch)
  File "/home/dusty/code/git/contrib/remote-helpers/git-remote-hg", line 441, in export_branch
    export_ref(repo, branch, 'branches', head)
  File "/home/dusty/code/git/contrib/remote-helpers/git-remote-hg", line 342, in export_ref
    revs = xrange(tip, head.rev() + 1)
TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'
fatal: stream ends early
fast-import: dumping crash report to /home/dusty/test/panoptic/.git/fast_import_crash_21063
fatal: Error while running fast-import

Notice that head.rev() is becoming None when head is 10cf14cad52b+ That + character is confusing me. Further, notice that the rev, without the + is the same as the first one output. Does this have something to do with a merge or something?

Git is deleting the failed clone before I can introspect the fast_import_crash file, so I'm not sure how to get additional information out of there.

remote-bzr: Conversion of Emacs repository fails

I'm using latest git-remote-bzr (8161a84) to access the Emacs bzr repository (locally on disk, cloned from bzr://bzr.savannah.gnu.org/emacs/trunk/). When I try to convert the Emacs repository to git, I get the following backtrace after a few minutes:

Traceback (most recent call last):
  File "/home/void/bin/git-remote-bzr", line 755, in <module>
    sys.exit(main(sys.argv))
  File "/home/void/bin/git-remote-bzr", line 744, in main
    do_list(parser)
  File "/home/void/bin/git-remote-bzr", line 672, in do_list
    branch.revision_id_to_dotted_revno(revid)
  File "<string>", line 4, in revision_id_to_dotted_revno_read_locked
  File "/usr/lib/python2.7/site-packages/bzrlib/branch.py", line 399, in revision_id_to_dotted_revno
    return self._do_revision_id_to_dotted_revno(revision_id)
  File "/home/void/.bazaar/plugins/history_db/__init__.py", line 231, in _history_db_revision_id_to_dotted_revno
    revision_id_map = query.get_dotted_revnos([revision_id])
  File "/home/void/.bazaar/plugins/history_db/history_db.py", line 1385, in get_dotted_revnos
    % (rev_id,))
bzrlib.errors.BzrError: rev_id {[email protected]} not in database

check arguments count for git-remote-hg

git-remote-hg should check if it to be run directly by user, not by git - on line 1154 it does assumption that arguments always passed, and fails when there are no any.

Such situation may happen like this - someone downloaded tool, wanted to test, if it gonna start ok (like are there every python module exists and such, I needed to upgrade mercurial in my Debian Squeeze to backports version, there where errors on bookmarks import) and tool fails with exception errors.

From my POV it would be nice to add some short help message in such case.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.