Show More
@@ -36,7 +36,7 b' A few obvious properties that are not cu' | |||
|
36 | 36 | ''' |
|
37 | 37 | |
|
38 | 38 | import bisect, collections, json, os, random, time |
|
39 | from mercurial import cmdutil, context, patch, scmutil, url, util | |
|
39 | from mercurial import cmdutil, context, patch, scmutil, url, util, hg | |
|
40 | 40 | from mercurial.i18n import _ |
|
41 | 41 | from mercurial.node import nullrev, nullid |
|
42 | 42 | |
@@ -224,7 +224,7 b' def synthesize(ui, repo, descpath, **opt' | |||
|
224 | 224 | path to an alternate dictionary to use. |
|
225 | 225 | ''' |
|
226 | 226 | try: |
|
227 |
fp = |
|
|
227 | fp = hg.openpath(ui, descpath) | |
|
228 | 228 | except Exception, err: |
|
229 | 229 | raise util.Abort('%s: %s' % (descpath, err[0].strerror)) |
|
230 | 230 | desc = json.load(fp) |
@@ -63,7 +63,7 b' from mercurial.i18n import _' | |||
|
63 | 63 | from mercurial.node import bin, hex, short, nullid, nullrev |
|
64 | 64 | from mercurial.lock import release |
|
65 | 65 | from mercurial import commands, cmdutil, hg, scmutil, util, revset |
|
66 |
from mercurial import repair, extensions, |
|
|
66 | from mercurial import repair, extensions, error, phases, bookmarks | |
|
67 | 67 | from mercurial import patch as patchmod |
|
68 | 68 | import os, re, errno, shutil |
|
69 | 69 | |
@@ -2004,7 +2004,7 b' class queue(object):' | |||
|
2004 | 2004 | if filename == '-': |
|
2005 | 2005 | text = self.ui.fin.read() |
|
2006 | 2006 | else: |
|
2007 |
fp = |
|
|
2007 | fp = hg.openpath(self.ui, filename) | |
|
2008 | 2008 | text = fp.read() |
|
2009 | 2009 | fp.close() |
|
2010 | 2010 | except (OSError, IOError): |
@@ -10,7 +10,7 b' from lock import release' | |||
|
10 | 10 | from i18n import _, gettext |
|
11 | 11 | import os, re, difflib, time, tempfile, errno |
|
12 | 12 | import hg, scmutil, util, revlog, extensions, copies, error, bookmarks |
|
13 |
import patch, help |
|
|
13 | import patch, help, encoding, templatekw, discovery | |
|
14 | 14 | import archival, changegroup, cmdutil, hbisect |
|
15 | 15 | import sshserver, hgweb, hgweb.server, commandserver |
|
16 | 16 | import merge as mergemod |
@@ -1590,7 +1590,7 b' def debugbuilddag(ui, repo, text=None,' | |||
|
1590 | 1590 | @command('debugbundle', [('a', 'all', None, _('show all details'))], _('FILE')) |
|
1591 | 1591 | def debugbundle(ui, bundlepath, all=None, **opts): |
|
1592 | 1592 | """lists the contents of a bundle""" |
|
1593 |
f = |
|
|
1593 | f = hg.openpath(ui, bundlepath) | |
|
1594 | 1594 | try: |
|
1595 | 1595 | gen = changegroup.readbundle(f, bundlepath) |
|
1596 | 1596 | if all: |
@@ -3856,7 +3856,7 b' def import_(ui, repo, patch1=None, *patc' | |||
|
3856 | 3856 | else: |
|
3857 | 3857 | patchurl = os.path.join(base, patchurl) |
|
3858 | 3858 | ui.status(_('applying %s\n') % patchurl) |
|
3859 |
patchfile = |
|
|
3859 | patchfile = hg.openpath(ui, patchurl) | |
|
3860 | 3860 | |
|
3861 | 3861 | haspatch = False |
|
3862 | 3862 | for hunk in patch.split(patchfile): |
@@ -5804,7 +5804,7 b' def unbundle(ui, repo, fname1, *fnames, ' | |||
|
5804 | 5804 | wc = repo['.'] |
|
5805 | 5805 | try: |
|
5806 | 5806 | for fname in fnames: |
|
5807 |
f = |
|
|
5807 | f = hg.openpath(ui, fname) | |
|
5808 | 5808 | gen = changegroup.readbundle(f, fname) |
|
5809 | 5809 | modheads = repo.addchangegroup(gen, 'unbundle', 'bundle:' + fname) |
|
5810 | 5810 | finally: |
@@ -10,7 +10,7 b' from i18n import _' | |||
|
10 | 10 | from lock import release |
|
11 | 11 | from node import hex, nullid |
|
12 | 12 | import localrepo, bundlerepo, httppeer, sshpeer, statichttprepo, bookmarks |
|
13 | import lock, util, extensions, error, node, scmutil, phases | |
|
13 | import lock, util, extensions, error, node, scmutil, phases, url | |
|
14 | 14 | import cmdutil, discovery |
|
15 | 15 | import merge as mergemod |
|
16 | 16 | import verify as verifymod |
@@ -89,6 +89,13 b' def islocal(repo):' | |||
|
89 | 89 | return False |
|
90 | 90 | return repo.local() |
|
91 | 91 | |
|
92 | def openpath(ui, path): | |
|
93 | '''open path with open if local, url.open if remote''' | |
|
94 | if islocal(path): | |
|
95 | return open(util.urllocalpath(path)) | |
|
96 | else: | |
|
97 | return url.open(ui, path) | |
|
98 | ||
|
92 | 99 | def _peerorrepo(ui, path, create=False): |
|
93 | 100 | """return a repository object for the specified path""" |
|
94 | 101 | obj = _peerlookup(path).instance(ui, path, create) |
General Comments 0
You need to be logged in to leave comments.
Login now