changeset 15340:0e58513cc59a stable

largefiles: rearrange how lfconvert detects non-local repos Mainly this is so we can test that code; it has the side benefit of not requiring network I/O to reject non-local repo URLs.
author Greg Ward <greg@gerg.ca>
date Sat, 22 Oct 2011 14:20:17 -0400
parents be1377d19018
children 7ef13e53434e
files hgext/largefiles/lfcommands.py tests/test-lfconvert.t
diffstat 2 files changed, 12 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/largefiles/lfcommands.py	Sat Oct 22 14:17:19 2011 -0400
+++ b/hgext/largefiles/lfcommands.py	Sat Oct 22 14:20:17 2011 -0400
@@ -43,14 +43,15 @@
     else:
         tolfile = True
         size = lfutil.getminsize(ui, True, opts.get('size'), default=None)
+
+    if not hg.islocal(src):
+        raise util.Abort(_('%s is not a local Mercurial repo') % src)
+    if not hg.islocal(dest):
+        raise util.Abort(_('%s is not a local Mercurial repo') % dest)
+
     rsrc = hg.repository(ui, src)
-    if not rsrc.local():
-        raise util.Abort(_('%s is not a local Mercurial repo') % src)
-
     ui.status(_('initializing destination %s\n') % dest)
     rdst = hg.repository(ui, dest, create=True)
-    if not rdst.local():
-        raise util.Abort(_('%s is not a local Mercurial repo') % dest)
 
     success = False
     try:
--- a/tests/test-lfconvert.t	Sat Oct 22 14:17:19 2011 -0400
+++ b/tests/test-lfconvert.t	Sat Oct 22 14:20:17 2011 -0400
@@ -45,6 +45,12 @@
   $ cd ..
 
 "lfconvert" error cases
+  $ hg lfconvert http://localhost/foo foo
+  abort: http://localhost/foo is not a local Mercurial repo
+  [255]
+  $ hg lfconvert foo ssh://localhost/foo
+  abort: ssh://localhost/foo is not a local Mercurial repo
+  [255]
   $ hg lfconvert nosuchrepo foo
   abort: repository nosuchrepo not found!
   [255]