hgext/keyword.py
changeset 6051 1038b1458d7a
parent 6050 adf73753eb7d
child 6052 75425961e955
equal deleted inserted replaced
6050:adf73753eb7d 6051:1038b1458d7a
    86 
    86 
    87 commands.optionalrepo += ' kwdemo'
    87 commands.optionalrepo += ' kwdemo'
    88 
    88 
    89 # hg commands that do not act on keywords
    89 # hg commands that do not act on keywords
    90 nokwcommands = ('add addremove bundle copy export grep identify incoming init'
    90 nokwcommands = ('add addremove bundle copy export grep identify incoming init'
    91                 ' log outgoing push remove rename rollback tip convert')
    91                 ' log outgoing push remove rename rollback tip convert email')
    92 
    92 
    93 # hg commands that trigger expansion only when writing to working dir,
    93 # hg commands that trigger expansion only when writing to working dir,
    94 # not when reading filelog, and unexpand when reading from working dir
    94 # not when reading filelog, and unexpand when reading from working dir
    95 restricted = 'diff1 record qfold qimport qnew qpush qrefresh qrecord'
    95 restricted = 'diff1 record qfold qimport qnew qpush qrefresh qrecord'
    96 
    96 
   408     Wraps commit to overwrite configured files with updated
   408     Wraps commit to overwrite configured files with updated
   409     keyword substitutions.
   409     keyword substitutions.
   410     This is done for local repos only, and only if there are
   410     This is done for local repos only, and only if there are
   411     files configured at all for keyword substitution.'''
   411     files configured at all for keyword substitution.'''
   412 
   412 
   413     if not repo.local():
   413     try:
   414         return
   414         if (not repo.local() or '.hg' in repo.root.split('/')
       
   415             or repo._url.startswith('bundle:')):
       
   416             return
       
   417     except AttributeError:
       
   418         pass
   415 
   419 
   416     hgcmd, func, args, opts, cmdopts = dispatch._parse(ui, sys.argv[1:])
   420     hgcmd, func, args, opts, cmdopts = dispatch._parse(ui, sys.argv[1:])
   417     if hgcmd in nokwcommands.split():
   421     if hgcmd in nokwcommands.split():
   418         return
   422         return
   419 
   423 
   424             return
   428             return
   425         # shrink if rev is not current node
   429         # shrink if rev is not current node
   426         if node1 is not None and node1 != repo.changectx().node():
   430         if node1 is not None and node1 != repo.changectx().node():
   427             hgcmd = 'diff1'
   431             hgcmd = 'diff1'
   428 
   432 
   429     inc, exc = [], ['.hgtags']
   433     inc, exc = [], ['.hg*']
   430     for pat, opt in ui.configitems('keyword'):
   434     for pat, opt in ui.configitems('keyword'):
   431         if opt != 'ignore':
   435         if opt != 'ignore':
   432             inc.append(pat)
   436             inc.append(pat)
   433         else:
   437         else:
   434             exc.append(pat)
   438             exc.append(pat)