Show More
@@ -15,6 +15,7 from mercurial.i18n import _ | |||||
15 | from mercurial import ( |
|
15 | from mercurial import ( | |
16 | encoding, |
|
16 | encoding, | |
17 | error, |
|
17 | error, | |
|
18 | pycompat, | |||
18 | util, |
|
19 | util, | |
19 | ) |
|
20 | ) | |
20 |
|
21 | |||
@@ -69,7 +70,7 class convert_cvs(converter_source): | |||||
69 | raise error.Abort(_('revision %s is not a patchset number') |
|
70 | raise error.Abort(_('revision %s is not a patchset number') | |
70 | % self.revs[0]) |
|
71 | % self.revs[0]) | |
71 |
|
72 | |||
72 |
d = |
|
73 | d = pycompat.getcwd() | |
73 | try: |
|
74 | try: | |
74 | os.chdir(self.path) |
|
75 | os.chdir(self.path) | |
75 | id = None |
|
76 | id = None |
@@ -12,6 +12,7 from mercurial.i18n import _ | |||||
12 | from mercurial import ( |
|
12 | from mercurial import ( | |
13 | encoding, |
|
13 | encoding, | |
14 | error, |
|
14 | error, | |
|
15 | pycompat, | |||
15 | scmutil, |
|
16 | scmutil, | |
16 | strutil, |
|
17 | strutil, | |
17 | util, |
|
18 | util, | |
@@ -1119,7 +1120,7 class svn_sink(converter_sink, commandli | |||||
1119 | self.delexec = [] |
|
1120 | self.delexec = [] | |
1120 | self.copies = [] |
|
1121 | self.copies = [] | |
1121 | self.wc = None |
|
1122 | self.wc = None | |
1122 |
self.cwd = |
|
1123 | self.cwd = pycompat.getcwd() | |
1123 |
|
1124 | |||
1124 | created = False |
|
1125 | created = False | |
1125 | if os.path.isfile(os.path.join(path, '.svn', 'entries')): |
|
1126 | if os.path.isfile(os.path.join(path, '.svn', 'entries')): | |
@@ -1139,7 +1140,8 class svn_sink(converter_sink, commandli | |||||
1139 | path = '/' + path |
|
1140 | path = '/' + path | |
1140 | path = 'file://' + path |
|
1141 | path = 'file://' + path | |
1141 |
|
1142 | |||
1142 |
wcpath = os.path.join( |
|
1143 | wcpath = os.path.join(pycompat.getcwd(), os.path.basename(path) + | |
|
1144 | '-wc') | |||
1143 | ui.status(_('initializing svn working copy %r\n') |
|
1145 | ui.status(_('initializing svn working copy %r\n') | |
1144 | % os.path.basename(wcpath)) |
|
1146 | % os.path.basename(wcpath)) | |
1145 | self.run0('checkout', path, wcpath) |
|
1147 | self.run0('checkout', path, wcpath) |
@@ -87,6 +87,7 from mercurial import ( | |||||
87 | lock as lockmod, |
|
87 | lock as lockmod, | |
88 | patch as patchmod, |
|
88 | patch as patchmod, | |
89 | phases, |
|
89 | phases, | |
|
90 | pycompat, | |||
90 | registrar, |
|
91 | registrar, | |
91 | revset, |
|
92 | revset, | |
92 | scmutil, |
|
93 | scmutil, | |
@@ -3523,7 +3524,7 def mqinit(orig, ui, *args, **kwargs): | |||||
3523 | raise error.Abort(_('only a local queue repository ' |
|
3524 | raise error.Abort(_('only a local queue repository ' | |
3524 | 'may be initialized')) |
|
3525 | 'may be initialized')) | |
3525 | else: |
|
3526 | else: | |
3526 |
repopath = cmdutil.findrepo( |
|
3527 | repopath = cmdutil.findrepo(pycompat.getcwd()) | |
3527 | if not repopath: |
|
3528 | if not repopath: | |
3528 | raise error.Abort(_('there is no Mercurial repository here ' |
|
3529 | raise error.Abort(_('there is no Mercurial repository here ' | |
3529 | '(.hg not found)')) |
|
3530 | '(.hg not found)')) |
@@ -35,6 +35,7 from . import ( | |||||
35 | node as nodemod, |
|
35 | node as nodemod, | |
36 | pathutil, |
|
36 | pathutil, | |
37 | phases, |
|
37 | phases, | |
|
38 | pycompat, | |||
38 | revlog, |
|
39 | revlog, | |
39 | scmutil, |
|
40 | scmutil, | |
40 | util, |
|
41 | util, | |
@@ -392,7 +393,7 class bundlerepository(localrepo.localre | |||||
392 | return bundlepeer(self) |
|
393 | return bundlepeer(self) | |
393 |
|
394 | |||
394 | def getcwd(self): |
|
395 | def getcwd(self): | |
395 |
return |
|
396 | return pycompat.getcwd() # always outside the repo | |
396 |
|
397 | |||
397 | # Check if parents exist in localrepo before setting |
|
398 | # Check if parents exist in localrepo before setting | |
398 | def setparents(self, p1, p2=nullid): |
|
399 | def setparents(self, p1, p2=nullid): | |
@@ -412,13 +413,13 def instance(ui, path, create): | |||||
412 | parentpath = ui.config("bundle", "mainreporoot", "") |
|
413 | parentpath = ui.config("bundle", "mainreporoot", "") | |
413 | if not parentpath: |
|
414 | if not parentpath: | |
414 | # try to find the correct path to the working directory repo |
|
415 | # try to find the correct path to the working directory repo | |
415 |
parentpath = cmdutil.findrepo( |
|
416 | parentpath = cmdutil.findrepo(pycompat.getcwd()) | |
416 | if parentpath is None: |
|
417 | if parentpath is None: | |
417 | parentpath = '' |
|
418 | parentpath = '' | |
418 | if parentpath: |
|
419 | if parentpath: | |
419 | # Try to make the full path relative so we get a nice, short URL. |
|
420 | # Try to make the full path relative so we get a nice, short URL. | |
420 | # In particular, we don't want temp dir names in test outputs. |
|
421 | # In particular, we don't want temp dir names in test outputs. | |
421 |
cwd = |
|
422 | cwd = pycompat.getcwd() | |
422 | if parentpath == cwd: |
|
423 | if parentpath == cwd: | |
423 | parentpath = '' |
|
424 | parentpath = '' | |
424 | else: |
|
425 | else: |
@@ -38,6 +38,7 from . import ( | |||||
38 | patch, |
|
38 | patch, | |
39 | pathutil, |
|
39 | pathutil, | |
40 | phases, |
|
40 | phases, | |
|
41 | pycompat, | |||
41 | repair, |
|
42 | repair, | |
42 | revlog, |
|
43 | revlog, | |
43 | revset, |
|
44 | revset, | |
@@ -570,7 +571,7 def openrevlog(repo, cmd, file_, opts): | |||||
570 | raise error.CommandError(cmd, _('invalid arguments')) |
|
571 | raise error.CommandError(cmd, _('invalid arguments')) | |
571 | if not os.path.isfile(file_): |
|
572 | if not os.path.isfile(file_): | |
572 | raise error.Abort(_("revlog '%s' not found") % file_) |
|
573 | raise error.Abort(_("revlog '%s' not found") % file_) | |
573 |
r = revlog.revlog(scmutil.opener( |
|
574 | r = revlog.revlog(scmutil.opener(pycompat.getcwd(), audit=False), | |
574 | file_[:-2] + ".i") |
|
575 | file_[:-2] + ".i") | |
575 | return r |
|
576 | return r | |
576 |
|
577 | |||
@@ -2744,7 +2745,7 def commitforceeditor(repo, ctx, subs, f | |||||
2744 | committext = buildcommittext(repo, ctx, subs, extramsg) |
|
2745 | committext = buildcommittext(repo, ctx, subs, extramsg) | |
2745 |
|
2746 | |||
2746 | # run editor in the repository root |
|
2747 | # run editor in the repository root | |
2747 |
olddir = |
|
2748 | olddir = pycompat.getcwd() | |
2748 | os.chdir(repo.root) |
|
2749 | os.chdir(repo.root) | |
2749 |
|
2750 | |||
2750 | # make in-memory changes visible to external process |
|
2751 | # make in-memory changes visible to external process |
@@ -2630,7 +2630,7 def debugpathcomplete(ui, repo, *specs, | |||||
2630 |
|
2630 | |||
2631 | def complete(path, acceptable): |
|
2631 | def complete(path, acceptable): | |
2632 | dirstate = repo.dirstate |
|
2632 | dirstate = repo.dirstate | |
2633 |
spec = os.path.normpath(os.path.join( |
|
2633 | spec = os.path.normpath(os.path.join(pycompat.getcwd(), path)) | |
2634 | rootdir = repo.root + os.sep |
|
2634 | rootdir = repo.root + os.sep | |
2635 | if spec != repo.root and not spec.startswith(rootdir): |
|
2635 | if spec != repo.root and not spec.startswith(rootdir): | |
2636 | return [], [] |
|
2636 | return [], [] |
@@ -21,6 +21,7 from .i18n import _ | |||||
21 | from . import ( |
|
21 | from . import ( | |
22 | encoding, |
|
22 | encoding, | |
23 | error, |
|
23 | error, | |
|
24 | pycompat, | |||
24 | util, |
|
25 | util, | |
25 | ) |
|
26 | ) | |
26 |
|
27 | |||
@@ -152,7 +153,7 class server(object): | |||||
152 | based stream to fout. |
|
153 | based stream to fout. | |
153 | """ |
|
154 | """ | |
154 | def __init__(self, ui, repo, fin, fout): |
|
155 | def __init__(self, ui, repo, fin, fout): | |
155 |
self.cwd = |
|
156 | self.cwd = pycompat.getcwd() | |
156 |
|
157 | |||
157 | # developer config: cmdserver.log |
|
158 | # developer config: cmdserver.log | |
158 | logpath = ui.config("cmdserver", "log", None) |
|
159 | logpath = ui.config("cmdserver", "log", None) |
@@ -8,7 +8,6 | |||||
8 | from __future__ import absolute_import |
|
8 | from __future__ import absolute_import | |
9 |
|
9 | |||
10 | import operator |
|
10 | import operator | |
11 | import os |
|
|||
12 | import random |
|
11 | import random | |
13 |
|
12 | |||
14 | from .i18n import _ |
|
13 | from .i18n import _ | |
@@ -30,6 +29,7 from . import ( | |||||
30 | hg, |
|
29 | hg, | |
31 | localrepo, |
|
30 | localrepo, | |
32 | lock as lockmod, |
|
31 | lock as lockmod, | |
|
32 | pycompat, | |||
33 | revlog, |
|
33 | revlog, | |
34 | scmutil, |
|
34 | scmutil, | |
35 | setdiscovery, |
|
35 | setdiscovery, | |
@@ -50,7 +50,7 def debugancestor(ui, repo, *args): | |||||
50 | """find the ancestor revision of two revisions in a given index""" |
|
50 | """find the ancestor revision of two revisions in a given index""" | |
51 | if len(args) == 3: |
|
51 | if len(args) == 3: | |
52 | index, rev1, rev2 = args |
|
52 | index, rev1, rev2 = args | |
53 |
r = revlog.revlog(scmutil.opener( |
|
53 | r = revlog.revlog(scmutil.opener(pycompat.getcwd(), audit=False), index) | |
54 | lookup = r.lookup |
|
54 | lookup = r.lookup | |
55 | elif len(args) == 2: |
|
55 | elif len(args) == 2: | |
56 | if not repo: |
|
56 | if not repo: | |
@@ -385,7 +385,8 def debugdag(ui, repo, file_=None, *revs | |||||
385 | spaces = opts.get('spaces') |
|
385 | spaces = opts.get('spaces') | |
386 | dots = opts.get('dots') |
|
386 | dots = opts.get('dots') | |
387 | if file_: |
|
387 | if file_: | |
388 |
rlog = revlog.revlog(scmutil.opener( |
|
388 | rlog = revlog.revlog(scmutil.opener(pycompat.getcwd(), audit=False), | |
|
389 | file_) | |||
389 | revs = set((int(r) for r in revs)) |
|
390 | revs = set((int(r) for r in revs)) | |
390 | def events(): |
|
391 | def events(): | |
391 | for r in rlog: |
|
392 | for r in rlog: |
@@ -271,7 +271,7 class dirstate(object): | |||||
271 |
|
271 | |||
272 | @propertycache |
|
272 | @propertycache | |
273 | def _cwd(self): |
|
273 | def _cwd(self): | |
274 |
return |
|
274 | return pycompat.getcwd() | |
275 |
|
275 | |||
276 | def getcwd(self): |
|
276 | def getcwd(self): | |
277 | '''Return the path from which a canonical path is calculated. |
|
277 | '''Return the path from which a canonical path is calculated. |
@@ -880,7 +880,7 def _dispatch(req): | |||||
880 | if not path: |
|
880 | if not path: | |
881 | raise error.RepoError(_("no repository found in" |
|
881 | raise error.RepoError(_("no repository found in" | |
882 | " '%s' (.hg not found)") |
|
882 | " '%s' (.hg not found)") | |
883 |
% |
|
883 | % pycompat.getcwd()) | |
884 | raise |
|
884 | raise | |
885 | if repo: |
|
885 | if repo: | |
886 | ui = repo.ui |
|
886 | ui = repo.ui |
@@ -16,6 +16,7 from . import ( | |||||
16 | demandimport, |
|
16 | demandimport, | |
17 | error, |
|
17 | error, | |
18 | extensions, |
|
18 | extensions, | |
|
19 | pycompat, | |||
19 | util, |
|
20 | util, | |
20 | ) |
|
21 | ) | |
21 |
|
22 | |||
@@ -141,7 +142,7 def _exthook(ui, repo, name, cmd, args, | |||||
141 | if repo: |
|
142 | if repo: | |
142 | cwd = repo.root |
|
143 | cwd = repo.root | |
143 | else: |
|
144 | else: | |
144 |
cwd = |
|
145 | cwd = pycompat.getcwd() | |
145 | r = ui.system(cmd, environ=env, cwd=cwd) |
|
146 | r = ui.system(cmd, environ=env, cwd=cwd) | |
146 |
|
147 | |||
147 | duration = time.time() - starttime |
|
148 | duration = time.time() - starttime |
@@ -28,6 +28,7 from . import ( | |||||
28 | error, |
|
28 | error, | |
29 | filemerge, |
|
29 | filemerge, | |
30 | obsolete, |
|
30 | obsolete, | |
|
31 | pycompat, | |||
31 | scmutil, |
|
32 | scmutil, | |
32 | subrepo, |
|
33 | subrepo, | |
33 | util, |
|
34 | util, | |
@@ -1040,7 +1041,7 def batchremove(repo, actions): | |||||
1040 | wjoin = repo.wjoin |
|
1041 | wjoin = repo.wjoin | |
1041 | audit = repo.wvfs.audit |
|
1042 | audit = repo.wvfs.audit | |
1042 | try: |
|
1043 | try: | |
1043 |
cwd = |
|
1044 | cwd = pycompat.getcwd() | |
1044 | except OSError as err: |
|
1045 | except OSError as err: | |
1045 | if err.errno != errno.ENOENT: |
|
1046 | if err.errno != errno.ENOENT: | |
1046 | raise |
|
1047 | raise | |
@@ -1066,7 +1067,7 def batchremove(repo, actions): | |||||
1066 | # cwd was present before we started to remove files |
|
1067 | # cwd was present before we started to remove files | |
1067 | # let's check if it is present after we removed them |
|
1068 | # let's check if it is present after we removed them | |
1068 | try: |
|
1069 | try: | |
1069 |
|
|
1070 | pycompat.getcwd() | |
1070 | except OSError as err: |
|
1071 | except OSError as err: | |
1071 | if err.errno != errno.ENOENT: |
|
1072 | if err.errno != errno.ENOENT: | |
1072 | raise |
|
1073 | raise |
@@ -27,6 +27,7 from . import ( | |||||
27 | error, |
|
27 | error, | |
28 | formatter, |
|
28 | formatter, | |
29 | progress, |
|
29 | progress, | |
|
30 | pycompat, | |||
30 | scmutil, |
|
31 | scmutil, | |
31 | util, |
|
32 | util, | |
32 | ) |
|
33 | ) | |
@@ -227,7 +228,7 class ui(object): | |||||
227 | if section in (None, 'paths'): |
|
228 | if section in (None, 'paths'): | |
228 | # expand vars and ~ |
|
229 | # expand vars and ~ | |
229 | # translate paths relative to root (or home) into absolute paths |
|
230 | # translate paths relative to root (or home) into absolute paths | |
230 |
root = root or |
|
231 | root = root or pycompat.getcwd() | |
231 | for c in self._tcfg, self._ucfg, self._ocfg: |
|
232 | for c in self._tcfg, self._ucfg, self._ocfg: | |
232 | for n, p in c.items('paths'): |
|
233 | for n, p in c.items('paths'): | |
233 | # Ignore sub-options. |
|
234 | # Ignore sub-options. |
@@ -13,8 +13,6 allowing operations like diff and log wi | |||||
13 |
|
13 | |||
14 | from __future__ import absolute_import |
|
14 | from __future__ import absolute_import | |
15 |
|
15 | |||
16 | import os |
|
|||
17 |
|
||||
18 | from .i18n import _ |
|
16 | from .i18n import _ | |
19 | from .node import nullid |
|
17 | from .node import nullid | |
20 |
|
18 | |||
@@ -27,6 +25,7 from . import ( | |||||
27 | manifest, |
|
25 | manifest, | |
28 | mdiff, |
|
26 | mdiff, | |
29 | pathutil, |
|
27 | pathutil, | |
|
28 | pycompat, | |||
30 | revlog, |
|
29 | revlog, | |
31 | scmutil, |
|
30 | scmutil, | |
32 | util, |
|
31 | util, | |
@@ -229,7 +228,7 class unionrepository(localrepo.localrep | |||||
229 | return unionpeer(self) |
|
228 | return unionpeer(self) | |
230 |
|
229 | |||
231 | def getcwd(self): |
|
230 | def getcwd(self): | |
232 |
return |
|
231 | return pycompat.getcwd() # always outside the repo | |
233 |
|
232 | |||
234 | def instance(ui, path, create): |
|
233 | def instance(ui, path, create): | |
235 | if create: |
|
234 | if create: | |
@@ -237,13 +236,13 def instance(ui, path, create): | |||||
237 | parentpath = ui.config("bundle", "mainreporoot", "") |
|
236 | parentpath = ui.config("bundle", "mainreporoot", "") | |
238 | if not parentpath: |
|
237 | if not parentpath: | |
239 | # try to find the correct path to the working directory repo |
|
238 | # try to find the correct path to the working directory repo | |
240 |
parentpath = cmdutil.findrepo( |
|
239 | parentpath = cmdutil.findrepo(pycompat.getcwd()) | |
241 | if parentpath is None: |
|
240 | if parentpath is None: | |
242 | parentpath = '' |
|
241 | parentpath = '' | |
243 | if parentpath: |
|
242 | if parentpath: | |
244 | # Try to make the full path relative so we get a nice, short URL. |
|
243 | # Try to make the full path relative so we get a nice, short URL. | |
245 | # In particular, we don't want temp dir names in test outputs. |
|
244 | # In particular, we don't want temp dir names in test outputs. | |
246 |
cwd = |
|
245 | cwd = pycompat.getcwd() | |
247 | if parentpath == cwd: |
|
246 | if parentpath == cwd: | |
248 | parentpath = '' |
|
247 | parentpath = '' | |
249 | else: |
|
248 | else: |
General Comments 0
You need to be logged in to leave comments.
Login now