##// END OF EJS Templates
style: use consistent variable names (*mod) with imports which would shadow
Benoit Boissinot -
r10651:5f091fc1 default
parent child Browse files
Show More
@@ -13,7 +13,7 b' import hg, util, revlog, bundlerepo, ext'
13 import patch, help, mdiff, url, encoding, templatekw
13 import patch, help, mdiff, url, encoding, templatekw
14 import archival, changegroup, cmdutil, sshserver, hbisect
14 import archival, changegroup, cmdutil, sshserver, hbisect
15 from hgweb import server, hgweb_mod, hgwebdir_mod
15 from hgweb import server, hgweb_mod, hgwebdir_mod
16 import merge as merge_
16 import merge as mergemod
17 import minirst
17 import minirst
18
18
19 # Commands start here, listed alphabetically
19 # Commands start here, listed alphabetically
@@ -2596,7 +2596,7 b' def resolve(ui, repo, *pats, **opts):'
2596 raise util.Abort(_('no files or directories specified; '
2596 raise util.Abort(_('no files or directories specified; '
2597 'use --all to remerge all files'))
2597 'use --all to remerge all files'))
2598
2598
2599 ms = merge_.mergestate(repo)
2599 ms = mergemod.mergestate(repo)
2600 m = cmdutil.match(repo, pats, opts)
2600 m = cmdutil.match(repo, pats, opts)
2601
2601
2602 for f in ms:
2602 for f in ms:
@@ -3083,7 +3083,7 b' def summary(ui, repo, **opts):'
3083 ui.status(m)
3083 ui.status(m)
3084
3084
3085 st = list(repo.status(unknown=True))[:6]
3085 st = list(repo.status(unknown=True))[:6]
3086 ms = merge_.mergestate(repo)
3086 ms = mergemod.mergestate(repo)
3087 st.append([f for f in ms if ms[f] == 'u'])
3087 st.append([f for f in ms if ms[f] == 'u'])
3088 labels = [_('%d modified'), _('%d added'), _('%d removed'),
3088 labels = [_('%d modified'), _('%d added'), _('%d removed'),
3089 _('%d deleted'), _('%d unknown'), _('%d ignored'),
3089 _('%d deleted'), _('%d unknown'), _('%d ignored'),
@@ -9,7 +9,7 b' from i18n import _'
9 import os, sys, atexit, signal, pdb, socket, errno, shlex, time
9 import os, sys, atexit, signal, pdb, socket, errno, shlex, time
10 import util, commands, hg, fancyopts, extensions, hook, error
10 import util, commands, hg, fancyopts, extensions, hook, error
11 import cmdutil, encoding
11 import cmdutil, encoding
12 import ui as _ui
12 import ui as uimod
13
13
14 def run():
14 def run():
15 "run the command in sys.argv"
15 "run the command in sys.argv"
@@ -18,7 +18,7 b' def run():'
18 def dispatch(args):
18 def dispatch(args):
19 "run the command specified in args"
19 "run the command specified in args"
20 try:
20 try:
21 u = _ui.ui()
21 u = uimod.ui()
22 if '--traceback' in args:
22 if '--traceback' in args:
23 u.setconfig('ui', 'traceback', 'on')
23 u.setconfig('ui', 'traceback', 'on')
24 except util.Abort, inst:
24 except util.Abort, inst:
@@ -10,8 +10,8 b' from i18n import _'
10 from lock import release
10 from lock import release
11 import localrepo, bundlerepo, httprepo, sshrepo, statichttprepo
11 import localrepo, bundlerepo, httprepo, sshrepo, statichttprepo
12 import lock, util, extensions, error, encoding, node
12 import lock, util, extensions, error, encoding, node
13 import merge as _merge
13 import merge as mergemod
14 import verify as _verify
14 import verify as verifymod
15 import errno, os, shutil
15 import errno, os, shutil
16
16
17 def _local(path):
17 def _local(path):
@@ -358,7 +358,7 b' def _showstats(repo, stats):'
358
358
359 def update(repo, node):
359 def update(repo, node):
360 """update the working directory to node, merging linear changes"""
360 """update the working directory to node, merging linear changes"""
361 stats = _merge.update(repo, node, False, False, None)
361 stats = mergemod.update(repo, node, False, False, None)
362 _showstats(repo, stats)
362 _showstats(repo, stats)
363 if stats[3]:
363 if stats[3]:
364 repo.ui.status(_("use 'hg resolve' to retry unresolved file merges\n"))
364 repo.ui.status(_("use 'hg resolve' to retry unresolved file merges\n"))
@@ -369,14 +369,14 b' def update(repo, node):'
369
369
370 def clean(repo, node, show_stats=True):
370 def clean(repo, node, show_stats=True):
371 """forcibly switch the working directory to node, clobbering changes"""
371 """forcibly switch the working directory to node, clobbering changes"""
372 stats = _merge.update(repo, node, False, True, None)
372 stats = mergemod.update(repo, node, False, True, None)
373 if show_stats:
373 if show_stats:
374 _showstats(repo, stats)
374 _showstats(repo, stats)
375 return stats[3] > 0
375 return stats[3] > 0
376
376
377 def merge(repo, node, force=None, remind=True):
377 def merge(repo, node, force=None, remind=True):
378 """branch merge with node, resolving changes"""
378 """branch merge with node, resolving changes"""
379 stats = _merge.update(repo, node, True, force, False)
379 stats = mergemod.update(repo, node, True, force, False)
380 _showstats(repo, stats)
380 _showstats(repo, stats)
381 if stats[3]:
381 if stats[3]:
382 repo.ui.status(_("use 'hg resolve' to retry unresolved file merges "
382 repo.ui.status(_("use 'hg resolve' to retry unresolved file merges "
@@ -387,8 +387,8 b' def merge(repo, node, force=None, remind'
387
387
388 def revert(repo, node, choose):
388 def revert(repo, node, choose):
389 """revert changes to revision in node without updating dirstate"""
389 """revert changes to revision in node without updating dirstate"""
390 return _merge.update(repo, node, False, True, choose)[3] > 0
390 return mergemod.update(repo, node, False, True, choose)[3] > 0
391
391
392 def verify(repo):
392 def verify(repo):
393 """verify the consistency of a repository"""
393 """verify the consistency of a repository"""
394 return _verify.verify(repo)
394 return verifymod.verify(repo)
@@ -11,9 +11,9 b' import repo, changegroup, subrepo'
11 import changelog, dirstate, filelog, manifest, context
11 import changelog, dirstate, filelog, manifest, context
12 import lock, transaction, store, encoding
12 import lock, transaction, store, encoding
13 import util, extensions, hook, error
13 import util, extensions, hook, error
14 import match as match_
14 import match as matchmod
15 import merge as merge_
15 import merge as mergemod
16 import tags as tags_
16 import tags as tagsmod
17 from lock import release
17 from lock import release
18 import weakref, stat, errno, os, time, inspect
18 import weakref, stat, errno, os, time, inspect
19 propertycache = util.propertycache
19 propertycache = util.propertycache
@@ -207,7 +207,7 b' class localrepository(repo.repository):'
207 if '.hgtags' not in self.dirstate:
207 if '.hgtags' not in self.dirstate:
208 self.add(['.hgtags'])
208 self.add(['.hgtags'])
209
209
210 m = match_.exact(self.root, '', ['.hgtags'])
210 m = matchmod.exact(self.root, '', ['.hgtags'])
211 tagnode = self.commit(message, user, date, extra=extra, match=m)
211 tagnode = self.commit(message, user, date, extra=extra, match=m)
212
212
213 for name in names:
213 for name in names:
@@ -268,8 +268,8 b' class localrepository(repo.repository):'
268 alltags = {} # map tag name to (node, hist)
268 alltags = {} # map tag name to (node, hist)
269 tagtypes = {}
269 tagtypes = {}
270
270
271 tags_.findglobaltags(self.ui, self, alltags, tagtypes)
271 tagsmod.findglobaltags(self.ui, self, alltags, tagtypes)
272 tags_.readlocaltags(self.ui, self, alltags, tagtypes)
272 tagsmod.readlocaltags(self.ui, self, alltags, tagtypes)
273
273
274 # Build the return dicts. Have to re-encode tag names because
274 # Build the return dicts. Have to re-encode tag names because
275 # the tags module always uses UTF-8 (in order not to lose info
275 # the tags module always uses UTF-8 (in order not to lose info
@@ -503,7 +503,7 b' class localrepository(repo.repository):'
503 for pat, cmd in self.ui.configitems(filter):
503 for pat, cmd in self.ui.configitems(filter):
504 if cmd == '!':
504 if cmd == '!':
505 continue
505 continue
506 mf = match_.match(self.root, '', [pat])
506 mf = matchmod.match(self.root, '', [pat])
507 fn = None
507 fn = None
508 params = cmd
508 params = cmd
509 for name, filterfn in self._datafilters.iteritems():
509 for name, filterfn in self._datafilters.iteritems():
@@ -767,7 +767,7 b' class localrepository(repo.repository):'
767 raise util.Abort('%s: %s' % (f, msg))
767 raise util.Abort('%s: %s' % (f, msg))
768
768
769 if not match:
769 if not match:
770 match = match_.always(self.root, '')
770 match = matchmod.always(self.root, '')
771
771
772 if not force:
772 if not force:
773 vdirs = []
773 vdirs = []
@@ -824,7 +824,7 b' class localrepository(repo.repository):'
824 and self[None].branch() == self['.'].branch()):
824 and self[None].branch() == self['.'].branch()):
825 return None
825 return None
826
826
827 ms = merge_.mergestate(self)
827 ms = mergemod.mergestate(self)
828 for f in changes[0]:
828 for f in changes[0]:
829 if f in ms and ms[f] == 'u':
829 if f in ms and ms[f] == 'u':
830 raise util.Abort(_("unresolved merge conflicts "
830 raise util.Abort(_("unresolved merge conflicts "
@@ -996,7 +996,7 b' class localrepository(repo.repository):'
996
996
997 working = ctx2.rev() is None
997 working = ctx2.rev() is None
998 parentworking = working and ctx1 == self['.']
998 parentworking = working and ctx1 == self['.']
999 match = match or match_.always(self.root, self.getcwd())
999 match = match or matchmod.always(self.root, self.getcwd())
1000 listignored, listclean, listunknown = ignored, clean, unknown
1000 listignored, listclean, listunknown = ignored, clean, unknown
1001
1001
1002 # load earliest manifest first for caching reasons
1002 # load earliest manifest first for caching reasons
@@ -6,25 +6,25 b''
6 # GNU General Public License version 2 or any later version.
6 # GNU General Public License version 2 or any later version.
7
7
8 import os
8 import os
9 import stat as _stat
9 import stat as statmod
10
10
11 posixfile = open
11 posixfile = open
12
12
13 def _mode_to_kind(mode):
13 def _mode_to_kind(mode):
14 if _stat.S_ISREG(mode):
14 if statmod.S_ISREG(mode):
15 return _stat.S_IFREG
15 return statmod.S_IFREG
16 if _stat.S_ISDIR(mode):
16 if statmod.S_ISDIR(mode):
17 return _stat.S_IFDIR
17 return statmod.S_IFDIR
18 if _stat.S_ISLNK(mode):
18 if statmod.S_ISLNK(mode):
19 return _stat.S_IFLNK
19 return statmod.S_IFLNK
20 if _stat.S_ISBLK(mode):
20 if statmod.S_ISBLK(mode):
21 return _stat.S_IFBLK
21 return statmod.S_IFBLK
22 if _stat.S_ISCHR(mode):
22 if statmod.S_ISCHR(mode):
23 return _stat.S_IFCHR
23 return statmod.S_IFCHR
24 if _stat.S_ISFIFO(mode):
24 if statmod.S_ISFIFO(mode):
25 return _stat.S_IFIFO
25 return statmod.S_IFIFO
26 if _stat.S_ISSOCK(mode):
26 if statmod.S_ISSOCK(mode):
27 return _stat.S_IFSOCK
27 return statmod.S_IFSOCK
28 return mode
28 return mode
29
29
30 def listdir(path, stat=False, skip=None):
30 def listdir(path, stat=False, skip=None):
@@ -49,7 +49,7 b' def listdir(path, stat=False, skip=None)'
49 names.sort()
49 names.sort()
50 for fn in names:
50 for fn in names:
51 st = os.lstat(prefix + fn)
51 st = os.lstat(prefix + fn)
52 if fn == skip and _stat.S_ISDIR(st.st_mode):
52 if fn == skip and statmod.S_ISDIR(st.st_mode):
53 return []
53 return []
54 if stat:
54 if stat:
55 result.append((fn, _mode_to_kind(st.st_mode), st))
55 result.append((fn, _mode_to_kind(st.st_mode), st))
General Comments 0
You need to be logged in to leave comments. Login now