diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -3538,7 +3538,7 @@ def identify(ui, repo, source=None, rev= if source: source, branches = hg.parseurl(ui.expandpath(source)) - peer = hg.peer(ui, opts, source) + peer = hg.peer(repo or ui, opts, source) # only pass ui when no repo repo = peer.local() revs, checkout = hg.addbranchrevs(repo, peer, branches, None) diff --git a/mercurial/hg.py b/mercurial/hg.py --- a/mercurial/hg.py +++ b/mercurial/hg.py @@ -353,7 +353,8 @@ def clone(ui, peeropts, source, dest=Non node=node.hex(node.nullid)) else: try: - destpeer = peer(ui, peeropts, dest, create=True) + destpeer = peer(srcrepo or ui, peeropts, dest, create=True) + # only pass ui when no srcrepo except OSError, inst: if inst.errno == errno.EEXIST: dircleanup.close()