Re: [PATCH v3 00/10] remote-hg: fixes and cleanups

2013-05-13 Thread Felipe Contreras
On Mon, May 13, 2013 at 8:08 PM, Junio C Hamano  wrote:

> Folks interested in working remote-hg, please try it out, so that we
> can have a polished one soon after 1.8.3 ships (I am not saying this
> round is not polished---I haven't even looked at the patches).
>
> And others, please spend time on testing the 1.8.3-rc2 to make sure
> what we are going to ship is free of embarrassing regressions.

If we want folks to test something, it should be the patches I
prepared for 'next' which I just sent.

Cheers.

-- 
Felipe Contreras
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 20/47] remote-hg: add version checks to the marks

2013-05-13 Thread Felipe Contreras
Signed-off-by: Felipe Contreras 
---
 contrib/remote-helpers/git-remote-hg | 16 +---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/contrib/remote-helpers/git-remote-hg 
b/contrib/remote-helpers/git-remote-hg
index a3618de..36b8fd4 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -55,6 +55,8 @@ EMAIL_RE = re.compile('^([^<>]+[^ \\\t<>])?\\b(?:[ 
\\t<>]*?)\\b([^ \\t<>]+@[^ \\
 AUTHOR_HG_RE = re.compile('^(.*?) ?<(.*?)(?:>(.+)?)?$')
 RAW_AUTHOR_RE = re.compile('^(\w+) (?:(.+)? )?<(.*)> (\d+) ([+-]\d+)')
 
+VERSION = 1
+
 def die(msg, *args):
 sys.stderr.write('ERROR: %s\n' % (msg % args))
 sys.exit(1)
@@ -103,12 +105,19 @@ class Marks:
 
 def __init__(self, path):
 self.path = path
+self.clear()
+self.load()
+
+if self.version < VERSION:
+self.clear()
+self.version = VERSION
+
+def clear(self):
 self.tips = {}
 self.marks = {}
 self.rev_marks = {}
 self.last_mark = 0
-
-self.load()
+self.version = 0
 
 def load(self):
 if not os.path.exists(self.path):
@@ -119,12 +128,13 @@ class Marks:
 self.tips = tmp['tips']
 self.marks = tmp['marks']
 self.last_mark = tmp['last-mark']
+self.version = tmp.get('version', 1)
 
 for rev, mark in self.marks.iteritems():
 self.rev_marks[mark] = int(rev)
 
 def dict(self):
-return { 'tips': self.tips, 'marks': self.marks, 'last-mark' : 
self.last_mark }
+return { 'tips': self.tips, 'marks': self.marks, 'last-mark' : 
self.last_mark, 'version' : self.version }
 
 def store(self):
 json.dump(self.dict(), open(self.path, 'w'))
-- 
1.8.3.rc1.579.g184e698

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 16/47] remote-hg: load all extensions

2013-05-13 Thread Felipe Contreras
The user might have then configured differently, plus, all of them will
be loaded anyway later on.

Signed-off-by: Felipe Contreras 
---
 contrib/remote-helpers/git-remote-hg | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/contrib/remote-helpers/git-remote-hg 
b/contrib/remote-helpers/git-remote-hg
index 96bed8d..60e875d 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -339,11 +339,7 @@ def get_repo(url, alias):
 if get_config_bool('remote-hg.insecure'):
 myui.setconfig('web', 'cacerts', '')
 
-try:
-mod = extensions.load(myui, 'hgext.schemes', None)
-mod.extsetup(myui)
-except ImportError:
-pass
+extensions.loadall(myui)
 
 if hg.islocal(url):
 repo = hg.repository(myui, url)
-- 
1.8.3.rc1.579.g184e698

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 29/47] remote-hg: add remote tests

2013-05-13 Thread Felipe Contreras
The logic when working with a local repository is totally different from
the one where we work with a remote repository; we need to pull and push
from it.

All this logic is currently not tested at all, so let's introduce a
variable to force the remote behavior.

Signed-off-by: Felipe Contreras 
---
 contrib/remote-helpers/git-remote-hg |  2 +-
 contrib/remote-helpers/test-hg.sh| 38 
 2 files changed, 39 insertions(+), 1 deletion(-)

diff --git a/contrib/remote-helpers/git-remote-hg 
b/contrib/remote-helpers/git-remote-hg
index 776c5af..6c7392f 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -368,7 +368,7 @@ def get_repo(url, alias):
 
 extensions.loadall(myui)
 
-if hg.islocal(url):
+if hg.islocal(url) and not os.environ.get('GIT_REMOTE_HG_TEST_REMOTE'):
 repo = hg.repository(myui, url)
 if not os.path.exists(dirname):
 os.makedirs(dirname)
diff --git a/contrib/remote-helpers/test-hg.sh 
b/contrib/remote-helpers/test-hg.sh
index dc71c37..44764a0 100755
--- a/contrib/remote-helpers/test-hg.sh
+++ b/contrib/remote-helpers/test-hg.sh
@@ -184,4 +184,42 @@ test_expect_success 'strip' '
test_cmp actual expected
 '
 
+GIT_REMOTE_HG_TEST_REMOTE=1
+export GIT_REMOTE_HG_TEST_REMOTE
+
+test_expect_success 'remote cloning' '
+   test_when_finished "rm -rf gitrepo*" &&
+
+   (
+   hg init hgrepo &&
+   cd hgrepo &&
+   echo zero > content &&
+   hg add content &&
+   hg commit -m zero
+   ) &&
+
+   git clone "hg::hgrepo" gitrepo &&
+   check gitrepo HEAD zero
+'
+
+test_expect_success 'remote update bookmark' '
+   test_when_finished "rm -rf gitrepo*" &&
+
+   (
+   cd hgrepo &&
+   hg bookmark devel
+   ) &&
+
+   (
+   git clone "hg::hgrepo" gitrepo &&
+   cd gitrepo &&
+   git checkout --quiet devel &&
+   echo devel > content &&
+   git commit -a -m devel &&
+   git push --quiet
+   ) &&
+
+   check_bookmark hgrepo devel devel
+'
+
 test_done
-- 
1.8.3.rc1.579.g184e698

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 45/47] remote-hg: use remote 'default' not local one

2013-05-13 Thread Felipe Contreras
Signed-off-by: Felipe Contreras 
---
 contrib/remote-helpers/git-remote-hg | 19 +--
 contrib/remote-helpers/test-hg.sh|  2 +-
 2 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/contrib/remote-helpers/git-remote-hg 
b/contrib/remote-helpers/git-remote-hg
index cacf2da..ff38fac 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -561,11 +561,11 @@ def get_branch_tip(repo, branch):
 def list_head(repo, cur):
 global g_head, bmarks
 
-if 'default' not in repo:
+if 'default' not in branches:
 # empty repo
 return
 
-node = repo['default']
+node = repo[branch_tip('default')]
 head = 'master' if not 'master' in bmarks else 'default'
 bmarks[head] = node
 
@@ -581,18 +581,17 @@ def do_list(parser):
 bmarks[bmark] = repo[node]
 
 cur = repo.dirstate.branch()
+orig = peer if peer else repo
+
+for branch, heads in orig.branchmap().iteritems():
+# only open heads
+heads = [h for h in heads if not repo[h].closesbranch()]
+if heads:
+branches[branch] = heads
 
 list_head(repo, cur)
 
 if track_branches:
-orig = peer if peer else repo
-
-for branch, heads in orig.branchmap().iteritems():
-# only open heads
-heads = [h for h in heads if not repo[h].closesbranch()]
-if heads:
-branches[branch] = heads
-
 for branch in branches:
 print "? refs/heads/branches/%s" % gitref(branch)
 
diff --git a/contrib/remote-helpers/test-hg.sh 
b/contrib/remote-helpers/test-hg.sh
index ecf7bd4..b3422c4 100755
--- a/contrib/remote-helpers/test-hg.sh
+++ b/contrib/remote-helpers/test-hg.sh
@@ -426,7 +426,7 @@ test_expect_success 'remote big push' '
check_bookmark hgrepo new_bmark ''
 '
 
-test_expect_failure 'remote double failed push' '
+test_expect_success 'remote double failed push' '
test_when_finished "rm -rf hgrepo gitrepo*" &&
 
(
-- 
1.8.3.rc1.579.g184e698

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 47/47] remote-hg: remove files before modifications

2013-05-13 Thread Felipe Contreras
Otherwise replacing a file with a directory doesn't work.

Signed-off-by: Felipe Contreras 
---
 contrib/remote-helpers/git-remote-hg | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/contrib/remote-helpers/git-remote-hg 
b/contrib/remote-helpers/git-remote-hg
index 24100df..6c7439e 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -491,10 +491,10 @@ def export_ref(repo, name, kind, head):
 if len(parents) > 1:
 print "merge :%s" % (rev_to_mark(parents[1]))
 
-for f in modified_final:
-print "M %s :%u %s" % f
 for f in removed:
 print "D %s" % (fix_file_path(f))
+for f in modified_final:
+print "M %s :%u %s" % f
 print
 
 progress = (rev - tip)
-- 
1.8.3.rc1.579.g184e698

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 46/47] remote-hg: improve lightweight tag author

2013-05-13 Thread Felipe Contreras
Use git's committer.

Signed-off-by: Felipe Contreras 
---
 contrib/remote-helpers/git-remote-hg | 18 ++
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/contrib/remote-helpers/git-remote-hg 
b/contrib/remote-helpers/git-remote-hg
index ff38fac..24100df 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -820,13 +820,23 @@ def write_tag(repo, tag, node, msg, author):
 
 p1 = tip.hex()
 p2 = '0' * 40
-if not author:
-author = (None, 0, 0)
-user, date, tz = author
+if author:
+user, date, tz = author
+date_tz = (date, tz)
+else:
+cmd = ['git', 'var', 'GIT_COMMITTER_IDENT']
+process = subprocess.Popen(cmd, stdout=subprocess.PIPE)
+output, _ = process.communicate()
+m = re.match('^.* <.*>', output)
+if m:
+user = m.group(0)
+else:
+user = repo.ui.username()
+date_tz = None
 
 ctx = context.memctx(repo, (p1, p2), msg,
 ['.hgtags'], getfilectx,
-user, (date, tz), {'branch' : branch})
+user, date_tz, {'branch' : branch})
 
 tmp = encoding.encoding
 encoding.encoding = 'utf-8'
-- 
1.8.3.rc1.579.g184e698

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 43/47] remote-hg: simplify branch_tip()

2013-05-13 Thread Felipe Contreras
It simply picks the last head that is not closed, but we have a stored
list of open heads.

Signed-off-by: Felipe Contreras 
---
 contrib/remote-helpers/git-remote-hg | 12 
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/contrib/remote-helpers/git-remote-hg 
b/contrib/remote-helpers/git-remote-hg
index df3b9a4..aff1161 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -541,12 +541,8 @@ def do_capabilities(parser):
 
 print
 
-def branch_tip(repo, branch):
-# older versions of mercurial don't have this
-if hasattr(repo, 'branchtip'):
-return repo.branchtip(branch)
-else:
-return repo.branchtags()[branch]
+def branch_tip(branch):
+return branches[branch][-1]
 
 def get_branch_tip(repo, branch):
 global branches
@@ -558,7 +554,7 @@ def get_branch_tip(repo, branch):
 # verify there's only one head
 if (len(heads) > 1):
 warn("Branch '%s' has more than one head, consider merging" % branch)
-return branch_tip(repo, hgref(branch))
+return branch_tip(hgref(branch))
 
 return heads[0]
 
@@ -808,7 +804,7 @@ def parse_tag(parser):
 
 def write_tag(repo, tag, node, msg, author):
 branch = repo[node].branch()
-tip = branch_tip(repo, branch)
+tip = branch_tip(branch)
 tip = repo[tip]
 
 def getfilectx(repo, memctx, f):
-- 
1.8.3.rc1.579.g184e698

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 44/47] remote-hg: improve branch listing

2013-05-13 Thread Felipe Contreras
We want to show the remote heads, not the internal ones, which might
have garbage.

Signed-off-by: Felipe Contreras 
---
 contrib/remote-helpers/git-remote-hg | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/contrib/remote-helpers/git-remote-hg 
b/contrib/remote-helpers/git-remote-hg
index aff1161..cacf2da 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -585,9 +585,12 @@ def do_list(parser):
 list_head(repo, cur)
 
 if track_branches:
-for branch in repo.branchmap():
-heads = repo.branchheads(branch)
-if len(heads):
+orig = peer if peer else repo
+
+for branch, heads in orig.branchmap().iteritems():
+# only open heads
+heads = [h for h in heads if not repo[h].closesbranch()]
+if heads:
 branches[branch] = heads
 
 for branch in branches:
-- 
1.8.3.rc1.579.g184e698

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 35/47] remote-hg: add test for failed double push

2013-05-13 Thread Felipe Contreras
Signed-off-by: Felipe Contreras 
---
 contrib/remote-helpers/test-hg.sh | 24 
 1 file changed, 24 insertions(+)

diff --git a/contrib/remote-helpers/test-hg.sh 
b/contrib/remote-helpers/test-hg.sh
index d98c7a7..9d62e26 100755
--- a/contrib/remote-helpers/test-hg.sh
+++ b/contrib/remote-helpers/test-hg.sh
@@ -426,4 +426,28 @@ test_expect_failure 'remote big push' '
check_bookmark hgrepo new_bmark ''
 '
 
+test_expect_failure 'remote double failed push' '
+   test_when_finished "rm -rf hgrepo gitrepo*" &&
+
+   (
+   hg init hgrepo &&
+   cd hgrepo &&
+   echo zero > content &&
+   hg add content &&
+   hg commit -m zero &&
+   echo one > content &&
+   hg commit -m one
+   ) &&
+
+   (
+   git clone "hg::hgrepo" gitrepo &&
+   cd gitrepo &&
+   git reset --hard HEAD^ &&
+   echo two > content &&
+   git commit -a -m two &&
+   test_expect_code 1 git push &&
+   test_expect_code 1 git push
+   )
+'
+
 test_done
-- 
1.8.3.rc1.579.g184e698

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 41/47] remote-hg: pass around revision refs

2013-05-13 Thread Felipe Contreras
So that when a diverge is detected, we know which ref to report an error
for.

Also, since we are not throwing an exception, return a proper error
code.

Signed-off-by: Felipe Contreras 
---
 contrib/remote-helpers/git-remote-hg | 34 +-
 contrib/remote-helpers/test-hg.sh|  6 +++---
 2 files changed, 24 insertions(+), 16 deletions(-)

diff --git a/contrib/remote-helpers/git-remote-hg 
b/contrib/remote-helpers/git-remote-hg
index abc0738..5a5667d 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -837,18 +837,19 @@ def write_tag(repo, tag, node, msg, author):
 
 encoding.encoding = tmp
 
-return tagnode
+return (tagnode, branch)
 
 def checkheads(repo, remote, p_revs):
 
 remotemap = remote.branchmap()
 if not remotemap:
 # empty repo
-return
+return True
 
 new = {}
+ret = True
 
-for node in p_revs:
+for node, ref in p_revs.iteritems():
 ctx = repo[node]
 branch = ctx.branch()
 if not branch in remotemap:
@@ -870,7 +871,11 @@ def checkheads(repo, remote, p_revs):
 if found:
 continue
 
-raise Exception("non-fast-forward")
+node = repo.changelog.node(rev)
+print "error %s non-fast forward" % p_revs[node]
+ret = False
+
+return ret
 
 def push_unsafe(repo, remote, parsed_refs, p_revs):
 
@@ -887,8 +892,8 @@ def push_unsafe(repo, remote, parsed_refs, p_revs):
 # nothing to push
 return None
 
-if not force:
-checkheads(unfi, remote, p_revs)
+if not force and not checkheads(unfi, remote, p_revs):
+return None
 
 cg = repo.getlocalbundle('push', outgoing)
 
@@ -924,7 +929,7 @@ def do_export(parser):
 global parsed_refs, bmarks, peer
 
 p_bmarks = []
-p_revs = set()
+p_revs = {}
 
 parser.next()
 
@@ -949,7 +954,7 @@ def do_export(parser):
 if branch in branches and bnode in branches[branch]:
 # up to date
 continue
-p_revs.add(bnode)
+p_revs[bnode] = ref
 print "ok %s" % ref
 elif ref.startswith('refs/heads/'):
 bmark = ref[len('refs/heads/'):]
@@ -966,7 +971,7 @@ def do_export(parser):
 else:
 p_bmarks.append((ref, bmark, old, new))
 
-p_revs.add(bnode)
+p_revs[bnode] = ref
 elif ref.startswith('refs/tags/'):
 tag = ref[len('refs/tags/'):]
 tag = hgref(tag)
@@ -974,20 +979,23 @@ def do_export(parser):
 if mode == 'git':
 if not msg:
 msg = 'Added tag %s for changeset %s' % (tag, node[:12]);
-tagnode = write_tag(parser.repo, tag, node, msg, author)
-p_revs.add(tagnode)
+tagnode, branch = write_tag(parser.repo, tag, node, msg, 
author)
+p_revs[tagnode] = 'refs/heads/branches/' + gitref(branch)
 else:
 fp = parser.repo.opener('localtags', 'a')
 fp.write('%s %s\n' % (node, tag))
 fp.close()
-p_revs.add(bnode)
+p_revs[bnode] = ref
 print "ok %s" % ref
 else:
 # transport-helper/fast-export bugs
 continue
 
 if peer:
-push(parser.repo, peer, parsed_refs, p_revs)
+if not push(parser.repo, peer, parsed_refs, p_revs):
+# do not update bookmarks
+print
+return
 
 # update remote bookmarks
 remote_bmarks = peer.listkeys('bookmarks')
diff --git a/contrib/remote-helpers/test-hg.sh 
b/contrib/remote-helpers/test-hg.sh
index 9d62e26..4f6fd4c 100755
--- a/contrib/remote-helpers/test-hg.sh
+++ b/contrib/remote-helpers/test-hg.sh
@@ -268,7 +268,7 @@ test_expect_success 'remote new bookmark' '
check_bookmark hgrepo feature-b feature-b
 '
 
-test_expect_failure 'remote push diverged' '
+test_expect_success 'remote push diverged' '
test_when_finished "rm -rf gitrepo*" &&
 
git clone "hg::hgrepo" gitrepo &&
@@ -291,7 +291,7 @@ test_expect_failure 'remote push diverged' '
check_branch hgrepo default bump
 '
 
-test_expect_failure 'remote update bookmark diverge' '
+test_expect_success 'remote update bookmark diverge' '
test_when_finished "rm -rf gitrepo*" &&
 
(
@@ -338,7 +338,7 @@ test_expect_failure 'remote new bookmark multiple branch 
head' '
 # cleanup previous stuff
 rm -rf hgrepo
 
-test_expect_failure 'remote big push' '
+test_expect_success 'remote big push' '
test_when_finished "rm -rf hgrepo gitrepo*" &&
 
(
-- 
1.8.3.rc1.579.g184e698

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 42/47] remote-hg: check diverged bookmarks

2013-05-13 Thread Felipe Contreras
So that we can report a proper error.

Signed-off-by: Felipe Contreras 
---
 contrib/remote-helpers/git-remote-hg | 24 
 contrib/remote-helpers/test-hg.sh|  2 +-
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/contrib/remote-helpers/git-remote-hg 
b/contrib/remote-helpers/git-remote-hg
index 5a5667d..df3b9a4 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -839,6 +839,23 @@ def write_tag(repo, tag, node, msg, author):
 
 return (tagnode, branch)
 
+def checkheads_bmark(ref, ctx):
+if force_push:
+return True
+
+bmark = ref[len('refs/heads/'):]
+if not bmark in bmarks:
+# new bmark
+return True
+
+ctx_old = bmarks[bmark]
+ctx_new = ctx
+if not ctx_old.descendant(ctx_new):
+print "error %s non-fast forward" % ref
+return False
+
+return True
+
 def checkheads(repo, remote, p_revs):
 
 remotemap = remote.branchmap()
@@ -855,6 +872,13 @@ def checkheads(repo, remote, p_revs):
 if not branch in remotemap:
 # new branch
 continue
+if not ref.startswith('refs/heads/branches'):
+if ref.startswith('refs/heads/'):
+if not checkheads_bmark(ref, ctx):
+ret = False
+
+# only check branches
+continue
 new.setdefault(branch, []).append(ctx.rev())
 
 for branch, heads in new.iteritems():
diff --git a/contrib/remote-helpers/test-hg.sh 
b/contrib/remote-helpers/test-hg.sh
index 4f6fd4c..ecf7bd4 100755
--- a/contrib/remote-helpers/test-hg.sh
+++ b/contrib/remote-helpers/test-hg.sh
@@ -320,7 +320,7 @@ test_expect_success 'remote update bookmark diverge' '
check_bookmark hgrepo diverge "bump bookmark"
 '
 
-test_expect_failure 'remote new bookmark multiple branch head' '
+test_expect_success 'remote new bookmark multiple branch head' '
test_when_finished "rm -rf gitrepo*" &&
 
(
-- 
1.8.3.rc1.579.g184e698

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 40/47] remote-hg: implement custom checkheads()

2013-05-13 Thread Felipe Contreras
The version from Mercurial is extremely inefficient and convoluted, this
version achieves basically the same, at least for our purposes.

No functional changes.

Signed-off-by: Felipe Contreras 
---
 contrib/remote-helpers/git-remote-hg | 37 ++--
 1 file changed, 35 insertions(+), 2 deletions(-)

diff --git a/contrib/remote-helpers/git-remote-hg 
b/contrib/remote-helpers/git-remote-hg
index b064a3c..abc0738 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -839,6 +839,39 @@ def write_tag(repo, tag, node, msg, author):
 
 return tagnode
 
+def checkheads(repo, remote, p_revs):
+
+remotemap = remote.branchmap()
+if not remotemap:
+# empty repo
+return
+
+new = {}
+
+for node in p_revs:
+ctx = repo[node]
+branch = ctx.branch()
+if not branch in remotemap:
+# new branch
+continue
+new.setdefault(branch, []).append(ctx.rev())
+
+for branch, heads in new.iteritems():
+old = [repo.changelog.rev(x) for x in remotemap[branch]]
+for rev in heads:
+ancestors = repo.changelog.ancestors([rev], stoprev=min(old))
+found = False
+
+for x in old:
+if x in ancestors:
+found = True
+break
+
+if found:
+continue
+
+raise Exception("non-fast-forward")
+
 def push_unsafe(repo, remote, parsed_refs, p_revs):
 
 unfi = repo.unfiltered()
@@ -846,7 +879,7 @@ def push_unsafe(repo, remote, parsed_refs, p_revs):
 
 fci = discovery.findcommonincoming
 commoninc = fci(unfi, remote, force=force)
-common, inc, remoteheads = commoninc
+common, _, remoteheads = commoninc
 fco = discovery.findcommonoutgoing
 outgoing = fco(unfi, remote, onlyheads=list(p_revs), commoninc=commoninc, 
force=force)
 
@@ -855,7 +888,7 @@ def push_unsafe(repo, remote, parsed_refs, p_revs):
 return None
 
 if not force:
-discovery.checkheads(unfi, remote, outgoing, remoteheads, True, 
bool(inc))
+checkheads(unfi, remote, p_revs)
 
 cg = repo.getlocalbundle('push', outgoing)
 
-- 
1.8.3.rc1.579.g184e698

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 39/47] remote-hg: implement custom push()

2013-05-13 Thread Felipe Contreras
The one from mercurial does a ton of things we are not interested in,
and we need some special modifications which are impossible otherwise.

Most of the code is borrowed from Mercurial, and cleaned up, but should
be functionally the same for our purposes.

Signed-off-by: Felipe Contreras 
---
 contrib/remote-helpers/git-remote-hg | 52 ++--
 1 file changed, 50 insertions(+), 2 deletions(-)

diff --git a/contrib/remote-helpers/git-remote-hg 
b/contrib/remote-helpers/git-remote-hg
index c814188..b064a3c 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -12,7 +12,7 @@
 # For remote repositories a local clone is stored in
 # "$GIT_DIR/hg/origin/clone/.hg/".
 
-from mercurial import hg, ui, bookmarks, context, encoding, node, error, 
extensions
+from mercurial import hg, ui, bookmarks, context, encoding, node, error, 
extensions, discovery
 
 import re
 import sys
@@ -839,6 +839,54 @@ def write_tag(repo, tag, node, msg, author):
 
 return tagnode
 
+def push_unsafe(repo, remote, parsed_refs, p_revs):
+
+unfi = repo.unfiltered()
+force = force_push
+
+fci = discovery.findcommonincoming
+commoninc = fci(unfi, remote, force=force)
+common, inc, remoteheads = commoninc
+fco = discovery.findcommonoutgoing
+outgoing = fco(unfi, remote, onlyheads=list(p_revs), commoninc=commoninc, 
force=force)
+
+if not outgoing.missing:
+# nothing to push
+return None
+
+if not force:
+discovery.checkheads(unfi, remote, outgoing, remoteheads, True, 
bool(inc))
+
+cg = repo.getlocalbundle('push', outgoing)
+
+unbundle = remote.capable('unbundle')
+if unbundle:
+if force:
+remoteheads = ['force']
+return remote.unbundle(cg, remoteheads, 'push')
+else:
+return remote.addchangegroup(cg, 'push', repo.url())
+
+def push(repo, remote, parsed_refs, p_revs):
+if not remote.canpush():
+print "error cannot push"
+
+if not p_revs:
+# nothing to push
+return
+
+lock = None
+unbundle = remote.capable('unbundle')
+if not unbundle:
+lock = remote.lock()
+try:
+ret = push_unsafe(repo, remote, parsed_refs, p_revs)
+finally:
+if lock is not None:
+lock.release()
+
+return ret
+
 def do_export(parser):
 global parsed_refs, bmarks, peer
 
@@ -906,7 +954,7 @@ def do_export(parser):
 continue
 
 if peer:
-parser.repo.push(peer, force=force_push, newbranch=True, 
revs=list(p_revs))
+push(parser.repo, peer, parsed_refs, p_revs)
 
 # update remote bookmarks
 remote_bmarks = peer.listkeys('bookmarks')
-- 
1.8.3.rc1.579.g184e698

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 37/47] remote-hg: force remote bookmark push selectively

2013-05-13 Thread Felipe Contreras
If we update the 'old' node, we might be updating the remote bookmark
even when our 'new' node is not related at all to what the remote has,
effectively forcing an update.

Let's do that only when forced push is configured.

Signed-off-by: Felipe Contreras 
---
 contrib/remote-helpers/git-remote-hg | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/contrib/remote-helpers/git-remote-hg 
b/contrib/remote-helpers/git-remote-hg
index 14fadd1..0780679 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -906,7 +906,8 @@ def do_export(parser):
 # update remote bookmarks
 remote_bmarks = peer.listkeys('bookmarks')
 for ref, bmark, old, new in p_bmarks:
-old = remote_bmarks.get(bmark, '')
+if force_push:
+old = remote_bmarks.get(bmark, '')
 if not peer.pushkey('bookmarks', bmark, old, new):
 print "error %s" % ref
 else:
-- 
1.8.3.rc1.579.g184e698

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 38/47] remote-hg: only update necessary revisions

2013-05-13 Thread Felipe Contreras
We don't care about the rest, and in fact, we shouldn't try to push
everything, as there might be garbage from previous failed pushes.

Signed-off-by: Felipe Contreras 
---
 contrib/remote-helpers/git-remote-hg | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/contrib/remote-helpers/git-remote-hg 
b/contrib/remote-helpers/git-remote-hg
index 0780679..c814188 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -843,6 +843,7 @@ def do_export(parser):
 global parsed_refs, bmarks, peer
 
 p_bmarks = []
+p_revs = set()
 
 parser.next()
 
@@ -867,6 +868,7 @@ def do_export(parser):
 if branch in branches and bnode in branches[branch]:
 # up to date
 continue
+p_revs.add(bnode)
 print "ok %s" % ref
 elif ref.startswith('refs/heads/'):
 bmark = ref[len('refs/heads/'):]
@@ -883,6 +885,7 @@ def do_export(parser):
 else:
 p_bmarks.append((ref, bmark, old, new))
 
+p_revs.add(bnode)
 elif ref.startswith('refs/tags/'):
 tag = ref[len('refs/tags/'):]
 tag = hgref(tag)
@@ -890,18 +893,20 @@ def do_export(parser):
 if mode == 'git':
 if not msg:
 msg = 'Added tag %s for changeset %s' % (tag, node[:12]);
-write_tag(parser.repo, tag, node, msg, author)
+tagnode = write_tag(parser.repo, tag, node, msg, author)
+p_revs.add(tagnode)
 else:
 fp = parser.repo.opener('localtags', 'a')
 fp.write('%s %s\n' % (node, tag))
 fp.close()
+p_revs.add(bnode)
 print "ok %s" % ref
 else:
 # transport-helper/fast-export bugs
 continue
 
 if peer:
-parser.repo.push(peer, force=force_push, newbranch=True)
+parser.repo.push(peer, force=force_push, newbranch=True, 
revs=list(p_revs))
 
 # update remote bookmarks
 remote_bmarks = peer.listkeys('bookmarks')
-- 
1.8.3.rc1.579.g184e698

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 36/47] remote-hg: reorganize bookmark handling

2013-05-13 Thread Felipe Contreras
We don't need to update both internal and remote bookmarks, so let's do
one or the other, and move the shared code earlier, so it's simpler.

Signed-off-by: Felipe Contreras 
---
 contrib/remote-helpers/git-remote-hg | 52 +++-
 1 file changed, 21 insertions(+), 31 deletions(-)

diff --git a/contrib/remote-helpers/git-remote-hg 
b/contrib/remote-helpers/git-remote-hg
index 6c7392f..14fadd1 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -870,8 +870,19 @@ def do_export(parser):
 print "ok %s" % ref
 elif ref.startswith('refs/heads/'):
 bmark = ref[len('refs/heads/'):]
-p_bmarks.append((bmark, node))
-continue
+new = node
+old = bmarks[bmark].hex() if bmark in bmarks else ''
+
+if old == new:
+continue
+
+print "ok %s" % ref
+if bmark == 'master' and 'master' not in parser.repo._bookmarks:
+# fake bookmark
+pass
+else:
+p_bmarks.append((ref, bmark, old, new))
+
 elif ref.startswith('refs/tags/'):
 tag = ref[len('refs/tags/'):]
 tag = hgref(tag)
@@ -891,39 +902,18 @@ def do_export(parser):
 
 if peer:
 parser.repo.push(peer, force=force_push, newbranch=True)
-remote_bmarks = peer.listkeys('bookmarks')
-
-# handle bookmarks
-for bmark, node in p_bmarks:
-ref = 'refs/heads/' + bmark
-new = node
-
-if bmark in bmarks:
-old = bmarks[bmark].hex()
-else:
-old = ''
-
-if old == new:
-continue
-
-if bmark == 'master' and 'master' not in parser.repo._bookmarks:
-# fake bookmark
-print "ok %s" % ref
-continue
-elif bookmarks.pushbookmark(parser.repo, bmark, old, new):
-# updated locally
-pass
-else:
-print "error %s" % ref
-continue
 
-if peer:
+# update remote bookmarks
+remote_bmarks = peer.listkeys('bookmarks')
+for ref, bmark, old, new in p_bmarks:
 old = remote_bmarks.get(bmark, '')
 if not peer.pushkey('bookmarks', bmark, old, new):
 print "error %s" % ref
-continue
-
-print "ok %s" % ref
+else:
+# update local bookmarks
+for ref, bmark, old, new in p_bmarks:
+if not bookmarks.pushbookmark(parser.repo, bmark, old, new):
+print "error %s" % ref
 
 print
 
-- 
1.8.3.rc1.579.g184e698

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 34/47] remote-hg: add test for big push

2013-05-13 Thread Felipe Contreras
With lots branches and bookmarks, non-ff, updated and new.

Signed-off-by: Felipe Contreras 
---
 contrib/remote-helpers/test-hg.sh | 113 --
 1 file changed, 107 insertions(+), 6 deletions(-)

diff --git a/contrib/remote-helpers/test-hg.sh 
b/contrib/remote-helpers/test-hg.sh
index c3fa04d..d98c7a7 100755
--- a/contrib/remote-helpers/test-hg.sh
+++ b/contrib/remote-helpers/test-hg.sh
@@ -27,15 +27,25 @@ check () {
 }
 
 check_bookmark () {
-   echo $3 > expected &&
-   hg -R $1 log -r "bookmark('$2')" --template '{desc}\n' > actual &&
-   test_cmp expected actual
+   if [ -n "$3" ]; then
+   echo $3 > expected &&
+   hg -R $1 log -r "bookmark('$2')" --template '{desc}\n' > actual 
&&
+   test_cmp expected actual
+   else
+   hg -R $1 bookmarks > out &&
+   ! grep $2 out
+   fi
 }
 
 check_branch () {
-   echo $3 > expected &&
-   hg -R $1 log -r $2 --template '{desc}\n' > actual &&
-   test_cmp expected actual
+   if [ -n "$3" ]; then
+   echo $3 > expected &&
+   hg -R $1 log -r $2 --template '{desc}\n' > actual &&
+   test_cmp expected actual
+   else
+   hg -R $1 branches > out &&
+   ! grep $2 out
+   fi
 }
 
 setup () {
@@ -325,4 +335,95 @@ test_expect_failure 'remote new bookmark multiple branch 
head' '
check_bookmark hgrepo feature-c feature-c
 '
 
+# cleanup previous stuff
+rm -rf hgrepo
+
+test_expect_failure 'remote big push' '
+   test_when_finished "rm -rf hgrepo gitrepo*" &&
+
+   (
+   hg init hgrepo &&
+   cd hgrepo &&
+   echo zero > content &&
+   hg add content &&
+   hg commit -m zero &&
+   hg bookmark bad_bmark1 &&
+   echo one > content &&
+   hg commit -m one &&
+   hg bookmark bad_bmark2 &&
+   hg bookmark good_bmark &&
+   hg bookmark -i &&
+   hg -q branch good_branch &&
+   echo "good branch" > content &&
+   hg commit -m "good branch" &&
+   hg -q branch bad_branch &&
+   echo "bad branch" > content &&
+   hg commit -m "bad branch"
+   ) &&
+
+   git clone "hg::hgrepo" gitrepo &&
+
+   (
+   cd gitrepo &&
+   echo two > content &&
+   git commit -q -a -m two &&
+
+   git checkout -q good_bmark &&
+   echo three > content &&
+   git commit -q -a -m three &&
+
+   git checkout -q bad_bmark1 &&
+   git reset --hard HEAD^ &&
+   echo four > content &&
+   git commit -q -a -m four &&
+
+   git checkout -q bad_bmark2 &&
+   git reset --hard HEAD^ &&
+   echo five > content &&
+   git commit -q -a -m five &&
+
+   git checkout -q -b new_bmark master &&
+   echo six > content &&
+   git commit -q -a -m six &&
+
+   git checkout -q branches/good_branch &&
+   echo seven > content &&
+   git commit -q -a -m seven &&
+   echo eight > content &&
+   git commit -q -a -m eight &&
+
+   git checkout -q branches/bad_branch &&
+   git reset --hard HEAD^ &&
+   echo nine > content &&
+   git commit -q -a -m nine &&
+
+   git checkout -q -b branches/new_branch master &&
+   echo ten > content &&
+   git commit -q -a -m ten &&
+
+   test_expect_code 1 git push origin master \
+   good_bmark bad_bmark1 bad_bmark2 new_bmark \
+   branches/good_branch branches/bad_branch \
+   branches/new_branch 2> error &&
+
+   grep "^   [a-f0-9]*\.\.[a-f0-9]* *master -> master$" error &&
+   grep "^   [a-f0-9]*\.\.[a-f0-9]* *good_bmark -> good_bmark$" error &&
+   grep "^ \* \[new branch\] *new_bmark -> new_bmark$" error &&
+   grep "^ ! \[rejected\] *bad_bmark2 -> bad_bmark2 (non-fast-forward)$" 
error &&
+   grep "^ ! \[rejected\] *bad_bmark1 -> bad_bmark1 (non-fast-forward)$" 
error &&
+   grep "^   [a-f0-9]*\.\.[a-f0-9]* *branches/good_branch -> 
branches/good_branch$" error &&
+   grep "^ ! \[rejected\] *branches/bad_branch -> branches/bad_branch 
(non-fast-forward)$" error &&
+   grep "^ \* \[new branch\] *branches/new_branch -> branches/new_branch$" 
error
+   ) &&
+
+   check_branch hgrepo default one &&
+   check_branch hgrepo good_branch "good branch" &&
+   check_branch hgrepo bad_branch "bad branch" &&
+   check_branch hgrepo new_branch '' &&
+   check_bookmark hgrepo good_bmark one &&
+   check_bookmark hgrepo bad_bmark1 one &&
+   check_bookmark hgrepo bad_bmark2 one &&
+   check_bookmark hgrepo new_bmark ''
+'
+
 test_done
-- 
1.8.3.rc1.579.g184e698

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 33/47] remote-hg: add test for new bookmark special

2013-05-13 Thread Felipe Contreras
>From the point of view of Mercurial, this creates a new branch head, and
requires a forced push.

Ideally, whoever, we would want it to work just like in git; new
branches can be pushed without problems.

Signed-off-by: Felipe Contreras 
---
 contrib/remote-helpers/test-hg.sh | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/contrib/remote-helpers/test-hg.sh 
b/contrib/remote-helpers/test-hg.sh
index f4e3807..c3fa04d 100755
--- a/contrib/remote-helpers/test-hg.sh
+++ b/contrib/remote-helpers/test-hg.sh
@@ -310,4 +310,19 @@ test_expect_failure 'remote update bookmark diverge' '
check_bookmark hgrepo diverge "bump bookmark"
 '
 
+test_expect_failure 'remote new bookmark multiple branch head' '
+   test_when_finished "rm -rf gitrepo*" &&
+
+   (
+   git clone "hg::hgrepo" gitrepo &&
+   cd gitrepo &&
+   git checkout --quiet -b feature-c HEAD^ &&
+   echo feature-c > content &&
+   git commit -a -m feature-c &&
+   git push --quiet origin feature-c
+   ) &&
+
+   check_bookmark hgrepo feature-c feature-c
+'
+
 test_done
-- 
1.8.3.rc1.579.g184e698

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 32/47] remote-hg: add test for bookmark diverge

2013-05-13 Thread Felipe Contreras
Signed-off-by: Felipe Contreras 
---
 contrib/remote-helpers/test-hg.sh | 29 +
 1 file changed, 29 insertions(+)

diff --git a/contrib/remote-helpers/test-hg.sh 
b/contrib/remote-helpers/test-hg.sh
index 06700a8..f4e3807 100755
--- a/contrib/remote-helpers/test-hg.sh
+++ b/contrib/remote-helpers/test-hg.sh
@@ -281,4 +281,33 @@ test_expect_failure 'remote push diverged' '
check_branch hgrepo default bump
 '
 
+test_expect_failure 'remote update bookmark diverge' '
+   test_when_finished "rm -rf gitrepo*" &&
+
+   (
+   cd hgrepo &&
+   hg bookmark diverge -r tip^
+   hg checkout diverge
+   ) &&
+
+   git clone "hg::hgrepo" gitrepo &&
+
+   (
+   cd hgrepo &&
+   echo "bump bookmark" > content &&
+   hg commit -m "bump bookmark"
+   ) &&
+
+   (
+   cd gitrepo &&
+   git checkout --quiet diverge &&
+   echo diverge > content &&
+   git commit -a -m diverge &&
+   test_expect_code 1 git push 2> error &&
+   grep "^ ! \[rejected\] *diverge -> diverge (non-fast-forward)$" error
+   ) &&
+
+   check_bookmark hgrepo diverge "bump bookmark"
+'
+
 test_done
-- 
1.8.3.rc1.579.g184e698

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 31/47] remote-hg: add test for diverged push

2013-05-13 Thread Felipe Contreras
Neither mercurial nor git allows pushing to a remote when it's a
non-fast-forward push. We should be able to detect theses errors and
report them properly.

As opposed to throwing an exception stack-trace.

Signed-off-by: Felipe Contreras 
---
 contrib/remote-helpers/test-hg.sh | 29 +
 1 file changed, 29 insertions(+)

diff --git a/contrib/remote-helpers/test-hg.sh 
b/contrib/remote-helpers/test-hg.sh
index 5e4f53f..06700a8 100755
--- a/contrib/remote-helpers/test-hg.sh
+++ b/contrib/remote-helpers/test-hg.sh
@@ -32,6 +32,12 @@ check_bookmark () {
test_cmp expected actual
 }
 
+check_branch () {
+   echo $3 > expected &&
+   hg -R $1 log -r $2 --template '{desc}\n' > actual &&
+   test_cmp expected actual
+}
+
 setup () {
(
echo "[ui]"
@@ -252,4 +258,27 @@ test_expect_success 'remote new bookmark' '
check_bookmark hgrepo feature-b feature-b
 '
 
+test_expect_failure 'remote push diverged' '
+   test_when_finished "rm -rf gitrepo*" &&
+
+   git clone "hg::hgrepo" gitrepo &&
+
+   (
+   cd hgrepo &&
+   hg checkout default &&
+   echo bump > content &&
+   hg commit -m bump
+   ) &&
+
+   (
+   cd gitrepo &&
+   echo diverge > content &&
+   git commit -a -m diverged &&
+   test_expect_code 1 git push 2> error &&
+   grep "^ ! \[rejected\] *master -> master (non-fast-forward)$" error
+   ) &&
+
+   check_branch hgrepo default bump
+'
+
 test_done
-- 
1.8.3.rc1.579.g184e698

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 30/47] remote-hg: add test to push new bookmark

2013-05-13 Thread Felipe Contreras
Signed-off-by: Felipe Contreras 
---
 contrib/remote-helpers/test-hg.sh | 30 ++
 1 file changed, 30 insertions(+)

diff --git a/contrib/remote-helpers/test-hg.sh 
b/contrib/remote-helpers/test-hg.sh
index 44764a0..5e4f53f 100755
--- a/contrib/remote-helpers/test-hg.sh
+++ b/contrib/remote-helpers/test-hg.sh
@@ -107,6 +107,21 @@ test_expect_success 'update bookmark' '
check_bookmark hgrepo devel devel
 '
 
+test_expect_success 'new bookmark' '
+   test_when_finished "rm -rf gitrepo*" &&
+
+   (
+   git clone "hg::hgrepo" gitrepo &&
+   cd gitrepo &&
+   git checkout --quiet -b feature-b &&
+   echo feature-b > content &&
+   git commit -a -m feature-b &&
+   git push --quiet origin feature-b
+   ) &&
+
+   check_bookmark hgrepo feature-b feature-b
+'
+
 # cleanup previous stuff
 rm -rf hgrepo
 
@@ -222,4 +237,19 @@ test_expect_success 'remote update bookmark' '
check_bookmark hgrepo devel devel
 '
 
+test_expect_success 'remote new bookmark' '
+   test_when_finished "rm -rf gitrepo*" &&
+
+   (
+   git clone "hg::hgrepo" gitrepo &&
+   cd gitrepo &&
+   git checkout --quiet -b feature-b &&
+   echo feature-b > content &&
+   git commit -a -m feature-b &&
+   git push --quiet origin feature-b
+   ) &&
+
+   check_bookmark hgrepo feature-b feature-b
+'
+
 test_done
-- 
1.8.3.rc1.579.g184e698

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 28/47] remote-hg: add check_bookmark() test helper

2013-05-13 Thread Felipe Contreras
And check in a more proper way.

Signed-off-by: Felipe Contreras 
---
 contrib/remote-helpers/test-hg.sh | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/contrib/remote-helpers/test-hg.sh 
b/contrib/remote-helpers/test-hg.sh
index 8d1f6e0..dc71c37 100755
--- a/contrib/remote-helpers/test-hg.sh
+++ b/contrib/remote-helpers/test-hg.sh
@@ -26,6 +26,12 @@ check () {
test_cmp expected actual
 }
 
+check_bookmark () {
+   echo $3 > expected &&
+   hg -R $1 log -r "bookmark('$2')" --template '{desc}\n' > actual &&
+   test_cmp expected actual
+}
+
 setup () {
(
echo "[ui]"
@@ -98,7 +104,7 @@ test_expect_success 'update bookmark' '
git push --quiet
) &&
 
-   hg -R hgrepo bookmarks | egrep "devel[   ]+3:"
+   check_bookmark hgrepo devel devel
 '
 
 # cleanup previous stuff
-- 
1.8.3.rc1.579.g184e698

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 26/47] remote-hg: always point HEAD to master

2013-05-13 Thread Felipe Contreras
Mercurial always checks out the 'default' branch, so there's no point in
complicating our lives trying to do something fancier, which causes
different behavior depending on whether the repository is local or
remote.

So let's always use 'default' (which we translate to 'master'), unless
we are in hg-git mode, which expects us to use the 'master' bookmark
instead.

Also, update the tests that used to check for different checkout
behaviors to simply check that the refs are there, remove unnecessary
ones, and fix the ones that expect something different.

Signed-off-by: Felipe Contreras 
---
 contrib/remote-helpers/git-remote-hg | 21 +++
 contrib/remote-helpers/test-hg-bidi.sh   |  9 
 contrib/remote-helpers/test-hg-hg-git.sh |  4 +++-
 contrib/remote-helpers/test-hg.sh| 35 ++--
 4 files changed, 20 insertions(+), 49 deletions(-)

diff --git a/contrib/remote-helpers/git-remote-hg 
b/contrib/remote-helpers/git-remote-hg
index e05106a..776c5af 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -565,20 +565,13 @@ def get_branch_tip(repo, branch):
 def list_head(repo, cur):
 global g_head, bmarks
 
-head = bookmarks.readcurrent(repo)
-if head:
-node = repo[head]
-else:
-# fake bookmark from current branch
-head = cur
-node = repo['.']
-if not node:
-node = repo['tip']
-if not node:
-return
-if head == 'default':
-head = 'master'
-bmarks[head] = node
+if 'default' not in repo:
+# empty repo
+return
+
+node = repo['default']
+head = 'master' if not 'master' in bmarks else 'default'
+bmarks[head] = node
 
 head = gitref(head)
 print "@refs/heads/%s HEAD" % head
diff --git a/contrib/remote-helpers/test-hg-bidi.sh 
b/contrib/remote-helpers/test-hg-bidi.sh
index 88a33e6..86a3f10 100755
--- a/contrib/remote-helpers/test-hg-bidi.sh
+++ b/contrib/remote-helpers/test-hg-bidi.sh
@@ -29,7 +29,6 @@ git_clone () {
 hg_clone () {
(
hg init $2 &&
-   hg -R $2 bookmark -i master &&
cd $1 &&
git push -q "hg::../$2" 'refs/tags/*:refs/tags/*' 
'refs/heads/*:refs/heads/*'
) &&
@@ -49,8 +48,7 @@ hg_push () {
 }
 
 hg_log () {
-   hg -R $1 log --graph --debug >log &&
-   grep -v 'tag: *default/' log
+   hg -R $1 log --graph --debug
 }
 
 setup () {
@@ -66,6 +64,7 @@ setup () {
echo "graphlog ="
) >> "$HOME"/.hgrc &&
git config --global remote-hg.hg-git-compat true
+   git config --global remote-hg.track-branches true
 
HGEDITOR=/usr/bin/true
GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0230"
@@ -189,7 +188,7 @@ test_expect_success 'hg branch' '
hg_clone gitrepo hgrepo &&
 
cd hgrepo &&
-   hg -q co master &&
+   hg -q co default &&
hg mv alpha beta &&
hg -q commit -m "rename alpha to beta" &&
hg branch gamma | grep -v "permanent and global" &&
@@ -225,7 +224,7 @@ test_expect_success 'hg tags' '
hg_clone gitrepo hgrepo &&
 
cd hgrepo &&
-   hg co master &&
+   hg co default &&
hg tag alpha
) &&
 
diff --git a/contrib/remote-helpers/test-hg-hg-git.sh 
b/contrib/remote-helpers/test-hg-hg-git.sh
index e503293..9cb95d8 100755
--- a/contrib/remote-helpers/test-hg-hg-git.sh
+++ b/contrib/remote-helpers/test-hg-hg-git.sh
@@ -27,7 +27,8 @@ fi
 
 # clone to a git repo with git
 git_clone_git () {
-   git clone -q "hg::$1" $2
+   git clone -q "hg::$1" $2 &&
+   (cd $2 && git checkout master && git branch -D default)
 }
 
 # clone to an hg repo with git
@@ -63,6 +64,7 @@ hg_push_git () {
cd $2
git checkout -q -b tmp &&
git fetch -q "hg::../$1" 'refs/tags/*:refs/tags/*' 
'refs/heads/*:refs/heads/*' &&
+   git branch -D default &&
git checkout -q @{-1} &&
git branch -q -D tmp 2> /dev/null || true
)
diff --git a/contrib/remote-helpers/test-hg.sh 
b/contrib/remote-helpers/test-hg.sh
index 23ff0db..8d1f6e0 100755
--- a/contrib/remote-helpers/test-hg.sh
+++ b/contrib/remote-helpers/test-hg.sh
@@ -21,15 +21,8 @@ if ! "$PYTHON_PATH" -c 'import mercurial'; then
 fi
 
 check () {
-   (
-   cd $1 &&
-   git log --format='%s' -1 &&
-   git symbolic-ref HEAD
-   ) > actual &&
-   (
-   echo $2 &&
-   echo "refs/heads/$3"
-   ) > expected &&
+   echo $3 > expected &&
+   git --git-dir=$1/.git log --format='%s' -1 $2 > actual
test_cmp expected actual
 }
 
@@ -56,7 +49,7 @@ test_expect_success 'cloning' '
) &&
 
git clone "hg::hgrepo" gitrepo &&
-   check gitrepo zero master
+   check gitrepo HEAD zero
 '
 
 test_expect_success 'cloning with branches' '
@@ -70,12 +63,7 @@ test_expect_success 'cloning with branches' '
) &&
 
git clone "hg::hgrepo" gitrepo &&
-   check g

[PATCH 27/47] remote-bzr: simplify test checks

2013-05-13 Thread Felipe Contreras
Signed-off-by: Felipe Contreras 
---
 contrib/remote-helpers/test-bzr.sh | 17 +
 1 file changed, 5 insertions(+), 12 deletions(-)

diff --git a/contrib/remote-helpers/test-bzr.sh 
b/contrib/remote-helpers/test-bzr.sh
index 90f8c7f..220e388 100755
--- a/contrib/remote-helpers/test-bzr.sh
+++ b/contrib/remote-helpers/test-bzr.sh
@@ -18,15 +18,8 @@ if ! "$PYTHON_PATH" -c 'import bzrlib'; then
 fi
 
 check () {
-   (
-   cd $1 &&
-   git log --format='%s' -1 &&
-   git symbolic-ref HEAD
-   ) > actual &&
-   (
-   echo $2 &&
-   echo "refs/heads/$3"
-   ) > expected &&
+   echo $3 > expected &&
+   git --git-dir=$1/.git log --format='%s' -1 $2 > actual
test_cmp expected actual
 }
 
@@ -42,7 +35,7 @@ test_expect_success 'cloning' '
) &&
 
git clone "bzr::bzrrepo" gitrepo &&
-   check gitrepo one master
+   check gitrepo HEAD one
 '
 
 test_expect_success 'pulling' '
@@ -54,7 +47,7 @@ test_expect_success 'pulling' '
 
(cd gitrepo && git pull) &&
 
-   check gitrepo two master
+   check gitrepo HEAD two
 '
 
 test_expect_success 'pushing' '
@@ -89,7 +82,7 @@ test_expect_success 'roundtrip' '
 
(cd gitrepo && git pull && git push) &&
 
-   check gitrepo four master &&
+   check gitrepo HEAD four &&
 
(
cd gitrepo &&
-- 
1.8.3.rc1.579.g184e698

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 25/47] remote-hg: improve progress calculation

2013-05-13 Thread Felipe Contreras
No need to manually keep track of the revision count.

Signed-off-by: Felipe Contreras 
---
 contrib/remote-helpers/git-remote-hg | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/contrib/remote-helpers/git-remote-hg 
b/contrib/remote-helpers/git-remote-hg
index 49af8d5..e05106a 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -418,7 +418,7 @@ def export_ref(repo, name, kind, head):
 tip = 0
 
 revs = xrange(tip, head.rev() + 1)
-count = 0
+total = len(revs)
 
 for rev in revs:
 
@@ -426,7 +426,6 @@ def export_ref(repo, name, kind, head):
 node = c.node()
 
 if marks.is_marked(c.hex()):
-count += 1
 continue
 
 (manifest, user, (time, tz), files, desc, extra) = 
repo.changelog.read(node)
@@ -498,9 +497,9 @@ def export_ref(repo, name, kind, head):
 print "D %s" % (fix_file_path(f))
 print
 
-count += 1
-if (count % 100 == 0):
-print "progress revision %d '%s' (%d/%d)" % (rev, name, count, 
len(revs))
+progress = (rev - tip)
+if (progress % 100 == 0):
+print "progress revision %d '%s' (%d/%d)" % (rev, name, progress, 
total)
 
 # make sure the ref is updated
 print "reset %s/%s" % (prefix, ename)
-- 
1.8.3.rc1.579.g184e698

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 24/47] remote-hg: trivial cleanups

2013-05-13 Thread Felipe Contreras
Signed-off-by: Felipe Contreras 
---
 contrib/remote-helpers/git-remote-hg | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/contrib/remote-helpers/git-remote-hg 
b/contrib/remote-helpers/git-remote-hg
index bc6e8fa..49af8d5 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -74,11 +74,11 @@ def hgmode(mode):
 m = { '100755': 'x', '12': 'l' }
 return m.get(mode, '')
 
-def hghex(node):
-return hg.node.hex(node)
+def hghex(n):
+return node.hex(n)
 
-def hgbin(node):
-return hg.node.bin(node)
+def hgbin(n):
+return node.bin(n)
 
 def hgref(ref):
 return ref.replace('___', ' ')
@@ -737,12 +737,12 @@ def parse_commit(parser):
 if from_mark:
 p1 = mark_to_rev(from_mark)
 else:
-p1 = '\0' * 20
+p1 = '0' * 40
 
 if merge_mark:
 p2 = mark_to_rev(merge_mark)
 else:
-p2 = '\0' * 20
+p2 = '0' * 40
 
 #
 # If files changed from any of the parents, hg wants to know, but in git if
@@ -829,7 +829,7 @@ def write_tag(repo, tag, node, msg, author):
 return context.memfilectx(f, content, False, False, None)
 
 p1 = tip.hex()
-p2 = '\0' * 20
+p2 = '0' * 40
 if not author:
 author = (None, 0, 0)
 user, date, tz = author
-- 
1.8.3.rc1.579.g184e698

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 22/47] remote-hg: upgrade version 1 marks

2013-05-13 Thread Felipe Contreras
As suggested by Jed Brown; there's no need to re-import all the commits.

Cc: Jed Brown 
Signed-off-by: Felipe Contreras 
---
 contrib/remote-helpers/git-remote-hg | 22 ++
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/contrib/remote-helpers/git-remote-hg 
b/contrib/remote-helpers/git-remote-hg
index fbd70ef..6cad5cd 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -103,14 +103,20 @@ def get_config_bool(config, default=False):
 
 class Marks:
 
-def __init__(self, path):
+def __init__(self, path, repo):
 self.path = path
+self.repo = repo
 self.clear()
 self.load()
 
 if self.version < VERSION:
-self.clear()
-self.version = VERSION
+if self.version == 1:
+self.upgrade_one()
+
+# upgraded?
+if self.version < VERSION:
+self.clear()
+self.version = VERSION
 
 def clear(self):
 self.tips = {}
@@ -133,6 +139,14 @@ class Marks:
 for rev, mark in self.marks.iteritems():
 self.rev_marks[mark] = rev
 
+def upgrade_one(self):
+def get_id(rev):
+return hghex(self.repo.changelog.node(int(rev)))
+self.tips = dict((name, get_id(rev)) for name, rev in 
self.tips.iteritems())
+self.marks = dict((get_id(rev), mark) for rev, mark in 
self.marks.iteritems())
+self.rev_marks = dict((mark, get_id(rev)) for mark, rev in 
self.rev_marks.iteritems())
+self.version = 2
+
 def dict(self):
 return { 'tips': self.tips, 'marks': self.marks, 'last-mark' : 
self.last_mark, 'version' : self.version }
 
@@ -976,7 +990,7 @@ def main(args):
 fix_path(alias, peer or repo, url)
 
 marks_path = os.path.join(dirname, 'marks-hg')
-marks = Marks(marks_path)
+marks = Marks(marks_path, repo)
 
 parser = Parser(repo)
 for line in parser:
-- 
1.8.3.rc1.579.g184e698

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 23/47] remote-hg: ensure remote rebasing works

2013-05-13 Thread Felipe Contreras
Signed-off-by: Felipe Contreras 
---
 contrib/remote-helpers/git-remote-hg |  1 +
 contrib/remote-helpers/test-hg.sh| 40 
 2 files changed, 41 insertions(+)

diff --git a/contrib/remote-helpers/git-remote-hg 
b/contrib/remote-helpers/git-remote-hg
index 6cad5cd..bc6e8fa 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -624,6 +624,7 @@ def do_import(parser):
 if os.path.exists(path):
 print "feature import-marks=%s" % path
 print "feature export-marks=%s" % path
+print "feature force"
 sys.stdout.flush()
 
 tmp = encoding.encoding
diff --git a/contrib/remote-helpers/test-hg.sh 
b/contrib/remote-helpers/test-hg.sh
index 4bd7584..23ff0db 100755
--- a/contrib/remote-helpers/test-hg.sh
+++ b/contrib/remote-helpers/test-hg.sh
@@ -37,6 +37,8 @@ setup () {
(
echo "[ui]"
echo "username = H G Wells "
+   echo "[extensions]"
+   echo "mq ="
) >> "$HOME"/.hgrc
 }
 
@@ -161,4 +163,42 @@ test_expect_success 'authors' '
test_cmp expected actual
 '
 
+test_expect_success 'strip' '
+   test_when_finished "rm -rf hgrepo gitrepo" &&
+
+   (
+   hg init hgrepo &&
+   cd hgrepo &&
+
+   echo one >> content &&
+   hg add content &&
+   hg commit -m one &&
+
+   echo two >> content &&
+   hg commit -m two
+   ) &&
+
+   git clone "hg::hgrepo" gitrepo &&
+
+   (
+   cd hgrepo &&
+   hg strip -r 1 &&
+
+   echo three >> content &&
+   hg commit -m three &&
+
+   echo four >> content &&
+   hg commit -m four
+   ) &&
+
+   (
+   cd gitrepo &&
+   git fetch &&
+   git log --format="%s" origin/master > ../actual
+   ) &&
+
+   hg -R hgrepo log --template "{desc}\n" > expected &&
+   test_cmp actual expected
+'
+
 test_done
-- 
1.8.3.rc1.579.g184e698

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 21/47] remote-hg: switch from revisions to SHA-1 noteids

2013-05-13 Thread Felipe Contreras
Otherwise we won't know if revisions are replaced.

Signed-off-by: Felipe Contreras 
---
 contrib/remote-helpers/git-remote-hg | 42 +++-
 1 file changed, 22 insertions(+), 20 deletions(-)

diff --git a/contrib/remote-helpers/git-remote-hg 
b/contrib/remote-helpers/git-remote-hg
index 36b8fd4..fbd70ef 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -55,7 +55,7 @@ EMAIL_RE = re.compile('^([^<>]+[^ \\\t<>])?\\b(?:[ 
\\t<>]*?)\\b([^ \\t<>]+@[^ \\
 AUTHOR_HG_RE = re.compile('^(.*?) ?<(.*?)(?:>(.+)?)?$')
 RAW_AUTHOR_RE = re.compile('^(\w+) (?:(.+)? )?<(.*)> (\d+) ([+-]\d+)')
 
-VERSION = 1
+VERSION = 2
 
 def die(msg, *args):
 sys.stderr.write('ERROR: %s\n' % (msg % args))
@@ -131,7 +131,7 @@ class Marks:
 self.version = tmp.get('version', 1)
 
 for rev, mark in self.marks.iteritems():
-self.rev_marks[mark] = int(rev)
+self.rev_marks[mark] = rev
 
 def dict(self):
 return { 'tips': self.tips, 'marks': self.marks, 'last-mark' : 
self.last_mark, 'version' : self.version }
@@ -143,7 +143,7 @@ class Marks:
 return str(self.dict())
 
 def from_rev(self, rev):
-return self.marks[str(rev)]
+return self.marks[rev]
 
 def to_rev(self, mark):
 return self.rev_marks[mark]
@@ -154,19 +154,19 @@ class Marks:
 
 def get_mark(self, rev):
 self.last_mark += 1
-self.marks[str(rev)] = self.last_mark
+self.marks[rev] = self.last_mark
 return self.last_mark
 
 def new_mark(self, rev, mark):
-self.marks[str(rev)] = mark
+self.marks[rev] = mark
 self.rev_marks[mark] = rev
 self.last_mark = mark
 
 def is_marked(self, rev):
-return str(rev) in self.marks
+return rev in self.marks
 
 def get_tip(self, branch):
-return self.tips.get(branch, 0)
+return self.tips.get(branch, None)
 
 def set_tip(self, branch, tip):
 self.tips[branch] = tip
@@ -387,7 +387,7 @@ def get_repo(url, alias):
 
 def rev_to_mark(rev):
 global marks
-return marks.from_rev(rev)
+return marks.from_rev(rev.hex())
 
 def mark_to_rev(mark):
 global marks
@@ -398,6 +398,10 @@ def export_ref(repo, name, kind, head):
 
 ename = '%s/%s' % (kind, name)
 tip = marks.get_tip(ename)
+if tip in repo:
+tip = repo[tip].rev()
+else:
+tip = 0
 
 revs = xrange(tip, head.rev() + 1)
 count = 0
@@ -463,16 +467,16 @@ def export_ref(repo, name, kind, head):
 modified_final = export_files(c.filectx(f) for f in modified)
 
 print "commit %s/%s" % (prefix, ename)
-print "mark :%d" % (marks.get_mark(rev))
+print "mark :%d" % (marks.get_mark(c.hex()))
 print "author %s" % (author)
 print "committer %s" % (committer)
 print "data %d" % (len(desc))
 print desc
 
 if len(parents) > 0:
-print "from :%s" % (rev_to_mark(parents[0].rev()))
+print "from :%s" % (rev_to_mark(parents[0]))
 if len(parents) > 1:
-print "merge :%s" % (rev_to_mark(parents[1].rev()))
+print "merge :%s" % (rev_to_mark(parents[1]))
 
 for f in modified_final:
 print "M %s :%u %s" % f
@@ -486,10 +490,10 @@ def export_ref(repo, name, kind, head):
 
 # make sure the ref is updated
 print "reset %s/%s" % (prefix, ename)
-print "from :%u" % rev_to_mark(head.rev())
+print "from :%u" % rev_to_mark(head)
 print
 
-marks.set_tip(ename, head.rev())
+marks.set_tip(ename, head.hex())
 
 def export_tag(repo, tag):
 export_ref(repo, tag, 'tags', repo[hgref(tag)])
@@ -716,12 +720,12 @@ def parse_commit(parser):
 extra['committer'] = "%s %u %u" % committer
 
 if from_mark:
-p1 = repo.changelog.node(mark_to_rev(from_mark))
+p1 = mark_to_rev(from_mark)
 else:
 p1 = '\0' * 20
 
 if merge_mark:
-p2 = repo.changelog.node(mark_to_rev(merge_mark))
+p2 = mark_to_rev(merge_mark)
 else:
 p2 = '\0' * 20
 
@@ -763,10 +767,8 @@ def parse_commit(parser):
 
 encoding.encoding = tmp
 
-rev = repo[node].rev()
-
 parsed_refs[ref] = node
-marks.new_mark(rev, commit_mark)
+marks.new_mark(node, commit_mark)
 
 def parse_reset(parser):
 global parsed_refs
@@ -782,8 +784,8 @@ def parse_reset(parser):
 from_mark = parser.get_mark()
 parser.next()
 
-node = parser.repo.changelog.node(mark_to_rev(from_mark))
-parsed_refs[ref] = hghex(node)
+rev = mark_to_rev(from_mark)
+parsed_refs[ref] = rev
 
 def parse_tag(parser):
 name = parser[1]
-- 
1.8.3.rc1.579.g184e698

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 18/47] remote-hg: shuffle some code

2013-05-13 Thread Felipe Contreras
In preparation to shift to SHA-1's.

Signed-off-by: Felipe Contreras 
---
 contrib/remote-helpers/git-remote-hg | 30 +-
 1 file changed, 17 insertions(+), 13 deletions(-)

diff --git a/contrib/remote-helpers/git-remote-hg 
b/contrib/remote-helpers/git-remote-hg
index d676c98..8417d1e 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -75,6 +75,9 @@ def hgmode(mode):
 def hghex(node):
 return hg.node.hex(node)
 
+def hgbin(node):
+return hg.node.bin(node)
+
 def hgref(ref):
 return ref.replace('___', ' ')
 
@@ -261,7 +264,7 @@ def get_filechanges(repo, ctx, parent):
 removed = set()
 
 # load earliest manifest first for caching reasons
-prev = repo[parent].manifest().copy()
+prev = parent.manifest().copy()
 cur = ctx.manifest()
 
 for fn in cur:
@@ -404,7 +407,7 @@ def export_ref(repo, name, kind, head):
 else:
 committer = author
 
-parents = [p for p in repo.changelog.parentrevs(rev) if p >= 0]
+parents = [repo[p] for p in repo.changelog.parentrevs(rev) if p >= 0]
 
 if len(parents) == 0:
 modified = c.manifest().keys()
@@ -453,9 +456,9 @@ def export_ref(repo, name, kind, head):
 print desc
 
 if len(parents) > 0:
-print "from :%s" % (rev_to_mark(parents[0]))
+print "from :%s" % (rev_to_mark(parents[0].rev()))
 if len(parents) > 1:
-print "merge :%s" % (rev_to_mark(parents[1]))
+print "merge :%s" % (rev_to_mark(parents[1].rev()))
 
 for f in modified_final:
 print "M %s :%u %s" % f
@@ -469,10 +472,10 @@ def export_ref(repo, name, kind, head):
 
 # make sure the ref is updated
 print "reset %s/%s" % (prefix, ename)
-print "from :%u" % rev_to_mark(rev)
+print "from :%u" % rev_to_mark(head.rev())
 print
 
-marks.set_tip(ename, rev)
+marks.set_tip(ename, head.rev())
 
 def export_tag(repo, tag):
 export_ref(repo, tag, 'tags', repo[hgref(tag)])
@@ -742,7 +745,7 @@ def parse_commit(parser):
 tmp = encoding.encoding
 encoding.encoding = 'utf-8'
 
-node = repo.commitctx(ctx)
+node = hghex(repo.commitctx(ctx))
 
 encoding.encoding = tmp
 
@@ -766,7 +769,7 @@ def parse_reset(parser):
 parser.next()
 
 node = parser.repo.changelog.node(mark_to_rev(from_mark))
-parsed_refs[ref] = node
+parsed_refs[ref] = hghex(node)
 
 def parse_tag(parser):
 name = parser[1]
@@ -791,7 +794,7 @@ def write_tag(repo, tag, node, msg, author):
 data = fctx.data()
 except error.ManifestLookupError:
 data = ""
-content = data + "%s %s\n" % (hghex(node), tag)
+content = data + "%s %s\n" % (node, tag)
 return context.memfilectx(f, content, False, False, None)
 
 p1 = tip.hex()
@@ -835,9 +838,10 @@ def do_export(parser):
 die('unhandled export command: %s' % line)
 
 for ref, node in parsed_refs.iteritems():
+bnode = hgbin(node)
 if ref.startswith('refs/heads/branches'):
 branch = ref[len('refs/heads/branches/'):]
-if branch in branches and node in branches[branch]:
+if branch in branches and bnode in branches[branch]:
 # up to date
 continue
 print "ok %s" % ref
@@ -851,11 +855,11 @@ def do_export(parser):
 author, msg = parsed_tags.get(tag, (None, None))
 if mode == 'git':
 if not msg:
-msg = 'Added tag %s for changeset %s' % (tag, 
hghex(node[:6]));
+msg = 'Added tag %s for changeset %s' % (tag, node[:12]);
 write_tag(parser.repo, tag, node, msg, author)
 else:
 fp = parser.repo.opener('localtags', 'a')
-fp.write('%s %s\n' % (hghex(node), tag))
+fp.write('%s %s\n' % (node, tag))
 fp.close()
 print "ok %s" % ref
 else:
@@ -869,7 +873,7 @@ def do_export(parser):
 # handle bookmarks
 for bmark, node in p_bmarks:
 ref = 'refs/heads/' + bmark
-new = hghex(node)
+new = node
 
 if bmark in bmarks:
 old = bmarks[bmark].hex()
-- 
1.8.3.rc1.579.g184e698

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 19/47] remote-hg: improve node traversing

2013-05-13 Thread Felipe Contreras
We won't be able to count the unmarked commits, but we are not going to
be able to do that anyway when we switch to SHA-1 ids.

Signed-off-by: Felipe Contreras 
---
 contrib/remote-helpers/git-remote-hg | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/contrib/remote-helpers/git-remote-hg 
b/contrib/remote-helpers/git-remote-hg
index 8417d1e..a3618de 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -392,12 +392,16 @@ def export_ref(repo, name, kind, head):
 revs = xrange(tip, head.rev() + 1)
 count = 0
 
-revs = [rev for rev in revs if not marks.is_marked(rev)]
-
 for rev in revs:
 
 c = repo[rev]
-(manifest, user, (time, tz), files, desc, extra) = 
repo.changelog.read(c.node())
+node = c.node()
+
+if marks.is_marked(c.hex()):
+count += 1
+continue
+
+(manifest, user, (time, tz), files, desc, extra) = 
repo.changelog.read(node)
 rev_branch = extra['branch']
 
 author = "%s %d %s" % (fixup_user(user), time, gittz(tz))
-- 
1.8.3.rc1.579.g184e698

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 17/47] remote-hg: use a shared repository store

2013-05-13 Thread Felipe Contreras
This way we don't have to have duplicated Mercurial objects.

Signed-off-by: Felipe Contreras 
---
 contrib/remote-helpers/git-remote-hg | 35 ---
 1 file changed, 20 insertions(+), 15 deletions(-)

diff --git a/contrib/remote-helpers/git-remote-hg 
b/contrib/remote-helpers/git-remote-hg
index 60e875d..d676c98 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -343,21 +343,29 @@ def get_repo(url, alias):
 
 if hg.islocal(url):
 repo = hg.repository(myui, url)
+if not os.path.exists(dirname):
+os.makedirs(dirname)
 else:
-local_path = os.path.join(dirname, 'clone')
-if not os.path.exists(local_path):
+shared_path = os.path.join(gitdir, 'hg')
+if not os.path.exists(shared_path):
 try:
-peer, dstpeer = hg.clone(myui, {}, url, local_path, 
update=True, pull=True)
+hg.clone(myui, {}, url, shared_path, update=False, pull=True)
 except:
 die('Repository error')
-repo = dstpeer.local()
-else:
-repo = hg.repository(myui, local_path)
-try:
-peer = hg.peer(myui, {}, url)
-except:
-die('Repository error')
-repo.pull(peer, heads=None, force=True)
+
+if not os.path.exists(dirname):
+os.mkdir(dirname)
+
+local_path = os.path.join(dirname, 'clone')
+if not os.path.exists(local_path):
+hg.share(myui, shared_path, local_path, update=False)
+
+repo = hg.repository(myui, local_path)
+try:
+peer = hg.peer(myui, {}, url)
+except:
+die('Repository error')
+repo.pull(peer, heads=None, force=True)
 
 rb = peer.listkeys('bookmarks')
 bookmarks.updatefromremote(myui, repo, rb, url)
@@ -901,7 +909,7 @@ def fix_path(alias, repo, orig_url):
 subprocess.call(cmd)
 
 def main(args):
-global prefix, dirname, branches, bmarks
+global prefix, gitdir, dirname, branches, bmarks
 global marks, blob_marks, parsed_refs
 global peer, mode, bad_mail, bad_name
 global track_branches, force_push, is_tmp
@@ -947,9 +955,6 @@ def main(args):
 if not is_tmp:
 fix_path(alias, peer or repo, url)
 
-if not os.path.exists(dirname):
-os.makedirs(dirname)
-
 marks_path = os.path.join(dirname, 'marks-hg')
 marks = Marks(marks_path)
 
-- 
1.8.3.rc1.579.g184e698

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 14/47] remote-helpers: test: simplify remote URLs

2013-05-13 Thread Felipe Contreras
No need to specify $PWD any more.

Signed-off-by: Felipe Contreras 
---
 contrib/remote-helpers/test-bzr.sh   | 12 ++--
 contrib/remote-helpers/test-hg-bidi.sh   |  6 +++---
 contrib/remote-helpers/test-hg-hg-git.sh |  6 +++---
 contrib/remote-helpers/test-hg.sh| 14 +++---
 4 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/contrib/remote-helpers/test-bzr.sh 
b/contrib/remote-helpers/test-bzr.sh
index 2774f41..90f8c7f 100755
--- a/contrib/remote-helpers/test-bzr.sh
+++ b/contrib/remote-helpers/test-bzr.sh
@@ -41,7 +41,7 @@ test_expect_success 'cloning' '
bzr commit -m one
) &&
 
-   git clone "bzr::$PWD/bzrrepo" gitrepo &&
+   git clone "bzr::bzrrepo" gitrepo &&
check gitrepo one master
 '
 
@@ -216,7 +216,7 @@ test_expect_success 'fetch utf-8 filenames' '
) &&
 
(
-   git clone "bzr::$PWD/bzrrepo" gitrepo &&
+   git clone "bzr::bzrrepo" gitrepo &&
cd gitrepo &&
git -c core.quotepath=false ls-files > ../actual
) &&
@@ -242,7 +242,7 @@ test_expect_success 'push utf-8 filenames' '
) &&
 
(
-   git clone "bzr::$PWD/bzrrepo" gitrepo &&
+   git clone "bzr::bzrrepo" gitrepo &&
cd gitrepo &&
 
echo test >> "ærø" &&
@@ -268,7 +268,7 @@ test_expect_success 'pushing a merge' '
bzr commit -m one
) &&
 
-   git clone "bzr::$PWD/bzrrepo" gitrepo &&
+   git clone "bzr::bzrrepo" gitrepo &&
 
(
cd bzrrepo &&
@@ -319,7 +319,7 @@ test_expect_success 'proper bzr repo' '
) &&
 
(
-   git clone "bzr::$PWD/bzrrepo" gitrepo &&
+   git clone "bzr::bzrrepo" gitrepo &&
cd gitrepo &&
git for-each-ref --format "%(refname:short)" refs/remotes/origin > 
../actual
) &&
@@ -342,7 +342,7 @@ test_expect_success 'strip' '
bzr commit -m two
) &&
 
-   git clone "bzr::$PWD/bzrrepo" gitrepo &&
+   git clone "bzr::bzrrepo" gitrepo &&
 
(
cd bzrrepo &&
diff --git a/contrib/remote-helpers/test-hg-bidi.sh 
b/contrib/remote-helpers/test-hg-bidi.sh
index 490a395..4bfbda2 100755
--- a/contrib/remote-helpers/test-hg-bidi.sh
+++ b/contrib/remote-helpers/test-hg-bidi.sh
@@ -22,7 +22,7 @@ fi
 
 # clone to a git repo
 git_clone () {
-   git clone -q "hg::$PWD/$1" $2
+   git clone -q "hg::$1" $2
 }
 
 # clone to an hg repo
@@ -31,7 +31,7 @@ hg_clone () {
hg init $2 &&
hg -R $2 bookmark -i master &&
cd $1 &&
-   git push -q "hg::$PWD/../$2" 'refs/tags/*:refs/tags/*' 
'refs/heads/*:refs/heads/*'
+   git push -q "hg::../$2" 'refs/tags/*:refs/tags/*' 
'refs/heads/*:refs/heads/*'
) &&
 
(cd $2 && hg -q update)
@@ -43,7 +43,7 @@ hg_push () {
cd $2
old=$(git symbolic-ref --short HEAD)
git checkout -q -b tmp &&
-   git fetch -q "hg::$PWD/../$1" 'refs/tags/*:refs/tags/*' 
'refs/heads/*:refs/heads/*' &&
+   git fetch -q "hg::../$1" 'refs/tags/*:refs/tags/*' 
'refs/heads/*:refs/heads/*' &&
git checkout -q $old &&
git branch -q -D tmp 2> /dev/null || true
)
diff --git a/contrib/remote-helpers/test-hg-hg-git.sh 
b/contrib/remote-helpers/test-hg-hg-git.sh
index 6f0819c..274a8d5 100755
--- a/contrib/remote-helpers/test-hg-hg-git.sh
+++ b/contrib/remote-helpers/test-hg-hg-git.sh
@@ -27,7 +27,7 @@ fi
 
 # clone to a git repo with git
 git_clone_git () {
-   git clone -q "hg::$PWD/$1" $2
+   git clone -q "hg::$1" $2
 }
 
 # clone to an hg repo with git
@@ -36,7 +36,7 @@ hg_clone_git () {
hg init $2 &&
hg -R $2 bookmark -i master &&
cd $1 &&
-   git push -q "hg::$PWD/../$2" 'refs/tags/*:refs/tags/*' 
'refs/heads/*:refs/heads/*'
+   git push -q "hg::../$2" 'refs/tags/*:refs/tags/*' 
'refs/heads/*:refs/heads/*'
) &&
 
(cd $2 && hg -q update)
@@ -63,7 +63,7 @@ hg_push_git () {
cd $2
old=$(git symbolic-ref --short HEAD)
git checkout -q -b tmp &&
-   git fetch -q "hg::$PWD/../$1" 'refs/tags/*:refs/tags/*' 
'refs/heads/*:refs/heads/*' &&
+   git fetch -q "hg::../$1" 'refs/tags/*:refs/tags/*' 
'refs/heads/*:refs/heads/*' &&
git checkout -q $old &&
git branch -q -D tmp 2> /dev/null || true
)
diff --git a/contrib/remote-helpers/test-hg.sh 
b/contrib/remote-helpers/test-hg.sh
index 043f6c6..4bd7584 100755
--- a/contrib/remote-helpers/test-hg.sh
+++ b/contrib/remote-helpers/test-hg.sh
@@ -53,7 +53,7 @@ test_expect_success 'cloning' '
hg commit -m zero
) &&
 
-   git clone "hg::$PWD/hgrepo" gitrepo &&
+   git clone "hg::hgrepo" gitrepo &&
check gitrepo zero master
 '
 
@@ -67,12 +67,12 @@ test_expect_success 'cloning with branches' '
hg commit -m next
) &&
 
-   git clone "hg::$PWD/hgrepo" gitrepo &&
+   git clone "hg::hgrepo" gitrepo &&
check gitrepo next next &&
 
(cd hgrepo && hg checkout default) &&
 
- 

[PATCH 15/47] remote-hg: test: simplify previous branch checkout

2013-05-13 Thread Felipe Contreras
@{-1} does the same thing.

Signed-off-by: Felipe Contreras 
---
 contrib/remote-helpers/test-hg-bidi.sh   | 3 +--
 contrib/remote-helpers/test-hg-hg-git.sh | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/contrib/remote-helpers/test-hg-bidi.sh 
b/contrib/remote-helpers/test-hg-bidi.sh
index 4bfbda2..88a33e6 100755
--- a/contrib/remote-helpers/test-hg-bidi.sh
+++ b/contrib/remote-helpers/test-hg-bidi.sh
@@ -41,10 +41,9 @@ hg_clone () {
 hg_push () {
(
cd $2
-   old=$(git symbolic-ref --short HEAD)
git checkout -q -b tmp &&
git fetch -q "hg::../$1" 'refs/tags/*:refs/tags/*' 
'refs/heads/*:refs/heads/*' &&
-   git checkout -q $old &&
+   git checkout -q @{-1} &&
git branch -q -D tmp 2> /dev/null || true
)
 }
diff --git a/contrib/remote-helpers/test-hg-hg-git.sh 
b/contrib/remote-helpers/test-hg-hg-git.sh
index 274a8d5..e503293 100755
--- a/contrib/remote-helpers/test-hg-hg-git.sh
+++ b/contrib/remote-helpers/test-hg-hg-git.sh
@@ -61,10 +61,9 @@ hg_clone_hg () {
 hg_push_git () {
(
cd $2
-   old=$(git symbolic-ref --short HEAD)
git checkout -q -b tmp &&
git fetch -q "hg::../$1" 'refs/tags/*:refs/tags/*' 
'refs/heads/*:refs/heads/*' &&
-   git checkout -q $old &&
+   git checkout -q @{-1} &&
git branch -q -D tmp 2> /dev/null || true
)
 }
-- 
1.8.3.rc1.579.g184e698

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 13/47] remote-helpers: tests: general improvements

2013-05-13 Thread Felipe Contreras
So that we don't need a temporary directory.

Signed-off-by: Felipe Contreras 
---
 contrib/remote-helpers/test-bzr.sh   | 21 ++--
 contrib/remote-helpers/test-hg-bidi.sh   | 15 +--
 contrib/remote-helpers/test-hg-hg-git.sh | 33 +++-
 contrib/remote-helpers/test-hg.sh|  7 +--
 4 files changed, 31 insertions(+), 45 deletions(-)

diff --git a/contrib/remote-helpers/test-bzr.sh 
b/contrib/remote-helpers/test-bzr.sh
index 6332050..2774f41 100755
--- a/contrib/remote-helpers/test-bzr.sh
+++ b/contrib/remote-helpers/test-bzr.sh
@@ -190,9 +190,11 @@ test_expect_success 'different authors' '
test_cmp expected actual
 '
 
+# cleanup previous stuff
+rm -rf bzrrepo gitrepo
+
 test_expect_success 'fetch utf-8 filenames' '
-   mkdir -p tmp && cd tmp &&
-   test_when_finished "cd .. && rm -rf tmp && LC_ALL=C" &&
+   test_when_finished "rm -rf bzrrepo gitrepo && LC_ALL=C" &&
 
LC_ALL=en_US.UTF-8
export LC_ALL
@@ -223,8 +225,9 @@ test_expect_success 'fetch utf-8 filenames' '
 '
 
 test_expect_success 'push utf-8 filenames' '
+   test_when_finished "rm -rf bzrrepo gitrepo && LC_ALL=C" &&
+
mkdir -p tmp && cd tmp &&
-   test_when_finished "cd .. && rm -rf tmp && LC_ALL=C" &&
 
LC_ALL=en_US.UTF-8
export LC_ALL
@@ -255,8 +258,7 @@ test_expect_success 'push utf-8 filenames' '
 '
 
 test_expect_success 'pushing a merge' '
-   mkdir -p tmp && cd tmp &&
-   test_when_finished "cd .. && rm -rf tmp" &&
+   test_when_finished "rm -rf bzrrepo gitrepo" &&
 
(
bzr init bzrrepo &&
@@ -297,8 +299,7 @@ origin/trunk
 EOF
 
 test_expect_success 'proper bzr repo' '
-   mkdir -p tmp && cd tmp &&
-   test_when_finished "cd .. && rm -rf tmp" &&
+   test_when_finished "rm -rf bzrrepo gitrepo" &&
 
bzr init-repo bzrrepo &&
 
@@ -323,13 +324,11 @@ test_expect_success 'proper bzr repo' '
git for-each-ref --format "%(refname:short)" refs/remotes/origin > 
../actual
) &&
 
-   test_cmp ../expected actual
+   test_cmp expected actual
 '
 
 test_expect_success 'strip' '
-   # Do not imitate this style; always chdir inside a subshell instead
-   mkdir -p tmp && cd tmp &&
-   test_when_finished "cd .. && rm -rf tmp" &&
+   test_when_finished "rm -rf bzrrepo gitrepo" &&
 
(
bzr init bzrrepo &&
diff --git a/contrib/remote-helpers/test-hg-bidi.sh 
b/contrib/remote-helpers/test-hg-bidi.sh
index f569697..490a395 100755
--- a/contrib/remote-helpers/test-hg-bidi.sh
+++ b/contrib/remote-helpers/test-hg-bidi.sh
@@ -77,8 +77,7 @@ setup () {
 setup
 
 test_expect_success 'encoding' '
-   mkdir -p tmp && cd tmp &&
-   test_when_finished "cd .. && rm -rf tmp" &&
+   test_when_finished "rm -rf gitrepo* hgrepo*" &&
 
(
git init -q gitrepo &&
@@ -115,8 +114,7 @@ test_expect_success 'encoding' '
 '
 
 test_expect_success 'file removal' '
-   mkdir -p tmp && cd tmp &&
-   test_when_finished "cd .. && rm -rf tmp" &&
+   test_when_finished "rm -rf gitrepo* hgrepo*" &&
 
(
git init -q gitrepo &&
@@ -148,8 +146,7 @@ test_expect_success 'file removal' '
 '
 
 test_expect_success 'git tags' '
-   mkdir -p tmp && cd tmp &&
-   test_when_finished "cd .. && rm -rf tmp" &&
+   test_when_finished "rm -rf gitrepo* hgrepo*" &&
 
(
git init -q gitrepo &&
@@ -177,8 +174,7 @@ test_expect_success 'git tags' '
 '
 
 test_expect_success 'hg branch' '
-   mkdir -p tmp && cd tmp &&
-   test_when_finished "cd .. && rm -rf tmp" &&
+   test_when_finished "rm -rf gitrepo* hgrepo*" &&
 
(
git init -q gitrepo &&
@@ -214,8 +210,7 @@ test_expect_success 'hg branch' '
 '
 
 test_expect_success 'hg tags' '
-   mkdir -p tmp && cd tmp &&
-   test_when_finished "cd .. && rm -rf tmp" &&
+   test_when_finished "rm -rf gitrepo* hgrepo*" &&
 
(
git init -q gitrepo &&
diff --git a/contrib/remote-helpers/test-hg-hg-git.sh 
b/contrib/remote-helpers/test-hg-hg-git.sh
index 7f579c8..6f0819c 100755
--- a/contrib/remote-helpers/test-hg-hg-git.sh
+++ b/contrib/remote-helpers/test-hg-hg-git.sh
@@ -114,8 +114,7 @@ setup () {
 setup
 
 test_expect_success 'executable bit' '
-   mkdir -p tmp && cd tmp &&
-   test_when_finished "cd .. && rm -rf tmp" &&
+   test_when_finished "rm -rf gitrepo* hgrepo*" &&
 
(
git init -q gitrepo &&
@@ -150,8 +149,7 @@ test_expect_success 'executable bit' '
 '
 
 test_expect_success 'symlink' '
-   mkdir -p tmp && cd tmp &&
-   test_when_finished "cd .. && rm -rf tmp" &&
+   test_when_finished "rm -rf gitrepo* hgrepo*" &&
 
(
git init -q gitrepo &&
@@ -181,8 +179,7 @@ test_expect_success 'symlink' '
 '
 
 test_expect_success 'merge conflict 1' '
-   mkdir -p tmp && cd tmp &&
-   test_when_finished "cd .. && rm -rf tmp" &&
+   test_when_finished "rm

[PATCH 12/47] remote-helpers: test: cleanup style

2013-05-13 Thread Felipe Contreras
So it's more standardized between all the tests.

Signed-off-by: Felipe Contreras 
---
 contrib/remote-helpers/test-bzr.sh | 88 +-
 contrib/remote-helpers/test-hg.sh  | 12 --
 2 files changed, 66 insertions(+), 34 deletions(-)

diff --git a/contrib/remote-helpers/test-bzr.sh 
b/contrib/remote-helpers/test-bzr.sh
index 00df2d1..6332050 100755
--- a/contrib/remote-helpers/test-bzr.sh
+++ b/contrib/remote-helpers/test-bzr.sh
@@ -18,18 +18,23 @@ if ! "$PYTHON_PATH" -c 'import bzrlib'; then
 fi
 
 check () {
-   (cd $1 &&
+   (
+   cd $1 &&
git log --format='%s' -1 &&
-   git symbolic-ref HEAD) > actual &&
-   (echo $2 &&
-   echo "refs/heads/$3") > expected &&
+   git symbolic-ref HEAD
+   ) > actual &&
+   (
+   echo $2 &&
+   echo "refs/heads/$3"
+   ) > expected &&
test_cmp expected actual
 }
 
 bzr whoami "A U Thor "
 
 test_expect_success 'cloning' '
-   (bzr init bzrrepo &&
+   (
+   bzr init bzrrepo &&
cd bzrrepo &&
echo one > content &&
bzr add content &&
@@ -41,7 +46,8 @@ test_expect_success 'cloning' '
 '
 
 test_expect_success 'pulling' '
-   (cd bzrrepo &&
+   (
+   cd bzrrepo &&
echo two > content &&
bzr commit -m two
) &&
@@ -52,7 +58,8 @@ test_expect_success 'pulling' '
 '
 
 test_expect_success 'pushing' '
-   (cd gitrepo &&
+   (
+   cd gitrepo &&
echo three > content &&
git commit -a -m three &&
git push
@@ -64,15 +71,18 @@ test_expect_success 'pushing' '
 '
 
 test_expect_success 'roundtrip' '
-   (cd gitrepo &&
+   (
+   cd gitrepo &&
git pull &&
-   git log --format="%s" -1 origin/master > actual) &&
+   git log --format="%s" -1 origin/master > actual
+   ) &&
echo three > expected &&
test_cmp expected actual &&
 
(cd gitrepo && git push && git pull) &&
 
-   (cd bzrrepo &&
+   (
+   cd bzrrepo &&
echo four > content &&
bzr commit -m four
) &&
@@ -81,7 +91,8 @@ test_expect_success 'roundtrip' '
 
check gitrepo four master &&
 
-   (cd gitrepo &&
+   (
+   cd gitrepo &&
echo five > content &&
git commit -a -m five &&
git push && git pull
@@ -101,7 +112,8 @@ cat > expected < executable
chmod +x executable &&
bzr add executable
@@ -111,16 +123,21 @@ test_expect_success 'special modes' '
bzr commit -m link &&
mkdir dir &&
bzr add dir &&
-   bzr commit -m dir) &&
+   bzr commit -m dir
+   ) &&
 
-   (cd gitrepo &&
+   (
+   cd gitrepo &&
git pull
-   git ls-tree HEAD > ../actual) &&
+   git ls-tree HEAD > ../actual
+   ) &&
 
test_cmp expected actual &&
 
-   (cd gitrepo &&
-   git cat-file -p HEAD:link > ../actual) &&
+   (
+   cd gitrepo &&
+   git cat-file -p HEAD:link > ../actual
+   ) &&
 
printf content > expected &&
test_cmp expected actual
@@ -134,32 +151,40 @@ cat > expected < movedir/one &&
echo two > movedir/two &&
bzr add movedir &&
bzr commit -m movedir &&
bzr mv movedir movedir-new &&
-   bzr commit -m movedir-new) &&
+   bzr commit -m movedir-new
+   ) &&
 
-   (cd gitrepo &&
+   (
+   cd gitrepo &&
git pull &&
-   git ls-tree HEAD > ../actual) &&
+   git ls-tree HEAD > ../actual
+   ) &&
 
test_cmp expected actual
 '
 
 test_expect_success 'different authors' '
-   (cd bzrrepo &&
+   (
+   cd bzrrepo &&
echo john >> content &&
bzr commit -m john \
  --author "Jane Rey " \
- --author "John Doe ") &&
+ --author "John Doe "
+   ) &&
 
-   (cd gitrepo &&
+   (
+   cd gitrepo &&
git pull &&
-   git show --format="%an <%ae>, %cn <%ce>" --quiet > ../actual) &&
+   git show --format="%an <%ae>, %cn <%ce>" --quiet > ../actual
+   ) &&
 
echo "Jane Rey , A U Thor " > 
expected &&
test_cmp expected actual
@@ -171,6 +196,7 @@ test_expect_success 'fetch utf-8 filenames' '
 
LC_ALL=en_US.UTF-8
export LC_ALL
+
(
bzr init bzrrepo &&
cd bzrrepo &&
@@ -276,23 +302,23 @@ test_expect_success 'proper bzr repo' '
 
bzr init-repo bzrrepo &&
 
-   bzr init bzrrepo/trunk &&
(
+   bzr init bzrrepo/trunk &&
cd bzrrepo/trunk &&
echo one >> content &&
bzr add content &&
bzr commit -m one
) &&
 
-   bzr branch bzrrepo/trunk bzrrepo/branch &&
(
+   bzr branch bzrrepo/trunk bzrrepo/branch &&
cd bzrrepo/branch &&
echo two >> content &&
bzr commit -m one
) &&
 
-   git clone "bzr::$PWD/bzrrepo" gitrepo &&
(
+   git clone "bzr::$PWD/bzrrepo" gitrepo &&
cd gitrepo &&
git for-eac

[PATCH 11/47] remote-helpers: test: cleanup white-spaces

2013-05-13 Thread Felipe Contreras
We prefer tabs to spaces.

Signed-off-by: Felipe Contreras 
---
 contrib/remote-helpers/test-bzr.sh | 460 ++---
 contrib/remote-helpers/test-hg.sh  | 176 +++---
 2 files changed, 318 insertions(+), 318 deletions(-)

diff --git a/contrib/remote-helpers/test-bzr.sh 
b/contrib/remote-helpers/test-bzr.sh
index d9c32f4..00df2d1 100755
--- a/contrib/remote-helpers/test-bzr.sh
+++ b/contrib/remote-helpers/test-bzr.sh
@@ -29,69 +29,69 @@ check () {
 bzr whoami "A U Thor "
 
 test_expect_success 'cloning' '
-  (bzr init bzrrepo &&
-  cd bzrrepo &&
-  echo one > content &&
-  bzr add content &&
-  bzr commit -m one
-  ) &&
-
-  git clone "bzr::$PWD/bzrrepo" gitrepo &&
-  check gitrepo one master
+   (bzr init bzrrepo &&
+   cd bzrrepo &&
+   echo one > content &&
+   bzr add content &&
+   bzr commit -m one
+   ) &&
+
+   git clone "bzr::$PWD/bzrrepo" gitrepo &&
+   check gitrepo one master
 '
 
 test_expect_success 'pulling' '
-  (cd bzrrepo &&
-  echo two > content &&
-  bzr commit -m two
-  ) &&
+   (cd bzrrepo &&
+   echo two > content &&
+   bzr commit -m two
+   ) &&
 
-  (cd gitrepo && git pull) &&
+   (cd gitrepo && git pull) &&
 
-  check gitrepo two master
+   check gitrepo two master
 '
 
 test_expect_success 'pushing' '
-  (cd gitrepo &&
-  echo three > content &&
-  git commit -a -m three &&
-  git push
-  ) &&
-
-  echo three > expected &&
-  cat bzrrepo/content > actual &&
-  test_cmp expected actual
+   (cd gitrepo &&
+   echo three > content &&
+   git commit -a -m three &&
+   git push
+   ) &&
+
+   echo three > expected &&
+   cat bzrrepo/content > actual &&
+   test_cmp expected actual
 '
 
 test_expect_success 'roundtrip' '
-  (cd gitrepo &&
-  git pull &&
-  git log --format="%s" -1 origin/master > actual) &&
-  echo three > expected &&
-  test_cmp expected actual &&
+   (cd gitrepo &&
+   git pull &&
+   git log --format="%s" -1 origin/master > actual) &&
+   echo three > expected &&
+   test_cmp expected actual &&
 
-  (cd gitrepo && git push && git pull) &&
+   (cd gitrepo && git push && git pull) &&
 
-  (cd bzrrepo &&
-  echo four > content &&
-  bzr commit -m four
-  ) &&
+   (cd bzrrepo &&
+   echo four > content &&
+   bzr commit -m four
+   ) &&
 
-  (cd gitrepo && git pull && git push) &&
+   (cd gitrepo && git pull && git push) &&
 
-  check gitrepo four master &&
+   check gitrepo four master &&
 
-  (cd gitrepo &&
-  echo five > content &&
-  git commit -a -m five &&
-  git push && git pull
-  ) &&
+   (cd gitrepo &&
+   echo five > content &&
+   git commit -a -m five &&
+   git push && git pull
+   ) &&
 
-  (cd bzrrepo && bzr revert) &&
+   (cd bzrrepo && bzr revert) &&
 
-  echo five > expected &&
-  cat bzrrepo/content > actual &&
-  test_cmp expected actual
+   echo five > expected &&
+   cat bzrrepo/content > actual &&
+   test_cmp expected actual
 '
 
 cat > expected < expected < executable
-  chmod +x executable &&
-  bzr add executable
-  bzr commit -m exec &&
-  ln -s content link
-  bzr add link
-  bzr commit -m link &&
-  mkdir dir &&
-  bzr add dir &&
-  bzr commit -m dir) &&
-
-  (cd gitrepo &&
-  git pull
-  git ls-tree HEAD > ../actual) &&
-
-  test_cmp expected actual &&
-
-  (cd gitrepo &&
-  git cat-file -p HEAD:link > ../actual) &&
-
-  printf content > expected &&
-  test_cmp expected actual
+   (cd bzrrepo &&
+   echo exec > executable
+   chmod +x executable &&
+   bzr add executable
+   bzr commit -m exec &&
+   ln -s content link
+   bzr add link
+   bzr commit -m link &&
+   mkdir dir &&
+   bzr add dir &&
+   bzr commit -m dir) &&
+
+   (cd gitrepo &&
+   git pull
+   git ls-tree HEAD > ../actual) &&
+
+   test_cmp expected actual &&
+
+   (cd gitrepo &&
+   git cat-file -p HEAD:link > ../actual) &&
+
+   printf content > expected &&
+   test_cmp expected actual
 '
 
 cat > expected < expected < movedir/one &&
-  echo two > movedir/two &&
-  bzr add movedir &&
-  bzr commit -m movedir &&
-  bzr mv movedir movedir-new &&
-  bzr commit -m movedir-new) &&
-
-  (cd gitrepo &&
-  git pull &&
-  git ls-tree HEAD > ../actual) &&
-
-  test_cmp expected actual
+   (cd bzrrepo &&
+   mkdir movedir &&
+   echo one > movedir/one &&
+   echo two > movedir/two &&
+   bzr add movedir &&
+   bzr commit -m movedir &&
+   bzr mv movedir movedir-new &&
+   bzr commit -m movedir-new) &&
+
+   (cd gitrepo &&
+   git pull &&
+   git ls-tree HEAD > ../actual) &&
+
+   test_cmp expected actual
 '
 
 test_expect_success 'different authors' '
-  (cd bzrrepo &&
-  echo john >> content &&
-  bzr commit -m john \
---author "Jane Rey " \
---author "John Doe ") &&
-
-  (cd gitrepo &&
-  git pull &&
-  git show --format="%an <%ae>, %cn <%ce>" --qu

[PATCH 10/47] remote-hg: trivial reorganization

2013-05-13 Thread Felipe Contreras
We only need to get the remote dict once.

Signed-off-by: Felipe Contreras 
---
 contrib/remote-helpers/git-remote-hg | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/contrib/remote-helpers/git-remote-hg 
b/contrib/remote-helpers/git-remote-hg
index dc276af..96bed8d 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -860,6 +860,7 @@ def do_export(parser):
 
 if peer:
 parser.repo.push(peer, force=force_push, newbranch=True)
+remote_bmarks = peer.listkeys('bookmarks')
 
 # handle bookmarks
 for bmark, node in p_bmarks:
@@ -886,8 +887,7 @@ def do_export(parser):
 continue
 
 if peer:
-rb = peer.listkeys('bookmarks')
-old = rb.get(bmark, '')
+old = remote_bmarks.get(bmark, '')
 if not peer.pushkey('bookmarks', bmark, old, new):
 print "error %s" % ref
 continue
-- 
1.8.3.rc1.579.g184e698

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 09/47] remote-hg: test: be a little more quiet

2013-05-13 Thread Felipe Contreras
Signed-off-by: Felipe Contreras 
---
 contrib/remote-helpers/test-hg.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/contrib/remote-helpers/test-hg.sh 
b/contrib/remote-helpers/test-hg.sh
index 8de2aa7..f8d1f9e 100755
--- a/contrib/remote-helpers/test-hg.sh
+++ b/contrib/remote-helpers/test-hg.sh
@@ -109,10 +109,10 @@ test_expect_success 'update bookmark' '
   (
   git clone "hg::$PWD/hgrepo" gitrepo &&
   cd gitrepo &&
-  git checkout devel &&
+  git checkout --quiet devel &&
   echo devel > content &&
   git commit -a -m devel &&
-  git push
+  git push --quiet
   ) &&
 
   hg -R hgrepo bookmarks | egrep "devel[]+3:"
-- 
1.8.3.rc1.579.g184e698

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 07/47] remote-hg: don't push fake 'master' bookmark

2013-05-13 Thread Felipe Contreras
We skip it locally, but not for the remote, so let's do so.

Signed-off-by: Felipe Contreras 
---
 contrib/remote-helpers/git-remote-hg | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/contrib/remote-helpers/git-remote-hg 
b/contrib/remote-helpers/git-remote-hg
index 53412dd..beb864b 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -873,7 +873,8 @@ def do_export(parser):
 
 if bmark == 'master' and 'master' not in parser.repo._bookmarks:
 # fake bookmark
-pass
+print "ok %s" % ref
+continue
 elif bookmarks.pushbookmark(parser.repo, bmark, old, new):
 # updated locally
 pass
-- 
1.8.3.rc1.579.g184e698

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 08/47] remote-hg: update bookmarks when pulling

2013-05-13 Thread Felipe Contreras
Signed-off-by: Felipe Contreras 
---
 contrib/remote-helpers/git-remote-hg | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/contrib/remote-helpers/git-remote-hg 
b/contrib/remote-helpers/git-remote-hg
index beb864b..dc276af 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -363,6 +363,9 @@ def get_repo(url, alias):
 die('Repository error')
 repo.pull(peer, heads=None, force=True)
 
+rb = peer.listkeys('bookmarks')
+bookmarks.updatefromremote(myui, repo, rb, url)
+
 return repo
 
 def rev_to_mark(rev):
-- 
1.8.3.rc1.579.g184e698

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 06/47] remote-hg: disable forced push by default

2013-05-13 Thread Felipe Contreras
In certain situations we might end up pushing garbage revisions (e.g. in
a rebase), and the patches to deal with that haven't been merged yet.

So let's disable forced pushes by default.

Signed-off-by: Felipe Contreras 
---
 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 3cf9b4c..53412dd 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -914,7 +914,7 @@ def main(args):
 
 hg_git_compat = get_config_bool('remote-hg.hg-git-compat')
 track_branches = get_config_bool('remote-hg.track-branches', True)
-force_push = get_config_bool('remote-hg.force-push', True)
+force_push = get_config_bool('remote-hg.force-push')
 
 if hg_git_compat:
 mode = 'hg'
-- 
1.8.3.rc1.579.g184e698

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 05/47] remote-hg: fix new branch creation

2013-05-13 Thread Felipe Contreras
When force_push is disabled, we need to turn the argument to True.

Signed-off-by: Felipe Contreras 
---
 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 4a5c72f..3cf9b4c 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -856,7 +856,7 @@ def do_export(parser):
 continue
 
 if peer:
-parser.repo.push(peer, force=force_push)
+parser.repo.push(peer, force=force_push, newbranch=True)
 
 # handle bookmarks
 for bmark, node in p_bmarks:
-- 
1.8.3.rc1.579.g184e698

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 04/47] remote-hg: add new get_config_bool() helper

2013-05-13 Thread Felipe Contreras
No functional changes.

Signed-off-by: Felipe Contreras 
---
 contrib/remote-helpers/git-remote-hg | 24 +---
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/contrib/remote-helpers/git-remote-hg 
b/contrib/remote-helpers/git-remote-hg
index de3a96e..4a5c72f 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -87,6 +87,15 @@ def get_config(config):
 output, _ = process.communicate()
 return output
 
+def get_config_bool(config, default=False):
+value = get_config(config).rstrip('\n')
+if value == "true":
+return True
+elif value == "false":
+return False
+else:
+return default
+
 class Marks:
 
 def __init__(self, path):
@@ -327,7 +336,7 @@ def get_repo(url, alias):
 myui.setconfig('ui', 'interactive', 'off')
 myui.fout = sys.stderr
 
-if get_config('remote-hg.insecure') == 'true\n':
+if get_config_bool('remote-hg.insecure'):
 myui.setconfig('web', 'cacerts', '')
 
 try:
@@ -903,16 +912,9 @@ def main(args):
 url = args[2]
 peer = None
 
-hg_git_compat = False
-track_branches = True
-force_push = True
-
-if get_config('remote-hg.hg-git-compat') == 'true\n':
-hg_git_compat = True
-if get_config('remote-hg.track-branches') == 'false\n':
-track_branches = False
-if get_config('remote-hg.force-push') == 'false\n':
-force_push = False
+hg_git_compat = get_config_bool('remote-hg.hg-git-compat')
+track_branches = get_config_bool('remote-hg.track-branches', True)
+force_push = get_config_bool('remote-hg.force-push', True)
 
 if hg_git_compat:
 mode = 'hg'
-- 
1.8.3.rc1.579.g184e698

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 02/47] remote-hg: get rid of unused exception checks

2013-05-13 Thread Felipe Contreras
We are not calling check_output() anymore.

Signed-off-by: Felipe Contreras 
---
 contrib/remote-helpers/git-remote-hg | 24 +---
 1 file changed, 9 insertions(+), 15 deletions(-)

diff --git a/contrib/remote-helpers/git-remote-hg 
b/contrib/remote-helpers/git-remote-hg
index d33c7ba..9d6940b 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -327,11 +327,8 @@ def get_repo(url, alias):
 myui.setconfig('ui', 'interactive', 'off')
 myui.fout = sys.stderr
 
-try:
-if get_config('remote-hg.insecure') == 'true\n':
-myui.setconfig('web', 'cacerts', '')
-except subprocess.CalledProcessError:
-pass
+if get_config('remote-hg.insecure') == 'true\n':
+myui.setconfig('web', 'cacerts', '')
 
 try:
 mod = extensions.load(myui, 'hgext.schemes', None)
@@ -910,16 +907,13 @@ def main(args):
 track_branches = True
 force_push = True
 
-try:
-if get_config('remote-hg.hg-git-compat') == 'true\n':
-hg_git_compat = True
-track_branches = False
-if get_config('remote-hg.track-branches') == 'false\n':
-track_branches = False
-if get_config('remote-hg.force-push') == 'false\n':
-force_push = False
-except subprocess.CalledProcessError:
-pass
+if get_config('remote-hg.hg-git-compat') == 'true\n':
+hg_git_compat = True
+track_branches = False
+if get_config('remote-hg.track-branches') == 'false\n':
+track_branches = False
+if get_config('remote-hg.force-push') == 'false\n':
+force_push = False
 
 if hg_git_compat:
 mode = 'hg'
-- 
1.8.3.rc1.579.g184e698

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 03/47] remote-hg: enable track-branches in hg-git mode

2013-05-13 Thread Felipe Contreras
The user can turn this off.

Signed-off-by: Felipe Contreras 
---
 contrib/remote-helpers/git-remote-hg | 1 -
 contrib/remote-helpers/test-hg-hg-git.sh | 1 +
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/remote-helpers/git-remote-hg 
b/contrib/remote-helpers/git-remote-hg
index 9d6940b..de3a96e 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -909,7 +909,6 @@ def main(args):
 
 if get_config('remote-hg.hg-git-compat') == 'true\n':
 hg_git_compat = True
-track_branches = False
 if get_config('remote-hg.track-branches') == 'false\n':
 track_branches = False
 if get_config('remote-hg.force-push') == 'false\n':
diff --git a/contrib/remote-helpers/test-hg-hg-git.sh 
b/contrib/remote-helpers/test-hg-hg-git.sh
index 0c36573..7f579c8 100755
--- a/contrib/remote-helpers/test-hg-hg-git.sh
+++ b/contrib/remote-helpers/test-hg-hg-git.sh
@@ -102,6 +102,7 @@ setup () {
) >> "$HOME"/.hgrc &&
git config --global receive.denycurrentbranch warn
git config --global remote-hg.hg-git-compat true
+   git config --global remote-hg.track-branches false
 
HGEDITOR=/usr/bin/true
 
-- 
1.8.3.rc1.579.g184e698

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 01/47] remote-hg: trivial cleanups

2013-05-13 Thread Felipe Contreras
Signed-off-by: Felipe Contreras 
---
 contrib/remote-helpers/git-remote-hg | 2 +-
 contrib/remote-helpers/test-hg-hg-git.sh | 2 --
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/contrib/remote-helpers/git-remote-hg 
b/contrib/remote-helpers/git-remote-hg
index 96ad30d..d33c7ba 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -538,7 +538,7 @@ def list_head(repo, cur):
 g_head = (head, node)
 
 def do_list(parser):
-global branches, bmarks, mode, track_branches
+global branches, bmarks, track_branches
 
 repo = parser.repo
 for bmark, node in bookmarks.listbookmarks(repo).iteritems():
diff --git a/contrib/remote-helpers/test-hg-hg-git.sh 
b/contrib/remote-helpers/test-hg-hg-git.sh
index 8440341..0c36573 100755
--- a/contrib/remote-helpers/test-hg-hg-git.sh
+++ b/contrib/remote-helpers/test-hg-hg-git.sh
@@ -455,8 +455,6 @@ test_expect_success 'hg author' '
git_log gitrepo-$x > git-log-$x
done &&
 
-   test_cmp git-log-hg git-log-git &&
-
test_cmp hg-log-hg hg-log-git &&
test_cmp git-log-hg git-log-git
 '
-- 
1.8.3.rc1.579.g184e698

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 00/47] remote-hg: fixes for next

2013-05-13 Thread Felipe Contreras
Hi,

I've been cooking these for some time now, and they seem to be mostly ready.
The major changes are:

 1) Use our own custom push() method that allows us to push bookmarks without
having to force a push.

 2) Switch from revision numbers to SHA-1s in the marks.

 3) Use a common repsitory so multiple remotes chan share the same objects.

 4) Cleaned up and add a ton of tests

With these, we pass all the tests from gitifyhg as well as our own.

Felipe Contreras (47):
  remote-hg: trivial cleanups
  remote-hg: get rid of unused exception checks
  remote-hg: enable track-branches in hg-git mode
  remote-hg: add new get_config_bool() helper
  remote-hg: fix new branch creation
  remote-hg: disable forced push by default
  remote-hg: don't push fake 'master' bookmark
  remote-hg: update bookmarks when pulling
  remote-hg: test: be a little more quiet
  remote-hg: trivial reorganization
  remote-helpers: test: cleanup white-spaces
  remote-helpers: test: cleanup style
  remote-helpers: tests: general improvements
  remote-helpers: test: simplify remote URLs
  remote-hg: test: simplify previous branch checkout
  remote-hg: load all extensions
  remote-hg: use a shared repository store
  remote-hg: shuffle some code
  remote-hg: improve node traversing
  remote-hg: add version checks to the marks
  remote-hg: switch from revisions to SHA-1 noteids
  remote-hg: upgrade version 1 marks
  remote-hg: ensure remote rebasing works
  remote-hg: trivial cleanups
  remote-hg: improve progress calculation
  remote-hg: always point HEAD to master
  remote-bzr: simplify test checks
  remote-hg: add check_bookmark() test helper
  remote-hg: add remote tests
  remote-hg: add test to push new bookmark
  remote-hg: add test for diverged push
  remote-hg: add test for bookmark diverge
  remote-hg: add test for new bookmark special
  remote-hg: add test for big push
  remote-hg: add test for failed double push
  remote-hg: reorganize bookmark handling
  remote-hg: force remote bookmark push selectively
  remote-hg: only update necessary revisions
  remote-hg: implement custom  push()
  remote-hg: implement custom checkheads()
  remote-hg: pass around revision refs
  remote-hg: check diverged bookmarks
  remote-hg: simplify branch_tip()
  remote-hg: improve branch listing
  remote-hg: use remote 'default' not local one
  remote-hg: improve lightweight tag author
  remote-hg: remove files before modifications

 contrib/remote-helpers/git-remote-hg | 444 ++--
 contrib/remote-helpers/test-bzr.sh   | 490 +++---
 contrib/remote-helpers/test-hg-bidi.sh   |  33 +--
 contrib/remote-helpers/test-hg-hg-git.sh |  47 ++-
 contrib/remote-helpers/test-hg.sh| 492 +--
 5 files changed, 974 insertions(+), 532 deletions(-)

-- 
1.8.3.rc1.579.g184e698

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] remote-bzr: update old organization

2013-05-13 Thread Felipe Contreras
If a clone exists with the old organization (v1.8.2) it will prevent the
new shared repository organization from working, so let's remove this
repository, which is not used any more.

Signed-off-by: Felipe Contreras 
---
 contrib/remote-helpers/git-remote-bzr | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/contrib/remote-helpers/git-remote-bzr 
b/contrib/remote-helpers/git-remote-bzr
index 3e452af..b295dd4 100755
--- a/contrib/remote-helpers/git-remote-bzr
+++ b/contrib/remote-helpers/git-remote-bzr
@@ -830,6 +830,13 @@ def get_repo(url, alias):
 clone_path = os.path.join(dirname, 'clone')
 if not os.path.exists(clone_path):
 os.mkdir(clone_path)
+else:
+# check and remove old organization
+try:
+bdir = bzrlib.bzrdir.BzrDir.open(clone_path)
+bdir.destroy_repository()
+except bzrlib.errors.NotBranchError:
+pass
 
 try:
 repo = origin.open_repository()
-- 
1.8.3.rc1.579.g184e698

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3 00/10] remote-hg: fixes and cleanups

2013-05-13 Thread Felipe Contreras
On Mon, May 13, 2013 at 8:08 PM, Junio C Hamano  wrote:
> Felipe Contreras  writes:
>
>> Since the last series is not merged to master yet, I decided to add more 
>> cleanups.
>
> Because nothing new will go to 'master' past -rc1 by default, unless
> you are working on fixing or finding 1.8.3 regressions, this is a
> good time to polish things that are meant for the next cycle.

I know, I've been polishing a bunch of patches for the next cycle for
a long time.

> Folks interested in working remote-hg, please try it out, so that we
> can have a polished one soon after 1.8.3 ships (I am not saying this
> round is not polished---I haven't even looked at the patches).
>
> And others, please spend time on testing the 1.8.3-rc2 to make sure
> what we are going to ship is free of embarrassing regressions.

The whole purpose of this series is to avoid regressions, that's why I
sent them for 1.8.3. I thought I made it clear[1] that we would want
these patches in, to avoid regressions, unless it's desirable that we
end up pushing garbage to a remote repository.

Cheers.

[1] http://article.gmane.org/gmane.comp.version-control.git/224224

-- 
Felipe Contreras
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Re: [PATCH v4 3/5] config: make parsing stack struct independent from actual data source

2013-05-13 Thread Jeff King
On Mon, May 13, 2013 at 04:04:35PM +0200, Heiko Voigt wrote:

> > > -static int do_config_from(struct config_file *top, config_fn_t fn, void 
> > > *data)
> > > +static int do_config_from_source(struct config_source *top, config_fn_t 
> > > fn, void *data)
> [...]
> I thought I recalled that Jeff asked me to change the name but I can
> not find the email, so maybe its just my wrong memory. I am happy to
> drop the rename here, if thats what you meant.

I think you are thinking of:

  http://thread.gmane.org/gmane.comp.version-control.git/217018/focus=217170

where I criticize the name. But I think the comment you added makes its
purpose much more clear, so the name is less important (and for the
record, I think "do_config" or "config_source_parse" would be fine,
too).

-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3 00/10] remote-hg: fixes and cleanups

2013-05-13 Thread Junio C Hamano
Felipe Contreras  writes:

> Since the last series is not merged to master yet, I decided to add more 
> cleanups.

Because nothing new will go to 'master' past -rc1 by default, unless
you are working on fixing or finding 1.8.3 regressions, this is a
good time to polish things that are meant for the next cycle.

Folks interested in working remote-hg, please try it out, so that we
can have a polished one soon after 1.8.3 ships (I am not saying this
round is not polished---I haven't even looked at the patches).

And others, please spend time on testing the 1.8.3-rc2 to make sure
what we are going to ship is free of embarrassing regressions.

Thanks.

>
> Felipe Contreras (10):
>   remote-hg: trivial cleanups
>   remote-hg: get rid of unused exception checks
>   remote-hg: enable track-branches in hg-git mode
>   remote-hg: add new get_config_bool() helper
>   remote-hg: fix new branch creation
>   remote-hg: disable forced push by default
>   remote-hg: don't push fake 'master' bookmark
>   remote-hg: update bookmarks when pulling
>   remote-hg: test: be a little more quiet
>   remote-hg: trivial reorganization
>
>  contrib/remote-helpers/git-remote-hg | 47 
> 
>  contrib/remote-helpers/test-hg-hg-git.sh |  3 +-
>  contrib/remote-helpers/test-hg.sh|  4 +--
>  3 files changed, 26 insertions(+), 28 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v4 01/11] Add new git-related helper to contrib

2013-05-13 Thread Felipe Contreras
On Fri, Apr 26, 2013 at 10:01 PM, Ramkumar Ramachandra
 wrote:
> Felipe Contreras wrote:
>> That's fine, I was mostly asking Ramkumar who earlier argued earlier
>> versions of this patch were not understandable.
>
> Sorry, still catching up with list emails.  At a glance, part 1 looks
> much better.  Will read through more carefully soon.

Gentle reminder.

-- 
Felipe Contreras
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 0/6] remote-hg: fixes and cleanups

2013-05-13 Thread Felipe Contreras
On Fri, May 10, 2013 at 3:59 PM, Felipe Contreras
 wrote:

> A few fixes since last series, plus a few more patches. Simple no-brainers.
>
> Felipe Contreras (6):
>   remote-hg: disable forced push by default
>   remote-hg: don't push fake 'master' bookmark
>   remote-hg: update bookmarks when pulling
>   remote-hg: test: be a little more quiet
>   remote-hg: fix new branch creation
>   remote-hg: trivial reorganization
>
>  contrib/remote-helpers/git-remote-hg | 18 +++---
>  contrib/remote-helpers/test-hg.sh|  4 ++--
>  2 files changed, 13 insertions(+), 9 deletions(-)

I was expecting these to be merged to 'master', but since they are
still not merged, I decided to send more cleanups.

-- 
Felipe Contreras
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 09/10] remote-hg: test: be a little more quiet

2013-05-13 Thread Felipe Contreras
Signed-off-by: Felipe Contreras 
---
 contrib/remote-helpers/test-hg.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/contrib/remote-helpers/test-hg.sh 
b/contrib/remote-helpers/test-hg.sh
index 8de2aa7..f8d1f9e 100755
--- a/contrib/remote-helpers/test-hg.sh
+++ b/contrib/remote-helpers/test-hg.sh
@@ -109,10 +109,10 @@ test_expect_success 'update bookmark' '
   (
   git clone "hg::$PWD/hgrepo" gitrepo &&
   cd gitrepo &&
-  git checkout devel &&
+  git checkout --quiet devel &&
   echo devel > content &&
   git commit -a -m devel &&
-  git push
+  git push --quiet
   ) &&
 
   hg -R hgrepo bookmarks | egrep "devel[]+3:"
-- 
1.8.3.rc1.579.g184e698

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 10/10] remote-hg: trivial reorganization

2013-05-13 Thread Felipe Contreras
We only need to get the remote dict once.

Signed-off-by: Felipe Contreras 
---
 contrib/remote-helpers/git-remote-hg | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/contrib/remote-helpers/git-remote-hg 
b/contrib/remote-helpers/git-remote-hg
index dc276af..96bed8d 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -860,6 +860,7 @@ def do_export(parser):
 
 if peer:
 parser.repo.push(peer, force=force_push, newbranch=True)
+remote_bmarks = peer.listkeys('bookmarks')
 
 # handle bookmarks
 for bmark, node in p_bmarks:
@@ -886,8 +887,7 @@ def do_export(parser):
 continue
 
 if peer:
-rb = peer.listkeys('bookmarks')
-old = rb.get(bmark, '')
+old = remote_bmarks.get(bmark, '')
 if not peer.pushkey('bookmarks', bmark, old, new):
 print "error %s" % ref
 continue
-- 
1.8.3.rc1.579.g184e698

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 08/10] remote-hg: update bookmarks when pulling

2013-05-13 Thread Felipe Contreras
Signed-off-by: Felipe Contreras 
---
 contrib/remote-helpers/git-remote-hg | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/contrib/remote-helpers/git-remote-hg 
b/contrib/remote-helpers/git-remote-hg
index beb864b..dc276af 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -363,6 +363,9 @@ def get_repo(url, alias):
 die('Repository error')
 repo.pull(peer, heads=None, force=True)
 
+rb = peer.listkeys('bookmarks')
+bookmarks.updatefromremote(myui, repo, rb, url)
+
 return repo
 
 def rev_to_mark(rev):
-- 
1.8.3.rc1.579.g184e698

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 07/10] remote-hg: don't push fake 'master' bookmark

2013-05-13 Thread Felipe Contreras
We skip it locally, but not for the remote, so let's do so.

Signed-off-by: Felipe Contreras 
---
 contrib/remote-helpers/git-remote-hg | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/contrib/remote-helpers/git-remote-hg 
b/contrib/remote-helpers/git-remote-hg
index 53412dd..beb864b 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -873,7 +873,8 @@ def do_export(parser):
 
 if bmark == 'master' and 'master' not in parser.repo._bookmarks:
 # fake bookmark
-pass
+print "ok %s" % ref
+continue
 elif bookmarks.pushbookmark(parser.repo, bmark, old, new):
 # updated locally
 pass
-- 
1.8.3.rc1.579.g184e698

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 06/10] remote-hg: disable forced push by default

2013-05-13 Thread Felipe Contreras
In certain situations we might end up pushing garbage revisions (e.g. in
a rebase), and the patches to deal with that haven't been merged yet.

So let's disable forced pushes by default.

Signed-off-by: Felipe Contreras 
---
 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 3cf9b4c..53412dd 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -914,7 +914,7 @@ def main(args):
 
 hg_git_compat = get_config_bool('remote-hg.hg-git-compat')
 track_branches = get_config_bool('remote-hg.track-branches', True)
-force_push = get_config_bool('remote-hg.force-push', True)
+force_push = get_config_bool('remote-hg.force-push')
 
 if hg_git_compat:
 mode = 'hg'
-- 
1.8.3.rc1.579.g184e698

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 05/10] remote-hg: fix new branch creation

2013-05-13 Thread Felipe Contreras
When force_push is disabled, we need to turn the argument to True.

Signed-off-by: Felipe Contreras 
---
 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 4a5c72f..3cf9b4c 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -856,7 +856,7 @@ def do_export(parser):
 continue
 
 if peer:
-parser.repo.push(peer, force=force_push)
+parser.repo.push(peer, force=force_push, newbranch=True)
 
 # handle bookmarks
 for bmark, node in p_bmarks:
-- 
1.8.3.rc1.579.g184e698

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 04/10] remote-hg: add new get_config_bool() helper

2013-05-13 Thread Felipe Contreras
No functional changes.

Signed-off-by: Felipe Contreras 
---
 contrib/remote-helpers/git-remote-hg | 24 +---
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/contrib/remote-helpers/git-remote-hg 
b/contrib/remote-helpers/git-remote-hg
index de3a96e..4a5c72f 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -87,6 +87,15 @@ def get_config(config):
 output, _ = process.communicate()
 return output
 
+def get_config_bool(config, default=False):
+value = get_config(config).rstrip('\n')
+if value == "true":
+return True
+elif value == "false":
+return False
+else:
+return default
+
 class Marks:
 
 def __init__(self, path):
@@ -327,7 +336,7 @@ def get_repo(url, alias):
 myui.setconfig('ui', 'interactive', 'off')
 myui.fout = sys.stderr
 
-if get_config('remote-hg.insecure') == 'true\n':
+if get_config_bool('remote-hg.insecure'):
 myui.setconfig('web', 'cacerts', '')
 
 try:
@@ -903,16 +912,9 @@ def main(args):
 url = args[2]
 peer = None
 
-hg_git_compat = False
-track_branches = True
-force_push = True
-
-if get_config('remote-hg.hg-git-compat') == 'true\n':
-hg_git_compat = True
-if get_config('remote-hg.track-branches') == 'false\n':
-track_branches = False
-if get_config('remote-hg.force-push') == 'false\n':
-force_push = False
+hg_git_compat = get_config_bool('remote-hg.hg-git-compat')
+track_branches = get_config_bool('remote-hg.track-branches', True)
+force_push = get_config_bool('remote-hg.force-push', True)
 
 if hg_git_compat:
 mode = 'hg'
-- 
1.8.3.rc1.579.g184e698

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 03/10] remote-hg: enable track-branches in hg-git mode

2013-05-13 Thread Felipe Contreras
The user can turn this off.

Signed-off-by: Felipe Contreras 
---
 contrib/remote-helpers/git-remote-hg | 1 -
 contrib/remote-helpers/test-hg-hg-git.sh | 1 +
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/remote-helpers/git-remote-hg 
b/contrib/remote-helpers/git-remote-hg
index 9d6940b..de3a96e 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -909,7 +909,6 @@ def main(args):
 
 if get_config('remote-hg.hg-git-compat') == 'true\n':
 hg_git_compat = True
-track_branches = False
 if get_config('remote-hg.track-branches') == 'false\n':
 track_branches = False
 if get_config('remote-hg.force-push') == 'false\n':
diff --git a/contrib/remote-helpers/test-hg-hg-git.sh 
b/contrib/remote-helpers/test-hg-hg-git.sh
index 0c36573..7f579c8 100755
--- a/contrib/remote-helpers/test-hg-hg-git.sh
+++ b/contrib/remote-helpers/test-hg-hg-git.sh
@@ -102,6 +102,7 @@ setup () {
) >> "$HOME"/.hgrc &&
git config --global receive.denycurrentbranch warn
git config --global remote-hg.hg-git-compat true
+   git config --global remote-hg.track-branches false
 
HGEDITOR=/usr/bin/true
 
-- 
1.8.3.rc1.579.g184e698

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 02/10] remote-hg: get rid of unused exception checks

2013-05-13 Thread Felipe Contreras
We are not calling check_output() anymore.

Signed-off-by: Felipe Contreras 
---
 contrib/remote-helpers/git-remote-hg | 24 +---
 1 file changed, 9 insertions(+), 15 deletions(-)

diff --git a/contrib/remote-helpers/git-remote-hg 
b/contrib/remote-helpers/git-remote-hg
index d33c7ba..9d6940b 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -327,11 +327,8 @@ def get_repo(url, alias):
 myui.setconfig('ui', 'interactive', 'off')
 myui.fout = sys.stderr
 
-try:
-if get_config('remote-hg.insecure') == 'true\n':
-myui.setconfig('web', 'cacerts', '')
-except subprocess.CalledProcessError:
-pass
+if get_config('remote-hg.insecure') == 'true\n':
+myui.setconfig('web', 'cacerts', '')
 
 try:
 mod = extensions.load(myui, 'hgext.schemes', None)
@@ -910,16 +907,13 @@ def main(args):
 track_branches = True
 force_push = True
 
-try:
-if get_config('remote-hg.hg-git-compat') == 'true\n':
-hg_git_compat = True
-track_branches = False
-if get_config('remote-hg.track-branches') == 'false\n':
-track_branches = False
-if get_config('remote-hg.force-push') == 'false\n':
-force_push = False
-except subprocess.CalledProcessError:
-pass
+if get_config('remote-hg.hg-git-compat') == 'true\n':
+hg_git_compat = True
+track_branches = False
+if get_config('remote-hg.track-branches') == 'false\n':
+track_branches = False
+if get_config('remote-hg.force-push') == 'false\n':
+force_push = False
 
 if hg_git_compat:
 mode = 'hg'
-- 
1.8.3.rc1.579.g184e698

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 01/10] remote-hg: trivial cleanups

2013-05-13 Thread Felipe Contreras
Signed-off-by: Felipe Contreras 
---
 contrib/remote-helpers/git-remote-hg | 2 +-
 contrib/remote-helpers/test-hg-hg-git.sh | 2 --
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/contrib/remote-helpers/git-remote-hg 
b/contrib/remote-helpers/git-remote-hg
index 96ad30d..d33c7ba 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -538,7 +538,7 @@ def list_head(repo, cur):
 g_head = (head, node)
 
 def do_list(parser):
-global branches, bmarks, mode, track_branches
+global branches, bmarks, track_branches
 
 repo = parser.repo
 for bmark, node in bookmarks.listbookmarks(repo).iteritems():
diff --git a/contrib/remote-helpers/test-hg-hg-git.sh 
b/contrib/remote-helpers/test-hg-hg-git.sh
index 8440341..0c36573 100755
--- a/contrib/remote-helpers/test-hg-hg-git.sh
+++ b/contrib/remote-helpers/test-hg-hg-git.sh
@@ -455,8 +455,6 @@ test_expect_success 'hg author' '
git_log gitrepo-$x > git-log-$x
done &&
 
-   test_cmp git-log-hg git-log-git &&
-
test_cmp hg-log-hg hg-log-git &&
test_cmp git-log-hg git-log-git
 '
-- 
1.8.3.rc1.579.g184e698

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 00/10] remote-hg: fixes and cleanups

2013-05-13 Thread Felipe Contreras
Hi,

Since the last series is not merged to master yet, I decided to add more 
cleanups.

Felipe Contreras (10):
  remote-hg: trivial cleanups
  remote-hg: get rid of unused exception checks
  remote-hg: enable track-branches in hg-git mode
  remote-hg: add new get_config_bool() helper
  remote-hg: fix new branch creation
  remote-hg: disable forced push by default
  remote-hg: don't push fake 'master' bookmark
  remote-hg: update bookmarks when pulling
  remote-hg: test: be a little more quiet
  remote-hg: trivial reorganization

 contrib/remote-helpers/git-remote-hg | 47 
 contrib/remote-helpers/test-hg-hg-git.sh |  3 +-
 contrib/remote-helpers/test-hg.sh|  4 +--
 3 files changed, 26 insertions(+), 28 deletions(-)

-- 
1.8.3.rc1.579.g184e698

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 4/4] t4300 (rebase): don't unnecessarily set GIT_TRACE

2013-05-13 Thread Jonathan Nieder
Ramkumar Ramachandra wrote:

>  I've
> never really found the outputs from earlier tests enlightening.

If the test suite would automatically use "set -x" when appropriate
so output for each command was preceded by the command being run,
that would presumably make the verbose output more useful.

If you are not in a situation where it's difficult to debug
interactively, I doubt you'll find anything better than reproducing
the bug by hand and exploring.  I suppose an option "Run up to this
test, stop, and tell me the $TRASH_DIRECTORY and next test so I can
try it manually" could be a way to simplify that workflow.

Regards,
Jonathan
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/4] Coverage support revisited

2013-05-13 Thread Jens Lehmann
Am 13.05.2013 23:27, schrieb Thomas Rast:
> Jens asked me at git-merge if coverage support was still available.
> Turns out it is, but there were some weirdnesses.  So this should fix
> them.  It is relly slow as you still have to run the tests one by
> one; despite claims in the wild that it is multiprocess- safe but
> thread-unsafe, I am in fact observing the opposite behavior pretty
> clearly.  (As before, it switches to sequential tests automatically,
> so you have to edit the Makefile if you want to try with parallel
> tests.)

Thx! That might explain why the coverage run I tried today didn't
work (I saw bogus test failures).

> Below is the coverage-untested-functions output; it seems submodule.c
> is covered, so there is nothing for Jens to do ;-)

Hehe, I kinda expected that part ;-)

> unpack-trees.c: verify_clean_submodule

This is the one I was after. While discussing my recursive update
code with Peff on Saturday we wondered if that function would ever
be called. I'll check if the tests are missing some relevant cases,
if that function can be removed or some refactoring is necessary.

Hmm, while function coverage is already extremely useful me thinks
lcov support would be really nice. We'd have line and branch coverage,
which help me a lot in finding dead code and missing tests at $DAYJOB
... will look into that when I have the recursive update ready.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/4] Coverage support revisited

2013-05-13 Thread Junio C Hamano
Thomas Rast  writes:

> Below is the coverage-untested-functions output; it seems submodule.c
> is covered, so there is nothing for Jens to do ;-)

Nice.

Here are some hints to add coverages to the selected functions.

> alloc.c: report
> alloc.c: alloc_report

I believe these are only for debugging.

> archive-tar.c: write_extended_header

Need to create an archive that contains loong pathname (iirc, over
100 bytes) in the test.

> attr.c: git_etc_gitattributes
> builtin#add.c: ignore_removal_cb

"--ignore-removal" option parsing.

> builtin#apply.c: checkout_target

Try "git apply --index" to an empty working tree with a valid index.

> builtin#apply.c: add_name_limit
> builtin#apply.c: option_parse_exclude
> builtin#apply.c: option_parse_include

"git apply --exclude/include".

> builtin#apply.c: option_parse_z

"git apply --stat -z".

> builtin#blame.c: read_ancestry

"git blame -S".

> builtin#blame.c: sanity_check_refcnt

Only used for debugging.

> builtin#blame.c: prepare_initial

"git blame --reverse".

> builtin#blame.c: blame_move_callback

"git blame -M" (option parsing).

> varint.c: decode_varint
> varint.c: encode_varint

"git update-index --index-version 4" and then read from the
resulting index.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] gitk: add support for -G'regex' pickaxe variant

2013-05-13 Thread Junio C Hamano
Martin Langhoff  writes:

> On Mon, May 13, 2013 at 3:33 PM, Jonathan Nieder  wrote:
>> Well, no, it should find the final change that brought it into the
>> current form.  Just like "git blame".
>>
>> Has it been finding zero results in some cases where the current code
>> matches the pattern?  That sounds like a bug.
>
> Ummm, maybe. You are right, with current git it does work as I would
> expect (usefully ;-) ).
>
> I know I struggled quite a bit with log -S not finding stuff I thought
> it should and that log -G did find, back a year ago.
>
> Damn, I don't have a precise record of what git it was on, nor a good
> repro example. Too long ago,

Since its beginning, the -S implementation hasn't change that much,
and I do not remember fixing such a bug. If you saw issues in old
Git, the same issues would still exist in today's Git.

It could be that a change to your history (not change to Git) was
introduced in an evil merge, and you were running "git log -p -S"
without "-m", or something.

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] gitk: add support for -G'regex' pickaxe variant

2013-05-13 Thread Jonathan Nieder
Ramkumar Ramachandra wrote:

> I still don't know exactly what -G and -S do.

If you've been following recent gitk development (or this thread)
closely, you'll know that "git log -S" finds commits adding/removing a
string, while "git log -G" finds commits changing lines matching a
regex.

Examples for inclusion in the documentation welcome, certainly
(especially if they come in patch form).

A quick web search finds some references:

 http://article.gmane.org/gmane.comp.version-control.git/187364
 http://thread.gmane.org/gmane.comp.version-control.git/154822/focus=154823
 http://gitster.livejournal.com/35628.html
 http://thread.gmane.org/gmane.comp.lang.scala.internals/14219/focus=14220
 http://thread.gmane.org/gmane.linux.kernel/1370389/focus=1370478
 http://thread.gmane.org/gmane.comp.sysutils.autoconf.general/10682/focus=5691
 http://thread.gmane.org/gmane.network.nagios.plugins.devel/6164/focus=6175
 http://thread.gmane.org/gmane.comp.python.sympy/5830/focus=5836

Thanks and hope that helps,
Jonathan
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/2] git-svn: clarify explanation of --destination argument

2013-05-13 Thread Jonathan Nieder
Date: Mon, 19 Dec 2011 19:24:30 -0600

The existing documentation for "-d" does not make it obvious whether
its argument is supposed to be a full svn path, a partial svn path,
the glob from the config file, or what.  Clarify the text and add an
example to get the reader started.

Reported-by: Nathan Gray 
Signed-off-by: Jonathan Nieder 
---
Thanks for reading.

 Documentation/git-svn.txt | 19 ++-
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt
index 6c0988e..68c706d 100644
--- a/Documentation/git-svn.txt
+++ b/Documentation/git-svn.txt
@@ -271,13 +271,15 @@ first have already been pushed into SVN.
Create a tag by using the tags_subdir instead of the branches_subdir
specified during git svn init.
 
--d;;
---destination;;
+-d;;
+--destination=;;
+
If more than one --branches (or --tags) option was given to the 'init'
or 'clone' command, you must provide the location of the branch (or
-   tag) you wish to create in the SVN repository.  The value of this
-   option must match one of the paths specified by a --branches (or
-   --tags) option.  You can see these paths with the commands
+   tag) you wish to create in the SVN repository.   specifies which
+   path to use to create the branch or tag and should match the pattern
+   on the left-hand side of one of the configured branches or tags
+   refspecs.  You can see these refspecs with the commands
 +
git config --get-all svn-remote..branches
git config --get-all svn-remote..tags
@@ -1044,6 +1046,13 @@ Multiple fetch, branches, and tags keys are supported:
tags = tags/server/*:refs/remotes/project-a/tags/*
 
 
+Creating a branch in such a configuration requires disambiguating which
+location to use using the -d or --destination flag:
+
+
+$ git svn branch -d branches/server release-2-3-0
+
+
 Note that git-svn keeps track of the highest revision in which a branch
 or tag has appeared. If the subset of branches or tags is changed after
 fetching, then .git/svn/.metadata must be manually edited to remove (or
-- 
1.8.3.rc1

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/2] git-svn: multiple fetch/branches/tags keys are supported

2013-05-13 Thread Jonathan Nieder
From: Nathan Gray 
Date: Mon, 19 Dec 2011 19:23:50 -0600

"git svn" can be configured to use multiple fetch, branches, and tags
refspecs by passing multiple --branches or --tags options at init time
or editing the configuration file later, which can be handy when
working with messy Subversion repositories.  Add a note to the
configuration section documenting how this works.

Signed-off-by: Jonathan Nieder 
---
As before.

 Documentation/git-svn.txt | 12 
 1 file changed, 12 insertions(+)

diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt
index 58b6d54..6c0988e 100644
--- a/Documentation/git-svn.txt
+++ b/Documentation/git-svn.txt
@@ -1032,6 +1032,18 @@ comma-separated list of names within braces. For example:
tags = tags/{1.0,2.0}/src:refs/remotes/tags/*
 
 
+Multiple fetch, branches, and tags keys are supported:
+
+
+[svn-remote "messy-repo"]
+   url = http://server.org/svn
+   fetch = trunk/project-a:refs/remotes/project-a/trunk
+   fetch = 
branches/demos/june-project-a-demo:refs/remotes/project-a/demos/june-demo
+   branches = branches/server/*:refs/remotes/project-a/branches/*
+   branches = branches/demos/2011/*:refs/remotes/project-a/2011-demos/*
+   tags = tags/server/*:refs/remotes/project-a/tags/*
+
+
 Note that git-svn keeps track of the highest revision in which a branch
 or tag has appeared. If the subset of branches or tags is changed after
 fetching, then .git/svn/.metadata must be manually edited to remove (or
-- 
1.8.3.rc1

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH resend 0/2] git-svn: improve documentation of multiple fetch lines

2013-05-13 Thread Jonathan Nieder
Hi Eric,

I last sent these patches as an RFC a year and a half or so ago[1].
Nathan seemed to like them and they still seem valid, so thought
I'd resubmit. :)

Thoughts of all kinds welcome, as always.

Jonathan Nieder (1):
  git-svn: clarify explanation of --destination argument

Nathan Gray (1):
  git-svn: multiple fetch/branches/tags keys are supported

 Documentation/git-svn.txt | 31 ++-
 1 file changed, 26 insertions(+), 5 deletions(-)

[1] http://thread.gmane.org/gmane.comp.version-control.git/187312/focus=187489
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/4] coverage: do not delete .gcno files before building

2013-05-13 Thread Thomas Rast
The coverage-compile target depends on coverage-clean, which is
supposed to remove the earlier build products that would get in the
way of the next coverage test run.

However, removing *.gcno is actively wrong.  These are the files that
contain the compile-time coverage related data.  They are only rebuilt
if the source is compiled.  So if one ran 'make coverage' two times in
a row, the second run would remove *.gcno, but then fail to recreate
them because neither source files nor build flags have changed.  (This
remained hidden for so long most likely because any other intervening
use of 'make' will change the build flags, causing a full rebuild.)

So we make an exception for *.gcno.  The *.gcda are the coverage
results, written when the gcov-instrumented program is run.  We still
remove those, so as to get a one-test-run view of the data; you could
probably argue the other way too.

Signed-off-by: Thomas Rast 
---
 Makefile | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index f98296b..99e4d09 100644
--- a/Makefile
+++ b/Makefile
@@ -2443,7 +2443,7 @@ profile-clean:
$(RM) $(addsuffix *.gcda,$(addprefix $(PROFILE_DIR)/, $(object_dirs)))
$(RM) $(addsuffix *.gcno,$(addprefix $(PROFILE_DIR)/, $(object_dirs)))
 
-clean: profile-clean
+clean: profile-clean coverage-clean
$(RM) *.o block-sha1/*.o ppc/*.o compat/*.o compat/*/*.o xdiff/*.o 
vcs-svn/*.o \
builtin/*.o $(LIB_FILE) $(XDIFF_LIB) $(VCSSVN_LIB)
$(RM) $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) git$X
@@ -2525,20 +2525,23 @@ check-builtins::
 ### Test suite coverage testing
 #
 .PHONY: coverage coverage-clean coverage-compile coverage-test coverage-report
+.PHONY: coverage-clean-results
 
 coverage:
$(MAKE) coverage-test
$(MAKE) coverage-report
 
 object_dirs := $(sort $(dir $(OBJECTS)))
-coverage-clean:
+coverage-clean-results:
$(RM) $(addsuffix *.gcov,$(object_dirs))
$(RM) $(addsuffix *.gcda,$(object_dirs))
-   $(RM) $(addsuffix *.gcno,$(object_dirs))
$(RM) coverage-untested-functions
$(RM) -r cover_db/
$(RM) -r cover_db_html/
 
+coverage-clean: coverage-clean-results
+   $(RM) $(addsuffix *.gcno,$(object_dirs))
+
 COVERAGE_CFLAGS = $(CFLAGS) -O0 -ftest-coverage -fprofile-arcs
 COVERAGE_LDFLAGS = $(CFLAGS)  -O0 -lgcov
 GCOVFLAGS = --preserve-paths --branch-probabilities --all-blocks
-- 
1.8.3.rc1.400.g07d6e4a

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/4] coverage: set DEFAULT_TEST_TARGET to avoid using prove

2013-05-13 Thread Thomas Rast
If the user sets DEFAULT_TEST_TARGET=prove in his config.mak, that
carries over into the coverage tests.  Which is really bad if he also
sets GIT_PROVE_OPTS=-j<..> as that completely breaks the coverage
runs.

Instead of attempting to mess with the GIT_PROVE_OPTS, just force the
test target to 'test' so that we run under make, like we intended all
along.

Signed-off-by: Thomas Rast 
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 99e4d09..153d24d 100644
--- a/Makefile
+++ b/Makefile
@@ -2551,7 +2551,7 @@ coverage-compile:
 
 coverage-test: coverage-clean-results coverage-compile
$(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" \
-   -j1 test
+   DEFAULT_TEST_TARGET=test -j1 test
 
 coverage-report:
$(QUIET_GCOV)for dir in $(object_dirs); do \
-- 
1.8.3.rc1.400.g07d6e4a

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/4] coverage: build coverage-untested-functions by default

2013-05-13 Thread Thomas Rast
Change the 'coverage' target to build coverage-untested-functions by
default, so as to make it more discoverable.

Signed-off-by: Thomas Rast 
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 153d24d..6f9d1c7 100644
--- a/Makefile
+++ b/Makefile
@@ -2529,7 +2529,7 @@ check-builtins::
 
 coverage:
$(MAKE) coverage-test
-   $(MAKE) coverage-report
+   $(MAKE) coverage-untested-functions
 
 object_dirs := $(sort $(dir $(OBJECTS)))
 coverage-clean-results:
-- 
1.8.3.rc1.400.g07d6e4a

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/4] Coverage support revisited

2013-05-13 Thread Thomas Rast
Jens asked me at git-merge if coverage support was still available.
Turns out it is, but there were some weirdnesses.  So this should fix
them.  It is relly slow as you still have to run the tests one by
one; despite claims in the wild that it is multiprocess- safe but
thread-unsafe, I am in fact observing the opposite behavior pretty
clearly.  (As before, it switches to sequential tests automatically,
so you have to edit the Makefile if you want to try with parallel
tests.)

Below is the coverage-untested-functions output; it seems submodule.c
is covered, so there is nothing for Jens to do ;-)


Thomas Rast (4):
  coverage: split build target into compile and test
  coverage: do not delete .gcno files before building
  coverage: set DEFAULT_TEST_TARGET to avoid using prove
  coverage: build coverage-untested-functions by default

 Makefile | 21 +
 1 file changed, 13 insertions(+), 8 deletions(-)


--- coverage-untested-functions ---
alloc.c: report
alloc.c: alloc_report
archive-tar.c: write_extended_header
attr.c: git_etc_gitattributes
builtin#add.c: ignore_removal_cb
builtin#apply.c: checkout_target
builtin#apply.c: add_name_limit
builtin#apply.c: option_parse_exclude
builtin#apply.c: option_parse_include
builtin#apply.c: option_parse_z
builtin#blame.c: read_ancestry
builtin#blame.c: sanity_check_refcnt
builtin#blame.c: prepare_initial
builtin#blame.c: blame_move_callback
builtin#branch.c: calc_maxwidth
builtin#checkout-index.c: option_parse_z
builtin#clone.c: remove_junk_on_signal
builtin#commit.c: find_author_by_nickname
builtin#config.c: cmd_repo_config
builtin#fetch.c: unlock_pack_on_signal
builtin#fmt-merge-msg.c: add_branch_desc
builtin#for-each-ref.c: copy_advance
builtin#grep.c: help_callback
builtin#help.c: parse_help_format
builtin#help.c: get_man_viewer_info
builtin#help.c: check_emacsclient_version
builtin#help.c: exec_woman_emacs
builtin#help.c: exec_man_konqueror
builtin#help.c: exec_man_man
builtin#help.c: exec_man_cmd
builtin#help.c: add_man_viewer
builtin#help.c: supported_man_viewer
builtin#help.c: do_add_man_viewer_info
builtin#help.c: add_man_viewer_path
builtin#help.c: add_man_viewer_cmd
builtin#help.c: add_man_viewer_info
builtin#help.c: git_help_config
builtin#help.c: is_git_command
builtin#help.c: prepend
builtin#help.c: cmd_to_page
builtin#help.c: setup_man_path
builtin#help.c: exec_viewer
builtin#help.c: show_man_page
builtin#help.c: show_info_page
builtin#help.c: get_html_page_path
builtin#help.c: open_html
builtin#help.c: show_html_page
builtin#help.c: list_common_guides_help
builtin#help.c: cmd_help
builtin#index-pack.c: delta_pos_compare
builtin#log.c: estimate_commit_count
builtin#log.c: show_early_header
builtin#log.c: log_show_early
builtin#log.c: early_output
builtin#log.c: setup_early_output
builtin#log.c: finish_early_output
builtin#log.c: no_numbered_callback
builtin#log.c: header_callback
builtin#mailsplit.c: populate_maildir_list
builtin#mailsplit.c: maildir_filename_cmp
builtin#mailsplit.c: split_maildir
builtin#merge-base.c: handle_is_ancestor
builtin#merge.c: reset_hard
builtin#merge.c: setup_with_upstream
builtin#pack-objects.c: pbase_tree_cache_ix_incr
builtin#pack-objects.c: try_to_free_from_threads
builtin#pack-objects.c: mark_in_pack_object
builtin#pack-objects.c: ofscmp
builtin#pack-objects.c: add_objects_in_unpacked_packs
builtin#pack-objects.c: option_parse_ulong
builtin#pack-redundant.c: llist_item_put
builtin#pack-redundant.c: llist_item_get
builtin#pack-redundant.c: llist_free
builtin#pack-redundant.c: llist_init
builtin#pack-redundant.c: llist_copy
builtin#pack-redundant.c: llist_insert
builtin#pack-redundant.c: llist_insert_back
builtin#pack-redundant.c: llist_insert_sorted_unique
builtin#pack-redundant.c: llist_sorted_remove
builtin#pack-redundant.c: llist_sorted_difference_inplace
builtin#pack-redundant.c: pack_list_insert
builtin#pack-redundant.c: pack_list_size
builtin#pack-redundant.c: pack_list_difference
builtin#pack-redundant.c: cmp_two_packs
builtin#pack-redundant.c: pll_free
builtin#pack-redundant.c: get_permutations
builtin#pack-redundant.c: is_superset
builtin#pack-redundant.c: sizeof_union
builtin#pack-redundant.c: get_pack_redundancy
builtin#pack-redundant.c: pack_set_bytecount
builtin#pack-redundant.c: minimize
builtin#pack-redundant.c: load_all_objects
builtin#pack-redundant.c: cmp_local_packs
builtin#pack-redundant.c: scan_alt_odb_packs
builtin#pack-redundant.c: add_pack
builtin#pack-redundant.c: add_pack_file
builtin#pack-redundant.c: load_all
builtin#pack-redundant.c: cmd_pack_redundant
builtin#push.c: advise_use_upstream
builtin#push.c: advise_checkout_pull_push
builtin#push.c: advise_ref_needs_force
builtin#read-tree.c: debug_stage
builtin#read-tree.c: debug_merge
builtin#reflog.c: find_cfg_ent
builtin#remote-ext.c: send_git_request
builtin#remote-fd.c: command_loop
builtin#remote-fd.c: cmd_remote_fd
builtin#rev-list.c: show_edge
builtin#rev-list.c: print_var_str
builtin#rev-list.c: print_var_int
builtin#r

[PATCH 1/4] coverage: split build target into compile and test

2013-05-13 Thread Thomas Rast
Confusingly, the coverage-build target in fact builds with gcov
support _and runs tests_.

Split it into two targets that actually are named after what they do.

Signed-off-by: Thomas Rast 
---
 Makefile | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 0f931a2..f98296b 100644
--- a/Makefile
+++ b/Makefile
@@ -2524,10 +2524,10 @@ check-builtins::
 
 ### Test suite coverage testing
 #
-.PHONY: coverage coverage-clean coverage-build coverage-report
+.PHONY: coverage coverage-clean coverage-compile coverage-test coverage-report
 
 coverage:
-   $(MAKE) coverage-build
+   $(MAKE) coverage-test
$(MAKE) coverage-report
 
 object_dirs := $(sort $(dir $(OBJECTS)))
@@ -2543,8 +2543,10 @@ COVERAGE_CFLAGS = $(CFLAGS) -O0 -ftest-coverage 
-fprofile-arcs
 COVERAGE_LDFLAGS = $(CFLAGS)  -O0 -lgcov
 GCOVFLAGS = --preserve-paths --branch-probabilities --all-blocks
 
-coverage-build: coverage-clean
+coverage-compile:
$(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" all
+
+coverage-test: coverage-clean-results coverage-compile
$(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" \
-j1 test
 
-- 
1.8.3.rc1.400.g07d6e4a

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] gitk: add support for -G'regex' pickaxe variant

2013-05-13 Thread Ramkumar Ramachandra
Jonathan Nieder wrote:
> Martin Langhoff wrote:
>> On Mon, May 13, 2013 at 2:55 PM, Jonathan Nieder  wrote:
>
>>> My experience is the opposite.  I wonder "What did the author of this
>>> nonsense comment mean?" or "What is the purpose of this strange
>>> condition in this if () statement?".  Then "git log -S" finds the
>>> culprit
>>
>> Only if that if () statement looks that way from a single commit.
>> That's my point. If the line code bit you are looking at is the result
>> of several changes, your log -S will grind a while and find you
>> nothing.
>
> Well, no, it should find the final change that brought it into the
> current form.  Just like "git blame".

I still don't know exactly what -G and -S do.  The documentation can
be improved, no?  A nice example would definitely help.

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] gitk: add support for -G'regex' pickaxe variant

2013-05-13 Thread Martin Langhoff
On Mon, May 13, 2013 at 3:33 PM, Jonathan Nieder  wrote:
> Well, no, it should find the final change that brought it into the
> current form.  Just like "git blame".
>
> Has it been finding zero results in some cases where the current code
> matches the pattern?  That sounds like a bug.

Ummm, maybe. You are right, with current git it does work as I would
expect (usefully ;-) ).

I know I struggled quite a bit with log -S not finding stuff I thought
it should and that log -G did find, back a year ago.

Damn, I don't have a precise record of what git it was on, nor a good
repro example. Too long ago,



m
--
 martin.langh...@gmail.com
 -  ask interesting questions
 - don't get distracted with shiny stuff  - working code first
 ~ http://docs.moodle.org/en/User:Martin_Langhoff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] teach the user to be nice to git and let him say please sometimes

2013-05-13 Thread Junio C Hamano
Thomas Rast  writes:

> Heiko Voigt  writes:
>
>> On Sun, May 12, 2013 at 02:19:34PM -0700, Junio C Hamano wrote:
>>> Heiko Voigt  writes:
>>> 
>>> > Signed-off-by: Heiko Voigt 
>>> > Signed-off-by: Jonathan Nieder 
>>> > Signed-off-by: Jens Lehmann 
>>> > Signed-off-by: Thomas Rast 
>>> > Signed-off-by: Johan Herland 
>>> 
>>> So these were the ones present on the dev-day?
>>
>> No this was just a random sample of the ones sitting at the same
>> beer garden table that this feature was implemented on.
>
> Also see
>
>   http://thomasrast.ch/pix/foss/20130509_gitmerge/DSC_7078.jpg.php
>
> for an illustration of the history of this patch.
>
> 

Thanks for sharing. I see some familiar faces.  Envy, envy...
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] teach the user to be nice to git and let him say please sometimes

2013-05-13 Thread Thomas Rast
Heiko Voigt  writes:

> On Sun, May 12, 2013 at 02:19:34PM -0700, Junio C Hamano wrote:
>> Heiko Voigt  writes:
>> 
>> > Signed-off-by: Heiko Voigt 
>> > Signed-off-by: Jonathan Nieder 
>> > Signed-off-by: Jens Lehmann 
>> > Signed-off-by: Thomas Rast 
>> > Signed-off-by: Johan Herland 
>> 
>> So these were the ones present on the dev-day?
>
> No this was just a random sample of the ones sitting at the same
> beer garden table that this feature was implemented on.

Also see

  http://thomasrast.ch/pix/foss/20130509_gitmerge/DSC_7078.jpg.php

for an illustration of the history of this patch.



-- 
Thomas Rast
trast@{inf,student}.ethz.ch
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCHv2 03/10] refs.c: Refactor code for mapping between shorthand names and full refnames

2013-05-13 Thread Junio C Hamano
Junio C Hamano  writes:

> Johan Herland  writes:
>
>> Obviously, I named it '%1' since it expands into the _first_ component
>> of the (slash-separated) shorthand.
>
> OK, I can buy something like
>
>   %*
> refs/%*
> refs/heads/%*
> ...
> refs/remotes/%*/HEAD
> refs/remotes/%1/%2
> refs/peers/%1/heads/%2
>
> that is, for a pattern that has %*, we feed the end-user string as a
> whole, and for a pattern that has %1 thru %N, we find an appropriate
> way to chop the end-user string into N pieces (e.g. nick/name would
> be split into %1 = nick, %2 = name, while foo/bar/baz might have two
> possibilities, <%1, %2> =  or ).  The
> earlier ones on the above list can even be written with their %*
> substituted with %1 if we go that route.

Just to make sure.

Please do not let "two possibilities" stop you.  As I said in the
nearby thread, I do not necessarily insist that we must try all N
possibilities.  "We find an appropriate way" could be just "we
always chop at the first slash, and %1 is what comes before it, %2
is what comes after it".

That will close the possibility for us to use %1 thru %N (N is
limited to 2), but it still is "We have %1 and we have %2, both fall
into the same 'path components, numbered from left to right'
category", and justifies the use of %1 ("one", not "el").

So still no objection to %1 from me.

> And that makes perfect sense, and is exactly the kind of "you plan
> to have %2 and %3 that falls into the same category as %1" I was
> asking you about in the message.
>
> So, no more objection to %1 from me, if that is the direction you
> are taking us.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] git-svn: introduce --parents parameter for commands branch and tag

2013-05-13 Thread Tobias Schulte
This parameter is equivalent to the parameter --parents on svn cp commands
and is useful for non-standard repository layouts.

Signed-off-by: Tobias Schulte 
---
 Documentation/git-svn.txt|5 
 git-svn.perl |   22 +-
 t/t9167-git-svn-cmd-branch-subproject.sh |   46 ++
 3 files changed, 72 insertions(+), 1 deletion(-)
 create mode 100755 t/t9167-git-svn-cmd-branch-subproject.sh

diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt
index 58b6d54..4f2141d 100644
--- a/Documentation/git-svn.txt
+++ b/Documentation/git-svn.txt
@@ -298,6 +298,11 @@ where  is the name of the SVN repository as 
specified by the -R option to
git config --get-all svn-remote..commiturl
 +
 
+--parents;;
+   Create parent folders. This parameter is equivalent to the parameter 
+   --parents on svn cp commands and is useful for non-standard repository 
+   layouts.
+
 'tag'::
Create a tag in the SVN repository. This is a shorthand for
'branch -t'.
diff --git a/git-svn.perl b/git-svn.perl
index ccabe06..204313d 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -113,7 +113,7 @@ my ($_stdin, $_help, $_edit,
$_template, $_shared,
$_version, $_fetch_all, $_no_rebase, $_fetch_parent,
$_before, $_after,
-   $_merge, $_strategy, $_preserve_merges, $_dry_run, $_local,
+   $_merge, $_strategy, $_preserve_merges, $_dry_run, $_parents, $_local,
$_prefix, $_no_checkout, $_url, $_verbose,
$_commit_url, $_tag, $_merge_info, $_interactive);
 
@@ -203,6 +203,7 @@ my %cmd = (
{ 'message|m=s' => \$_message,
  'destination|d=s' => \$_branch_dest,
  'dry-run|n' => \$_dry_run,
+ 'parents' => \$_parents,
  'tag|t' => \$_tag,
  'username=s' => \$Git::SVN::Prompt::_username,
  'commit-url=s' => \$_commit_url } ],
@@ -211,6 +212,7 @@ my %cmd = (
 { 'message|m=s' => \$_message,
   'destination|d=s' => \$_branch_dest,
   'dry-run|n' => \$_dry_run,
+  'parents' => \$_parents,
   'username=s' => \$Git::SVN::Prompt::_username,
   'commit-url=s' => \$_commit_url } ],
'set-tree' => [ \&cmd_set_tree,
@@ -1172,6 +1174,10 @@ sub cmd_branch {
$ctx->ls($dst, 'HEAD', 0);
} and die "branch ${branch_name} already exists\n";
 
+   if ($_parents) {
+   mk_parent_dirs($ctx, $dst);
+   }
+
print "Copying ${src} at r${rev} to ${dst}...\n";
$ctx->copy($src, $rev, $dst)
unless $_dry_run;
@@ -1179,6 +1185,20 @@ sub cmd_branch {
$gs->fetch_all;
 }
 
+sub mk_parent_dirs {
+   my $ctx = shift;
+   my $parent = shift;
+   $parent =~ s/\/[^\/]*$//;
+
+   if (!eval{$ctx->ls($parent, 'HEAD', 0)}) {
+   mk_parent_dirs($ctx, $parent);
+   print "Creating parent folder ${parent} ...\n";
+   $ctx->mkdir($parent)
+   unless $_dry_run;
+   }
+
+}
+
 sub cmd_find_rev {
my $revision_or_hash = shift or die "SVN or git revision required ",
"as a command-line argument\n";
diff --git a/t/t9167-git-svn-cmd-branch-subproject.sh 
b/t/t9167-git-svn-cmd-branch-subproject.sh
new file mode 100755
index 000..9cb891b
--- /dev/null
+++ b/t/t9167-git-svn-cmd-branch-subproject.sh
@@ -0,0 +1,46 @@
+#!/bin/sh
+#
+# Copyright (c) 2013 Tobias Schulte
+#
+
+test_description='git svn branch for subproject clones'
+. ./lib-git-svn.sh
+
+test_expect_success 'initialize svnrepo' '
+mkdir import &&
+(
+(cd import &&
+mkdir -p trunk/project branches tags &&
+(cd trunk/project &&
+echo foo > foo
+) &&
+svn_cmd import -m "import for git-svn" . "$svnrepo" >/dev/null
+) &&
+rm -rf import &&
+svn_cmd co "$svnrepo"/trunk/project trunk/project &&
+(cd trunk/project &&
+echo bar >> foo &&
+svn_cmd ci -m "updated trunk"
+) &&
+rm -rf trunk
+)
+'
+
+test_expect_success 'import into git' '
+git svn init --trunk=trunk/project --branches=branches/*/project 
--tags=tags/*/project "$svnrepo" &&
+git svn fetch &&
+git checkout remotes/trunk
+'
+
+test_expect_success 'git svn branch tests' '
+test_must_fail git svn branch a &&
+git svn branch --parents a &&
+test_must_fail git svn branch -t tag1 &&
+git svn branch --parents -t tag1 &&
+test_must_fail git svn branch --tag tag2 &&
+git svn branch --parents --tag tag2 &&
+test_must_fail git svn tag tag3 &&
+git svn tag --parents tag3
+'
+
+test_done
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo 

[RFC/PATCH] branch: show me the hot branches

2013-05-13 Thread Ramkumar Ramachandra
Uses commit->date to sort displayed refs.

Signed-off-by: Ramkumar Ramachandra 
---
 Just had this idea and wrote it down in five minutes.  The
 implementation is only meant to be indicative.

 Isn't this awesome?

 builtin/branch.c | 32 +---
 1 file changed, 29 insertions(+), 3 deletions(-)

diff --git a/builtin/branch.c b/builtin/branch.c
index 0836890..8b08563 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -59,6 +59,11 @@ static enum merge_filter {
 } merge_filter;
 static unsigned char merge_filter_ref[20];
 
+static enum sort_strategy {
+   LEXICAL = 0,
+   DATE,
+} sort_strategy;
+
 static struct string_list output = STRING_LIST_INIT_DUP;
 static unsigned int colopts;
 
@@ -406,7 +411,7 @@ static void free_ref_list(struct ref_list *ref_list)
free(ref_list->list);
 }
 
-static int ref_cmp(const void *r1, const void *r2)
+static int ref_cmp_lexical(const void *r1, const void *r2)
 {
struct ref_item *c1 = (struct ref_item *)(r1);
struct ref_item *c2 = (struct ref_item *)(r2);
@@ -416,6 +421,16 @@ static int ref_cmp(const void *r1, const void *r2)
return strcmp(c1->name, c2->name);
 }
 
+static int ref_cmp_date(const void *r1, const void *r2)
+{
+   struct ref_item *c1 = (struct ref_item *)(r1);
+   struct ref_item *c2 = (struct ref_item *)(r2);
+
+   if (c1->kind != c2->kind)
+   return c1->kind - c2->kind;
+   return c1->commit->date < c2->commit->date;
+}
+
 static void fill_tracking_info(struct strbuf *stat, const char *branch_name,
int show_upstream_ref)
 {
@@ -621,7 +636,6 @@ static int print_ref_list(int kinds, int detached, int 
verbose, int abbrev, stru
 
memset(&ref_list, 0, sizeof(ref_list));
ref_list.kinds = kinds;
-   ref_list.verbose = verbose;
ref_list.abbrev = abbrev;
ref_list.with_commit = with_commit;
if (merge_filter != NO_FILTER)
@@ -629,7 +643,14 @@ static int print_ref_list(int kinds, int detached, int 
verbose, int abbrev, stru
cb.ref_list = &ref_list;
cb.pattern = pattern;
cb.ret = 0;
+
+   if (sort_strategy == DATE && verbose < 1)
+   ref_list.verbose = 1;
+   else
+   ref_list.verbose = verbose;
for_each_rawref(append_ref, &cb);
+   ref_list.verbose = verbose;
+
if (merge_filter != NO_FILTER) {
struct commit *filter;
filter = lookup_commit_reference_gently(merge_filter_ref, 0);
@@ -646,7 +667,10 @@ static int print_ref_list(int kinds, int detached, int 
verbose, int abbrev, stru
ref_list.maxwidth = calc_maxwidth(&ref_list);
}
 
-   qsort(ref_list.list, ref_list.index, sizeof(struct ref_item), ref_cmp);
+   if (sort_strategy == DATE)
+   qsort(ref_list.list, ref_list.index, sizeof(struct ref_item), 
ref_cmp_date);
+   else
+   qsort(ref_list.list, ref_list.index, sizeof(struct ref_item), 
ref_cmp_lexical);
 
detached = (detached && (kinds & REF_LOCAL_BRANCH));
if (detached && match_patterns(pattern, "HEAD"))
@@ -843,6 +867,8 @@ int cmd_branch(int argc, const char **argv, const char 
*prefix)
OPT_END(),
};
 
+   sort_strategy = DATE;
+
if (argc == 2 && !strcmp(argv[1], "-h"))
usage_with_options(builtin_branch_usage, options);
 
-- 
1.8.3.rc1.49.g8d97506.dirty

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] gitk: add support for -G'regex' pickaxe variant

2013-05-13 Thread Jonathan Nieder
Martin Langhoff wrote:
> On Mon, May 13, 2013 at 2:55 PM, Jonathan Nieder  wrote:

>> My experience is the opposite.  I wonder "What did the author of this
>> nonsense comment mean?" or "What is the purpose of this strange
>> condition in this if () statement?".  Then "git log -S" finds the
>> culprit
>
> Only if that if () statement looks that way from a single commit.
> That's my point. If the line code bit you are looking at is the result
> of several changes, your log -S will grind a while and find you
> nothing.

Well, no, it should find the final change that brought it into the
current form.  Just like "git blame".

Has it been finding zero results in some cases where the current code
matches the pattern?  That sounds like a bug.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 4/6] stash: introduce 'git stash store'

2013-05-13 Thread Ramkumar Ramachandra
Junio C Hamano wrote:
> The whole point of my response is that it is not a valid approach to
> decide to add (or not to add) a reasonable enhancement mechanism
> built in from the beginning by asking "what future enhancement do
> you foresee today?".  It is unclear if you got that point.

Right, got it.  The fact that we weren't able to foresee the merge UI
problem tells us that we're capable of repeating the mistake no matter
how much we think we've thought about it.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: AW: English/German terminology, git.git's de.po, and pro-git

2013-05-13 Thread Jan Engelhardt

On Monday 2013-05-13 20:57, Ralph Haußmann wrote:
>
>There is a glossary for the pro-git book (see [2]) but it is not up-to-date 
>and it is also mixed. Therefor I would like to avoid using this glossary. 
>I like the idea of a shared wiki (git de.po and pro-git). 
>I suggest a single page as overview and single pages for 
>complicated terms. Maybe we can use our GitHub wiki (see also [3]).
>
>[2] https://github.com/progit/progit/blob/master/de/NOTES
>[3] https://github.com/progit-de/progit/wiki/Glossar

This is how I envision a good glossary

http://inai.de/files/git-glossary.txt

Maybe the "Benevolent Dictator" model might be better suited
instead of a wiki? (Think of the edit wars.)
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] gitk: add support for -G'regex' pickaxe variant

2013-05-13 Thread Martin Langhoff
On Mon, May 13, 2013 at 2:55 PM, Jonathan Nieder  wrote:
> My experience is the opposite.  I wonder "What did the author of this
> nonsense comment mean?" or "What is the purpose of this strange
> condition in this if () statement?".  Then "git log -S" finds the
> culprit

Only if that if () statement looks that way from a single commit.
That's my point. If the line code bit you are looking at is the result
of several changes, your log -S will grind a while and find you
nothing.

cheers,



m
--
 mar...@laptop.org
 - ask interesting questions
 - don't get distracted with shiny stuff  - working code first
 - http://wiki.laptop.org/go/User:Martinlanghoff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 4/6] stash: introduce 'git stash store'

2013-05-13 Thread Junio C Hamano
Ramkumar Ramachandra  writes:

> Junio C Hamano wrote:
>> That is not a valid question.
>
> I was just asking to see if you could think of something.  I just did:
> named stashes (each one has a different ref/ reflog) for internal use.
>
> Sure, we'll go with the -m -e approach.

The whole point of my response is that it is not a valid approach to
decide to add (or not to add) a reasonable enhancement mechanism
built in from the beginning by asking "what future enhancement do
you foresee today?".  It is unclear if you got that point.

As long as the end result is to have something that does not paint
us into a corner from which it will be painful to escape, I'll be
happy anyway.

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


AW: English/German terminology, git.git's de.po, and pro-git

2013-05-13 Thread Ralph Haußmann
Hi,

My vote is G+E, too. 

lb1a, Florian Breisch and I are working on the german translation of the 
pro-git book (hosted on git-scm.com). We use the repository [1] to share 
our work. If someone wants to help us, JOIN US!

The current translation of pro-git is mixed, Ger and G+E. For example, 
the translation of "annotated tag" is "Annotated Tag", "kommentierter Tag" 
and also "kommentierte Markierung".  I agree with the opinion of Jan 
Engelhardt that german terms should be used if they are commonly 
used in technical context ("tree"=> "Baum" but "tag" should be "Tag" 
in german, too).

There is a glossary for the pro-git book (see [2]) but it is not up-to-date 
and it is also mixed. Therefor I would like to avoid using this glossary. 
I like the idea of a shared wiki (git de.po and pro-git). 
I suggest a single page as overview and single pages for 
complicated terms. Maybe we can use our GitHub wiki (see also [3]).

 So long

Ralph

[1] https://github.com/progit-de/progit

[2] https://github.com/progit/progit/blob/master/de/NOTES

[3] https://github.com/progit-de/progit/wiki/Glossar

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] gitk: add support for -G'regex' pickaxe variant

2013-05-13 Thread Jonathan Nieder
Martin Langhoff wrote:

> And to be honest, log -G is so much more useful that I don't care a
> s***t for log -S.

Fair enough. :)

[...]
> In other words: You find a suspicious-looking line of code and you ask
> "how did this horrid code come to be?", and the more horrendous the
> code is, the more likely it is to be the accretion of a several
> commits. In that case, which to me is the common case, log -S ain't
> your friend at all.

My experience is the opposite.  I wonder "What did the author of this
nonsense comment mean?" or "What is the purpose of this strange
condition in this if () statement?".  Then "git log -S" finds the
culprit without showing extraneous unrelated changes (such as
reindenting).  It is like "git blame", but for arbitrary chunks of
code instead of single lines.  Then, just like with "git blame", at
times the next step is to blame the parent and repeat the process
using the earlier form of the code in question.

It is especially handy for confusing code that spans multiple lines.
(Unfortunately that is not as easy to try in gitk.)

As I mentioned before, log -G and log -S are fairly dissimilar
operations.

Thanks,
Jonathan
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] gitk: add support for -G'regex' pickaxe variant

2013-05-13 Thread Jonathan Nieder
Paul Mackerras wrote:

> How about "changing lines matching:"?

Sorry for the slow response.  Sounds perfect.

Thanks,
Jonathan
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[ANNOUNCE] Git v1.8.3-rc2

2013-05-13 Thread Junio C Hamano
A release candidate Git v1.8.3-rc2 is now available for testing
at the usual places.

The release tarballs are found at:

http://code.google.com/p/git-core/downloads/list

and their SHA-1 checksums are:

b7569aa316d2e6c29249b15e8fc8e9c25fc7d6b1  git-1.8.3.rc2.tar.gz
d34d977dcec40e3d1468654079d9ac1fa0b9a6f0  git-htmldocs-1.8.3.rc2.tar.gz
35d0020d6756a81f8d494a90ba19830d82621e92  git-manpages-1.8.3.rc2.tar.gz

Also the following public repositories all have a copy of the v1.8.3-rc2
tag and the master branch that the tag points at:

  url = https://kernel.googlesource.com/pub/scm/git/git
  url = git://repo.or.cz/alt-git.git
  url = https://code.google.com/p/git-core/
  url = git://git.sourceforge.jp/gitroot/git-core/git.git
  url = git://git-core.git.sourceforge.net/gitroot/git-core/git-core
  url = https://github.com/gitster/git

In addition, https://www.kernel.org/pub/software/scm/git/testing/
will have the tarballs (hopefully).


Git v1.8.3 Release Notes (draft)


Backward compatibility notes (for Git 2.0)
--

When "git push [$there]" does not say what to push, we have used the
traditional "matching" semantics so far (all your branches were sent
to the remote as long as there already are branches of the same name
over there).  In Git 2.0, the default will change to the "simple"
semantics that pushes only the current branch to the branch with the same
name, and only when the current branch is set to integrate with that
remote branch.  Use the user preference configuration variable
"push.default" to change this.  If you are an old-timer who is used
to the "matching" semantics, you can set the variable to "matching"
to keep the traditional behaviour.  If you want to live in the future
early, you can set it to "simple" today without waiting for Git 2.0.

When "git add -u" (and "git add -A") is run inside a subdirectory and
does not specify which paths to add on the command line, it
will operate on the entire tree in Git 2.0 for consistency
with "git commit -a" and other commands.  There will be no
mechanism to make plain "git add -u" behave like "git add -u .".
Current users of "git add -u" (without a pathspec) should start
training their fingers to explicitly say "git add -u ."
before Git 2.0 comes.  A warning is issued when these commands are
run without a pathspec and when you have local changes outside the
current directory, because the behaviour in Git 2.0 will be different
from today's version in such a situation.

In Git 2.0, "git add " will behave as "git add -A ", so
that "git add dir/" will notice paths you removed from the directory
and record the removal.  Versions before Git 2.0, including this
release, will keep ignoring removals, but the users who rely on this
behaviour are encouraged to start using "git add --ignore-removal "
now before 2.0 is released.


Updates since v1.8.2


Foreign interface

 * remote-hg and remote-bzr helpers (in contrib/ since v1.8.2) have
   been updated; especially, the latter has been accelerated to help
   Emacs folks, whose primary SCM seems to be stagnating.


UI, Workflows & Features

 * A handful of updates applied to gitk, including an addition of
   "revert" action, showing dates in tags in a nicer way, making
   colors configurable, and support for -G'pickaxe' search.

 * The prompt string generator (in contrib/completion/) learned to
   show how many changes there are in total and how many have been
   replayed during a "git rebase" session.

 * "git branch --vv" learned to paint the name of the branch it
   integrates with in a different color (color.branch.upstream,
   which defaults to blue).

 * In a sparsely populated working tree, "git checkout " no
   longer unmarks paths that match the given pathspec that were
   originally ignored with "--sparse" (use --ignore-skip-worktree-bits
   option to resurrect these paths out of the index if you really want
   to).

 * "git log --format" specifier learned %C(auto) token that tells Git
   to use color when interpolating %d (decoration), %h (short commit
   object name), etc. for terminal output.

 * "git bisect" leaves the final outcome as a comment in its bisect
   log file.

 * "git clone --reference" can now refer to a gitfile "textual symlink"
   that points at the real location of the repository.

 * "git count-objects" learned "--human-readable" aka "-H" option to
   show various large numbers in Ki/Mi/GiB scaled as necessary.

 * "git cherry-pick $blob" and "git cherry-pick $tree" are nonsense,
   and a more readable error message e.g. "can't cherry-pick a tree"
   is given (we used to say "expected exactly one commit").

 * The "--annotate" option to "git send-email" can be turned on (or
   off) by default with sendemail.annotate configuration variable (you
   can use --no-annotate from the command line to override it).

 * The "--cover-letter" option to "git format-patch" can be turned on
   (or off) by default wit

Re: [PATCH 4/6] stash: introduce 'git stash store'

2013-05-13 Thread Ramkumar Ramachandra
Junio C Hamano wrote:
> That is not a valid question.

I was just asking to see if you could think of something.  I just did:
named stashes (each one has a different ref/ reflog) for internal use.

Sure, we'll go with the -m -e approach.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] t5551: do not use unportable sed '\+'

2013-05-13 Thread Junio C Hamano
Torsten Bögershausen  writes:

> On 2013-05-13 18.30, Junio C Hamano wrote:
>> Torsten Bögershausen  writes:
>> 
>>> On 2013-05-13 00.50, Junio C Hamano wrote:
 Signed-off-by: Junio C Hamano 
 ---
  t/t5551-http-fetch.sh | 8 ++--
  1 file changed, 6 insertions(+), 2 deletions(-)

>>> Thanks, works like a charm, tested on Mac OS.
>>> /torsten
>> 
>> Thanks; I take it that you reverted the "sed fix" part and saw the
>> updated "clone" check fail with the platform "sed"?
> In my first test with the fix the test case passed.
> Then the sed expression was only manipulated to verify that the TC failes.
> And now I took even the original expression and have verfied it is failing.
>
> The short version: Yes

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 4/6] stash: introduce 'git stash store'

2013-05-13 Thread Junio C Hamano
Ramkumar Ramachandra  writes:

>   git-merge --stat --progress "$merge_name" HEAD 04c5b83c46760573
>
> We made a design mistake at the command-level in merge.  This is at a
> subcommand-level.
>
> 1. Will git stash store ever be more than a one-liner?  Can you think
> of how this function could be larger?

That is not a valid question.  When Linus added the original

git merge 'message' HEAD $other_branch

there wasn't any merge strategy switch and all the other frills even
envisioned yet.  With what we know about Git today, even you could
have answered "Will git merge be more involved compared to the
original?" 8 years ago, but without that, not even Linus nor I did
anticipate that the command line interface would become a pain point
when enhancing it.

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] t5551: do not use unportable sed '\+'

2013-05-13 Thread Torsten Bögershausen
On 2013-05-13 18.30, Junio C Hamano wrote:
> Torsten Bögershausen  writes:
> 
>> On 2013-05-13 00.50, Junio C Hamano wrote:
>>> Signed-off-by: Junio C Hamano 
>>> ---
>>>  t/t5551-http-fetch.sh | 8 ++--
>>>  1 file changed, 6 insertions(+), 2 deletions(-)
>>>
>> Thanks, works like a charm, tested on Mac OS.
>> /torsten
> 
> Thanks; I take it that you reverted the "sed fix" part and saw the
> updated "clone" check fail with the platform "sed"?
In my first test with the fix the test case passed.
Then the sed expression was only manipulated to verify that the TC failes.
And now I took even the original expression and have verfied it is failing.

The short version: Yes

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 4/6] stash: introduce 'git stash store'

2013-05-13 Thread Ramkumar Ramachandra
Junio C Hamano wrote:
> *1* And no, don't even try to rewrite "git merge" call inside "git
> pull" to use the modern style with "-m "; you will likely
> break it (I've tried once and decided it was not worth the hassle).

This falls in my basket of "nice theoretical exercise": a lot of work
for no tangible benefit ;)

Footnote: I'm not saying that code is not important; you've seen me
arguing for beautiful implementations several times before, against
all odds.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


  1   2   >