mercurial/localrepo.py
changeset 10651 5f091fc1bab7
parent 10547 bae9bb09166b
child 10699 7b0a0d498cc0
equal deleted inserted replaced
10650:9ea7238ad935 10651:5f091fc1bab7
     9 from i18n import _
     9 from i18n import _
    10 import repo, changegroup, subrepo
    10 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
    20 
    20 
    21 class localrepository(repo.repository):
    21 class localrepository(repo.repository):
   205         writetags(fp, names, encoding.fromlocal, prevtags)
   205         writetags(fp, names, encoding.fromlocal, prevtags)
   206 
   206 
   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:
   214             self.hook('tag', node=hex(node), tag=name, local=local)
   214             self.hook('tag', node=hex(node), tag=name, local=local)
   215 
   215 
   266         # quo fine?
   266         # quo fine?
   267 
   267 
   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
   276         # writing to the cache), but the rest of Mercurial wants them in
   276         # writing to the cache), but the rest of Mercurial wants them in
   277         # local encoding.
   277         # local encoding.
   501         if filter not in self.filterpats:
   501         if filter not in self.filterpats:
   502             l = []
   502             l = []
   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():
   510                     if cmd.startswith(name):
   510                     if cmd.startswith(name):
   511                         fn = filterfn
   511                         fn = filterfn
   765 
   765 
   766         def fail(f, msg):
   766         def fail(f, msg):
   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 = []
   774             match.dir = vdirs.append
   774             match.dir = vdirs.append
   775             match.bad = fail
   775             match.bad = fail
   822             if (not force and not extra.get("close") and p2 == nullid
   822             if (not force and not extra.get("close") and p2 == nullid
   823                 and not (changes[0] or changes[1] or changes[2])
   823                 and not (changes[0] or changes[1] or changes[2])
   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 "
   831                                                     "(see hg resolve)"))
   831                                                     "(see hg resolve)"))
   832 
   832 
   994         else:
   994         else:
   995             ctx2 = self[node2]
   995             ctx2 = self[node2]
   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
  1003         if not working and ctx2.rev() < ctx1.rev():
  1003         if not working and ctx2.rev() < ctx1.rev():
  1004             ctx2.manifest()
  1004             ctx2.manifest()