hgext/shelve.py
changeset 37084 f0b6fbea00cf
parent 36781 ffa3026d4196
child 37603 678d760c71ff
equal deleted inserted replaced
37083:f99d64e8a4e4 37084:f0b6fbea00cf
    54 )
    54 )
    55 
    55 
    56 from . import (
    56 from . import (
    57     rebase,
    57     rebase,
    58 )
    58 )
    59 from mercurial.utils import dateutil
    59 from mercurial.utils import (
       
    60     dateutil,
       
    61     stringutil,
       
    62 )
    60 
    63 
    61 cmdtable = {}
    64 cmdtable = {}
    62 command = registrar.command(cmdtable)
    65 command = registrar.command(cmdtable)
    63 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
    66 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
    64 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
    67 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
   475             return 1
   478             return 1
   476 
   479 
   477         _shelvecreatedcommit(repo, node, name)
   480         _shelvecreatedcommit(repo, node, name)
   478 
   481 
   479         if ui.formatted():
   482         if ui.formatted():
   480             desc = util.ellipsis(desc, ui.termwidth())
   483             desc = stringutil.ellipsis(desc, ui.termwidth())
   481         ui.status(_('shelved as %s\n') % name)
   484         ui.status(_('shelved as %s\n') % name)
   482         hg.update(repo, parent.node())
   485         hg.update(repo, parent.node())
   483         if origbranch != repo['.'].branch() and not _isbareshelve(pats, opts):
   486         if origbranch != repo['.'].branch() and not _isbareshelve(pats, opts):
   484             repo.dirstate.setbranch(origbranch)
   487             repo.dirstate.setbranch(origbranch)
   485 
   488 
   576                 if not line:
   579                 if not line:
   577                     break
   580                     break
   578                 if not line.startswith('#'):
   581                 if not line.startswith('#'):
   579                     desc = line.rstrip()
   582                     desc = line.rstrip()
   580                     if ui.formatted():
   583                     if ui.formatted():
   581                         desc = util.ellipsis(desc, width - used)
   584                         desc = stringutil.ellipsis(desc, width - used)
   582                     ui.write(desc)
   585                     ui.write(desc)
   583                     break
   586                     break
   584             ui.write('\n')
   587             ui.write('\n')
   585             if not (opts['patch'] or opts['stat']):
   588             if not (opts['patch'] or opts['stat']):
   586                 continue
   589                 continue