--- a/mercurial/changegroup.py
+++ b/mercurial/changegroup.py
@@ -99,7 +99,7 @@ def writebundle(cg, filename, bundletype
if cleanup is not None:
os.unlink(cleanup)
-def readbundle(fh):
+def readbundle(fh, fname):
header = fh.read(6)
if not header.startswith("HG"):
raise util.Abort(_("%s: not a Mercurial bundle file") % fname)
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2474,7 +2474,7 @@ def unbundle(ui, repo, fname, **opts):
Apply a compressed changegroup file generated by the bundle
command.
"""
- gen = changegroup.readbundle(urllib.urlopen(fname))
+ gen = changegroup.readbundle(urllib.urlopen(fname), fname)
modheads = repo.addchangegroup(gen, 'unbundle', 'bundle:' + fname)
return postincoming(ui, repo, modheads, opts['update'])
--- a/mercurial/statichttprepo.py
+++ b/mercurial/statichttprepo.py
@@ -10,7 +10,7 @@
from demandload import *
from i18n import gettext as _
demandload(globals(), "changelog filelog httprangereader")
-demandload(globals(), "localrepo manifest os urllib urllib2 util")
+demandload(globals(), "repo localrepo manifest os urllib urllib2 util")
class rangereader(httprangereader.httprangereader):
def read(self, size=None):
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -902,7 +902,7 @@ else:
The return value of a util.fstat(f) may be passed as the st argument.
"""
if st is None:
- st = fstat(f)
+ st = fstat(fp)
return st.st_uid == os.getuid()
def _buildencodefun():