* [PATCH 0/4] remote-helpers: general fixes
@ 2012-11-28 1:01 Felipe Contreras
2012-11-28 1:01 ` [PATCH 1/4] remote-hg: fix for files with spaces Felipe Contreras
` (4 more replies)
0 siblings, 5 replies; 8+ messages in thread
From: Felipe Contreras @ 2012-11-28 1:01 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano, Felipe Contreras
Hi,
These are general fixes, some for old versions of bazaar, mercurial, and
python. Some of these have already been sent, but here they go alone so they
are not missed.
The bazaar fixes are on top of the series v3 which is still not in 'pu'.
Felipe Contreras (4):
remote-hg: fix for files with spaces
remote-hg: fix for older versions of python
remote-bzr: add support for older versions of bzr
remote-bzr: detect local repositories
contrib/remote-helpers/git-remote-bzr | 54 +++++++++++++++++++++--------------
contrib/remote-helpers/git-remote-hg | 14 +++++----
2 files changed, 42 insertions(+), 26 deletions(-)
--
1.8.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/4] remote-hg: fix for files with spaces
2012-11-28 1:01 [PATCH 0/4] remote-helpers: general fixes Felipe Contreras
@ 2012-11-28 1:01 ` Felipe Contreras
2012-11-28 1:01 ` [PATCH 2/4] remote-hg: fix for older versions of python Felipe Contreras
` (3 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Felipe Contreras @ 2012-11-28 1:01 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano, Felipe Contreras
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
contrib/remote-helpers/git-remote-hg | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/contrib/remote-helpers/git-remote-hg b/contrib/remote-helpers/git-remote-hg
index 07754bd..62c39db 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -565,7 +565,7 @@ def parse_commit(parser):
for line in parser:
if parser.check('M'):
- t, m, mark_ref, path = line.split(' ')
+ t, m, mark_ref, path = line.split(' ', 3)
mark = int(mark_ref[1:])
f = { 'mode' : hgmode(m), 'data' : blob_marks[mark] }
elif parser.check('D'):
--
1.8.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/4] remote-hg: fix for older versions of python
2012-11-28 1:01 [PATCH 0/4] remote-helpers: general fixes Felipe Contreras
2012-11-28 1:01 ` [PATCH 1/4] remote-hg: fix for files with spaces Felipe Contreras
@ 2012-11-28 1:01 ` Felipe Contreras
2012-11-28 1:01 ` [PATCH 3/4] remote-bzr: add support for older versions of bzr Felipe Contreras
` (2 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Felipe Contreras @ 2012-11-28 1:01 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano, Felipe Contreras
As Amit Bakshi reported, older versions of python (< 2.7) don't have
subprocess.check_output, so let's use subprocess.Popen directly as
suggested.
Suggested-by: Amit Bakshi <ambakshi@gmail.com>
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
contrib/remote-helpers/git-remote-hg | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/contrib/remote-helpers/git-remote-hg b/contrib/remote-helpers/git-remote-hg
index 62c39db..016cdad 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -56,6 +56,12 @@ def hgmode(mode):
m = { '0100755': 'x', '0120000': 'l' }
return m.get(mode, '')
+def get_config(config):
+ cmd = ['git', 'config', '--get', config]
+ process = subprocess.Popen(cmd, stdout=subprocess.PIPE)
+ output, _ = process.communicate()
+ return output
+
class Marks:
def __init__(self, path):
@@ -727,12 +733,10 @@ def main(args):
hg_git_compat = False
track_branches = True
try:
- cmd = ['git', 'config', '--get', 'remote-hg.hg-git-compat']
- if subprocess.check_output(cmd) == 'true\n':
+ if get_config('remote-hg.hg-git-compat') == 'true\n':
hg_git_compat = True
track_branches = False
- cmd = ['git', 'config', '--get', 'remote-hg.track-branches']
- if subprocess.check_output(cmd) == 'false\n':
+ if get_config('remote-hg.track-branches') == 'false\n':
track_branches = False
except subprocess.CalledProcessError:
pass
--
1.8.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/4] remote-bzr: add support for older versions of bzr
2012-11-28 1:01 [PATCH 0/4] remote-helpers: general fixes Felipe Contreras
2012-11-28 1:01 ` [PATCH 1/4] remote-hg: fix for files with spaces Felipe Contreras
2012-11-28 1:01 ` [PATCH 2/4] remote-hg: fix for older versions of python Felipe Contreras
@ 2012-11-28 1:01 ` Felipe Contreras
2012-11-28 1:01 ` [PATCH 4/4] remote-bzr: detect local repositories Felipe Contreras
2012-11-28 2:02 ` [PATCH 0/4] remote-helpers: general fixes Junio C Hamano
4 siblings, 0 replies; 8+ messages in thread
From: Felipe Contreras @ 2012-11-28 1:01 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano, Felipe Contreras
At least as old as 2.0.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
contrib/remote-helpers/git-remote-bzr | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/contrib/remote-helpers/git-remote-bzr b/contrib/remote-helpers/git-remote-bzr
index f8919f4..6cdfac6 100755
--- a/contrib/remote-helpers/git-remote-bzr
+++ b/contrib/remote-helpers/git-remote-bzr
@@ -17,7 +17,8 @@
import sys
import bzrlib
-bzrlib.initialize()
+if hasattr(bzrlib, "initialize"):
+ bzrlib.initialize()
import bzrlib.plugin
bzrlib.plugin.load_plugins()
@@ -553,7 +554,7 @@ def parse_commit(parser):
repo.lock_write()
try:
- builder = repo.get_commit_builder(parents, None, date, tz, committer, props, revid, False)
+ builder = repo.get_commit_builder(parents, None, date, tz, committer, props, revid)
try:
list(builder.record_iter_changes(mtree, mtree.last_revision(), changes))
builder.finish_inventory()
@@ -612,7 +613,10 @@ def do_export(parser):
if ref == 'refs/heads/master':
repo.generate_revision_history(revid, marks.get_tip('master'))
revno, revid = repo.last_revision_info()
- peer.import_last_revision_info_and_tags(repo, revno, revid)
+ if hasattr(peer, "import_last_revision_info_and_tags"):
+ peer.import_last_revision_info_and_tags(repo, revno, revid)
+ else:
+ peer.import_last_revision_info(repo.repository, revno, revid)
wt = peer.bzrdir.open_workingtree()
wt.update()
print "ok %s" % ref
@@ -646,12 +650,12 @@ def get_repo(url, alias):
global dirname, peer
clone_path = os.path.join(dirname, 'clone')
- origin = bzrlib.controldir.ControlDir.open(url)
+ origin = bzrlib.bzrdir.BzrDir.open(url)
remote_branch = origin.open_branch()
if os.path.exists(clone_path):
# pull
- d = bzrlib.controldir.ControlDir.open(clone_path)
+ d = bzrlib.bzrdir.BzrDir.open(clone_path)
branch = d.open_branch()
result = branch.pull(remote_branch, [], None, False)
else:
--
1.8.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 4/4] remote-bzr: detect local repositories
2012-11-28 1:01 [PATCH 0/4] remote-helpers: general fixes Felipe Contreras
` (2 preceding siblings ...)
2012-11-28 1:01 ` [PATCH 3/4] remote-bzr: add support for older versions of bzr Felipe Contreras
@ 2012-11-28 1:01 ` Felipe Contreras
2012-11-28 2:02 ` [PATCH 0/4] remote-helpers: general fixes Junio C Hamano
4 siblings, 0 replies; 8+ messages in thread
From: Felipe Contreras @ 2012-11-28 1:01 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano, Felipe Contreras
So we don't create a clone unnecessarily.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
contrib/remote-helpers/git-remote-bzr | 48 ++++++++++++++++++++---------------
1 file changed, 28 insertions(+), 20 deletions(-)
diff --git a/contrib/remote-helpers/git-remote-bzr b/contrib/remote-helpers/git-remote-bzr
index 6cdfac6..c5822e4 100755
--- a/contrib/remote-helpers/git-remote-bzr
+++ b/contrib/remote-helpers/git-remote-bzr
@@ -24,6 +24,7 @@ import bzrlib.plugin
bzrlib.plugin.load_plugins()
import bzrlib.generate_ids
+import bzrlib.transport
import sys
import os
@@ -613,11 +614,14 @@ def do_export(parser):
if ref == 'refs/heads/master':
repo.generate_revision_history(revid, marks.get_tip('master'))
revno, revid = repo.last_revision_info()
- if hasattr(peer, "import_last_revision_info_and_tags"):
- peer.import_last_revision_info_and_tags(repo, revno, revid)
+ if peer:
+ if hasattr(peer, "import_last_revision_info_and_tags"):
+ peer.import_last_revision_info_and_tags(repo, revno, revid)
+ else:
+ peer.import_last_revision_info(repo.repository, revno, revid)
+ wt = peer.bzrdir.open_workingtree()
else:
- peer.import_last_revision_info(repo.repository, revno, revid)
- wt = peer.bzrdir.open_workingtree()
+ wt = repo.bzrdir.open_workingtree()
wt.update()
print "ok %s" % ref
print
@@ -649,24 +653,28 @@ def do_list(parser):
def get_repo(url, alias):
global dirname, peer
- clone_path = os.path.join(dirname, 'clone')
origin = bzrlib.bzrdir.BzrDir.open(url)
- remote_branch = origin.open_branch()
-
- if os.path.exists(clone_path):
- # pull
- d = bzrlib.bzrdir.BzrDir.open(clone_path)
- branch = d.open_branch()
- result = branch.pull(remote_branch, [], None, False)
+ branch = origin.open_branch()
+
+ if not isinstance(origin.transport, bzrlib.transport.local.LocalTransport):
+ clone_path = os.path.join(dirname, 'clone')
+ remote_branch = branch
+ if os.path.exists(clone_path):
+ # pull
+ d = bzrlib.bzrdir.BzrDir.open(clone_path)
+ branch = d.open_branch()
+ result = branch.pull(remote_branch, [], None, False)
+ else:
+ # clone
+ d = origin.sprout(clone_path, None,
+ hardlink=True, create_tree_if_local=False,
+ source_branch=remote_branch)
+ branch = d.open_branch()
+ branch.bind(remote_branch)
+
+ peer = remote_branch
else:
- # clone
- d = origin.sprout(clone_path, None,
- hardlink=True, create_tree_if_local=False,
- source_branch=remote_branch)
- branch = d.open_branch()
- branch.bind(remote_branch)
-
- peer = remote_branch
+ peer = None
return branch
--
1.8.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 0/4] remote-helpers: general fixes
2012-11-28 1:01 [PATCH 0/4] remote-helpers: general fixes Felipe Contreras
` (3 preceding siblings ...)
2012-11-28 1:01 ` [PATCH 4/4] remote-bzr: detect local repositories Felipe Contreras
@ 2012-11-28 2:02 ` Junio C Hamano
2012-11-28 2:26 ` Felipe Contreras
2012-11-28 2:30 ` Junio C Hamano
4 siblings, 2 replies; 8+ messages in thread
From: Junio C Hamano @ 2012-11-28 2:02 UTC (permalink / raw)
To: Felipe Contreras; +Cc: git
Felipe Contreras <felipe.contreras@gmail.com> writes:
> These are general fixes, some for old versions of bazaar, mercurial, and
> python. Some of these have already been sent, but here they go alone so they
> are not missed.
>
> The bazaar fixes are on top of the series v3 which is still not in 'pu'.
Please stop then. Its v2 has been cooking in 'next' and it won't be
replaced.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 0/4] remote-helpers: general fixes
2012-11-28 2:02 ` [PATCH 0/4] remote-helpers: general fixes Junio C Hamano
@ 2012-11-28 2:26 ` Felipe Contreras
2012-11-28 2:30 ` Junio C Hamano
1 sibling, 0 replies; 8+ messages in thread
From: Felipe Contreras @ 2012-11-28 2:26 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
On Wed, Nov 28, 2012 at 3:02 AM, Junio C Hamano <gitster@pobox.com> wrote:
> Felipe Contreras <felipe.contreras@gmail.com> writes:
>
>> These are general fixes, some for old versions of bazaar, mercurial, and
>> python. Some of these have already been sent, but here they go alone so they
>> are not missed.
>>
>> The bazaar fixes are on top of the series v3 which is still not in 'pu'.
>
> Please stop then. Its v2 has been cooking in 'next' and it won't be
> replaced.
Cooking since when? 9 days ago? I sent the series 17 days ago. But
suit yourself. I re-rolled for a reason.
--
Felipe Contreras
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 0/4] remote-helpers: general fixes
2012-11-28 2:02 ` [PATCH 0/4] remote-helpers: general fixes Junio C Hamano
2012-11-28 2:26 ` Felipe Contreras
@ 2012-11-28 2:30 ` Junio C Hamano
1 sibling, 0 replies; 8+ messages in thread
From: Junio C Hamano @ 2012-11-28 2:30 UTC (permalink / raw)
To: Felipe Contreras; +Cc: git
Junio C Hamano <gitster@pobox.com> writes:
> Felipe Contreras <felipe.contreras@gmail.com> writes:
>
>> These are general fixes, some for old versions of bazaar, mercurial, and
>> python. Some of these have already been sent, but here they go alone so they
>> are not missed.
>>
>> The bazaar fixes are on top of the series v3 which is still not in 'pu'.
>
> Please stop then. Its v2 has been cooking in 'next' and it won't be
> replaced.
Picked up the -hg bit. The other two has to wait until
fc/remote-bzr gets updated (but see other thread).
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2012-11-28 2:30 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-28 1:01 [PATCH 0/4] remote-helpers: general fixes Felipe Contreras
2012-11-28 1:01 ` [PATCH 1/4] remote-hg: fix for files with spaces Felipe Contreras
2012-11-28 1:01 ` [PATCH 2/4] remote-hg: fix for older versions of python Felipe Contreras
2012-11-28 1:01 ` [PATCH 3/4] remote-bzr: add support for older versions of bzr Felipe Contreras
2012-11-28 1:01 ` [PATCH 4/4] remote-bzr: detect local repositories Felipe Contreras
2012-11-28 2:02 ` [PATCH 0/4] remote-helpers: general fixes Junio C Hamano
2012-11-28 2:26 ` Felipe Contreras
2012-11-28 2:30 ` Junio C Hamano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).