Re: [PATCH v4 14/21] remote-hg: show more proper errors

2013-05-27 Thread Antoine Pelisse
Hey Felipe,
I know that has been integrated a while ago.

On Thu, Apr 11, 2013 at 2:23 PM, Felipe Contreras
felipe.contre...@gmail.com wrote:
 When cloning or pushing fails, we don't want to show a stack-trace.

 diff --git a/contrib/remote-helpers/git-remote-hg 
 b/contrib/remote-helpers/git-remote-hg
 index ff89725..3ae3598 100755
 --- a/contrib/remote-helpers/git-remote-hg
 +++ b/contrib/remote-helpers/git-remote-hg
 @@ -284,11 +284,17 @@ def get_repo(url, alias):
  else:
  local_path = os.path.join(dirname, 'clone')
  if not os.path.exists(local_path):
 -peer, dstpeer = hg.clone(myui, {}, url, local_path, 
 update=False, pull=True)
 +try:
 +peer, dstpeer = hg.clone(myui, {}, url, local_path, 
 update=True, pull=True)
 +except:
 +die('Repository error')
  repo = dstpeer.local()

Can you explain why update went from False to True ? That can be a
problem if the repository is BIG (two working directories instead of
one can raise space issues).

The commit message is not so helpful here ;)
--
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 14/21] remote-hg: show more proper errors

2013-05-27 Thread Felipe Contreras
On Mon, May 27, 2013 at 11:30 AM, Antoine Pelisse apeli...@gmail.com wrote:
 Hey Felipe,
 I know that has been integrated a while ago.

 On Thu, Apr 11, 2013 at 2:23 PM, Felipe Contreras
 felipe.contre...@gmail.com wrote:
 When cloning or pushing fails, we don't want to show a stack-trace.

 diff --git a/contrib/remote-helpers/git-remote-hg 
 b/contrib/remote-helpers/git-remote-hg
 index ff89725..3ae3598 100755
 --- a/contrib/remote-helpers/git-remote-hg
 +++ b/contrib/remote-helpers/git-remote-hg
 @@ -284,11 +284,17 @@ def get_repo(url, alias):
  else:
  local_path = os.path.join(dirname, 'clone')
  if not os.path.exists(local_path):
 -peer, dstpeer = hg.clone(myui, {}, url, local_path, 
 update=False, pull=True)
 +try:
 +peer, dstpeer = hg.clone(myui, {}, url, local_path, 
 update=True, pull=True)
 +except:
 +die('Repository error')
  repo = dstpeer.local()

 Can you explain why update went from False to True ? That can be a
 problem if the repository is BIG (two working directories instead of
 one can raise space issues).

 The commit message is not so helpful here ;)

Good catch. It was probably a mistake. However, I already sent a patch
that overrides this so update=False again.

-- 
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 v4 14/21] remote-hg: show more proper errors

2013-04-11 Thread Felipe Contreras
When cloning or pushing fails, we don't want to show a stack-trace.

Signed-off-by: Felipe Contreras felipe.contre...@gmail.com
---
 contrib/remote-helpers/git-remote-hg | 12 +---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/contrib/remote-helpers/git-remote-hg 
b/contrib/remote-helpers/git-remote-hg
index ff89725..3ae3598 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -9,7 +9,7 @@
 # Then you can clone with:
 # git clone hg::/path/to/mercurial/repo/
 
-from mercurial import hg, ui, bookmarks, context, util, encoding, node
+from mercurial import hg, ui, bookmarks, context, util, encoding, node, error
 
 import re
 import sys
@@ -284,11 +284,17 @@ def get_repo(url, alias):
 else:
 local_path = os.path.join(dirname, 'clone')
 if not os.path.exists(local_path):
-peer, dstpeer = hg.clone(myui, {}, url, local_path, update=False, 
pull=True)
+try:
+peer, dstpeer = hg.clone(myui, {}, url, local_path, 
update=True, pull=True)
+except:
+die('Repository error')
 repo = dstpeer.local()
 else:
 repo = hg.repository(myui, local_path)
-peer = hg.peer(myui, {}, url)
+try:
+peer = hg.peer(myui, {}, url)
+except:
+die('Repository error')
 repo.pull(peer, heads=None, force=True)
 
 return repo
-- 
1.8.2.1

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