changeset 4056:f1622b4f467d

unbundle: don't use urllib if it's a local file
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Tue, 30 Jan 2007 18:32:21 -0200
parents e37786b29bed
children 3600b84656d3
files mercurial/commands.py
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Tue Jan 30 18:32:20 2007 -0200
+++ b/mercurial/commands.py	Tue Jan 30 18:32:21 2007 -0200
@@ -2490,7 +2490,11 @@
     Apply a compressed changegroup file generated by the bundle
     command.
     """
-    gen = changegroup.readbundle(urllib.urlopen(fname), fname)
+    if os.path.exists(fname):
+        f = open(fname)
+    else:
+        f = urllib.urlopen(fname)
+    gen = changegroup.readbundle(f, fname)
     modheads = repo.addchangegroup(gen, 'unbundle', 'bundle:' + fname)
     return postincoming(ui, repo, modheads, opts['update'])