git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH v2 0/6] remote-hg: fixes and cleanups
@ 2013-05-10 20:59 Felipe Contreras
  2013-05-10 20:59 ` [PATCH v2 1/6] remote-hg: disable forced push by default Felipe Contreras
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Felipe Contreras @ 2013-05-10 20:59 UTC (permalink / raw
  To: git; +Cc: Junio C Hamano, Jeff King, Felipe Contreras

Hi,

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(-)

-- 
1.8.3.rc1.579.g184e698

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2 1/6] remote-hg: disable forced push by default
  2013-05-10 20:59 [PATCH v2 0/6] remote-hg: fixes and cleanups Felipe Contreras
@ 2013-05-10 20:59 ` Felipe Contreras
  2013-05-10 20:59 ` [PATCH v2 2/6] remote-hg: don't push fake 'master' bookmark Felipe Contreras
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Felipe Contreras @ 2013-05-10 20:59 UTC (permalink / raw
  To: git; +Cc: Junio C Hamano, Jeff King, 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 <felipe.contreras@gmail.com>
---
 contrib/remote-helpers/git-remote-hg | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/contrib/remote-helpers/git-remote-hg b/contrib/remote-helpers/git-remote-hg
index 96ad30d..84901e9 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -908,7 +908,7 @@ def main(args):
 
     hg_git_compat = False
     track_branches = True
-    force_push = True
+    force_push = False
 
     try:
         if get_config('remote-hg.hg-git-compat') == 'true\n':
@@ -916,8 +916,8 @@ def main(args):
             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 get_config('remote-hg.force-push') == 'true\n':
+            force_push = True
     except subprocess.CalledProcessError:
         pass
 
-- 
1.8.3.rc1.579.g184e698

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 2/6] remote-hg: don't push fake 'master' bookmark
  2013-05-10 20:59 [PATCH v2 0/6] remote-hg: fixes and cleanups Felipe Contreras
  2013-05-10 20:59 ` [PATCH v2 1/6] remote-hg: disable forced push by default Felipe Contreras
@ 2013-05-10 20:59 ` Felipe Contreras
  2013-05-10 20:59 ` [PATCH v2 3/6] remote-hg: update bookmarks when pulling Felipe Contreras
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Felipe Contreras @ 2013-05-10 20:59 UTC (permalink / raw
  To: git; +Cc: Junio C Hamano, Jeff King, Felipe Contreras

We skip it locally, but not for the remote, so let's do so.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 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 84901e9..14e7395 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -867,7 +867,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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 3/6] remote-hg: update bookmarks when pulling
  2013-05-10 20:59 [PATCH v2 0/6] remote-hg: fixes and cleanups Felipe Contreras
  2013-05-10 20:59 ` [PATCH v2 1/6] remote-hg: disable forced push by default Felipe Contreras
  2013-05-10 20:59 ` [PATCH v2 2/6] remote-hg: don't push fake 'master' bookmark Felipe Contreras
@ 2013-05-10 20:59 ` Felipe Contreras
  2013-05-10 20:59 ` [PATCH v2 4/6] remote-hg: test: be a little more quiet Felipe Contreras
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Felipe Contreras @ 2013-05-10 20:59 UTC (permalink / raw
  To: git; +Cc: Junio C Hamano, Jeff King, Felipe Contreras

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 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 14e7395..c84a7b4 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -357,6 +357,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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 4/6] remote-hg: test: be a little more quiet
  2013-05-10 20:59 [PATCH v2 0/6] remote-hg: fixes and cleanups Felipe Contreras
                   ` (2 preceding siblings ...)
  2013-05-10 20:59 ` [PATCH v2 3/6] remote-hg: update bookmarks when pulling Felipe Contreras
@ 2013-05-10 20:59 ` Felipe Contreras
  2013-05-10 20:59 ` [PATCH v2 5/6] remote-hg: fix new branch creation Felipe Contreras
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Felipe Contreras @ 2013-05-10 20:59 UTC (permalink / raw
  To: git; +Cc: Junio C Hamano, Jeff King, Felipe Contreras

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 5/6] remote-hg: fix new branch creation
  2013-05-10 20:59 [PATCH v2 0/6] remote-hg: fixes and cleanups Felipe Contreras
                   ` (3 preceding siblings ...)
  2013-05-10 20:59 ` [PATCH v2 4/6] remote-hg: test: be a little more quiet Felipe Contreras
@ 2013-05-10 20:59 ` Felipe Contreras
  2013-05-10 20:59 ` [PATCH v2 6/6] remote-hg: trivial reorganization Felipe Contreras
  2013-05-13 23:15 ` [PATCH v2 0/6] remote-hg: fixes and cleanups Felipe Contreras
  6 siblings, 0 replies; 8+ messages in thread
From: Felipe Contreras @ 2013-05-10 20:59 UTC (permalink / raw
  To: git; +Cc: Junio C Hamano, Jeff King, Felipe Contreras

When force_push is disabled, we need to turn the argument to True.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 contrib/remote-helpers/git-remote-hg | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/remote-helpers/git-remote-hg b/contrib/remote-helpers/git-remote-hg
index c84a7b4..50ead38 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -853,7 +853,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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 6/6] remote-hg: trivial reorganization
  2013-05-10 20:59 [PATCH v2 0/6] remote-hg: fixes and cleanups Felipe Contreras
                   ` (4 preceding siblings ...)
  2013-05-10 20:59 ` [PATCH v2 5/6] remote-hg: fix new branch creation Felipe Contreras
@ 2013-05-10 20:59 ` Felipe Contreras
  2013-05-13 23:15 ` [PATCH v2 0/6] remote-hg: fixes and cleanups Felipe Contreras
  6 siblings, 0 replies; 8+ messages in thread
From: Felipe Contreras @ 2013-05-10 20:59 UTC (permalink / raw
  To: git; +Cc: Junio C Hamano, Jeff King, Felipe Contreras

We only need to get the remote dict once.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 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 50ead38..40da4b0 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -854,6 +854,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:
@@ -880,8 +881,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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 0/6] remote-hg: fixes and cleanups
  2013-05-10 20:59 [PATCH v2 0/6] remote-hg: fixes and cleanups Felipe Contreras
                   ` (5 preceding siblings ...)
  2013-05-10 20:59 ` [PATCH v2 6/6] remote-hg: trivial reorganization Felipe Contreras
@ 2013-05-13 23:15 ` Felipe Contreras
  6 siblings, 0 replies; 8+ messages in thread
From: Felipe Contreras @ 2013-05-13 23:15 UTC (permalink / raw
  To: git; +Cc: Junio C Hamano, Jeff King, Felipe Contreras

On Fri, May 10, 2013 at 3:59 PM, Felipe Contreras
<felipe.contreras@gmail.com> 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-05-13 23:15 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-10 20:59 [PATCH v2 0/6] remote-hg: fixes and cleanups Felipe Contreras
2013-05-10 20:59 ` [PATCH v2 1/6] remote-hg: disable forced push by default Felipe Contreras
2013-05-10 20:59 ` [PATCH v2 2/6] remote-hg: don't push fake 'master' bookmark Felipe Contreras
2013-05-10 20:59 ` [PATCH v2 3/6] remote-hg: update bookmarks when pulling Felipe Contreras
2013-05-10 20:59 ` [PATCH v2 4/6] remote-hg: test: be a little more quiet Felipe Contreras
2013-05-10 20:59 ` [PATCH v2 5/6] remote-hg: fix new branch creation Felipe Contreras
2013-05-10 20:59 ` [PATCH v2 6/6] remote-hg: trivial reorganization Felipe Contreras
2013-05-13 23:15 ` [PATCH v2 0/6] remote-hg: fixes and cleanups Felipe Contreras

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).