hgext/largefiles/lfcommands.py
changeset 21242 4c94229c51fb
parent 21088 e095626e8676
child 21689 503bb3af70fe
equal deleted inserted replaced
21241:244b177a152e 21242:4c94229c51fb
    19 import lfutil
    19 import lfutil
    20 import basestore
    20 import basestore
    21 
    21 
    22 # -- Commands ----------------------------------------------------------
    22 # -- Commands ----------------------------------------------------------
    23 
    23 
       
    24 cmdtable = {}
       
    25 command = cmdutil.command(cmdtable)
       
    26 
       
    27 commands.inferrepo += " lfconvert"
       
    28 
       
    29 @command('lfconvert',
       
    30     [('s', 'size', '',
       
    31       _('minimum size (MB) for files to be converted as largefiles'), 'SIZE'),
       
    32     ('', 'to-normal', False,
       
    33      _('convert from a largefiles repo to a normal repo')),
       
    34     ],
       
    35     _('hg lfconvert SOURCE DEST [FILE ...]'))
    24 def lfconvert(ui, src, dest, *pats, **opts):
    36 def lfconvert(ui, src, dest, *pats, **opts):
    25     '''convert a normal repository to a largefiles repository
    37     '''convert a normal repository to a largefiles repository
    26 
    38 
    27     Convert repository SOURCE to a new repository DEST, identical to
    39     Convert repository SOURCE to a new repository DEST, identical to
    28     SOURCE except that certain files will be converted as largefiles:
    40     SOURCE except that certain files will be converted as largefiles:
   517             ui.status(_('%d largefiles updated, %d removed\n') % (updated,
   529             ui.status(_('%d largefiles updated, %d removed\n') % (updated,
   518                 removed))
   530                 removed))
   519     finally:
   531     finally:
   520         wlock.release()
   532         wlock.release()
   521 
   533 
       
   534 @command('lfpull',
       
   535     [('r', 'rev', [], _('pull largefiles for these revisions'))
       
   536     ] + commands.remoteopts,
       
   537     _('-r REV... [-e CMD] [--remotecmd CMD] [SOURCE]'))
   522 def lfpull(ui, repo, source="default", **opts):
   538 def lfpull(ui, repo, source="default", **opts):
   523     """pull largefiles for the specified revisions from the specified source
   539     """pull largefiles for the specified revisions from the specified source
   524 
   540 
   525     Pull largefiles that are referenced from local changesets but missing
   541     Pull largefiles that are referenced from local changesets but missing
   526     locally, pulling from a remote repository to the local cache.
   542     locally, pulling from a remote repository to the local cache.
   551     for rev in revs:
   567     for rev in revs:
   552         ui.note(_('pulling largefiles for revision %s\n') % rev)
   568         ui.note(_('pulling largefiles for revision %s\n') % rev)
   553         (cached, missing) = cachelfiles(ui, repo, rev)
   569         (cached, missing) = cachelfiles(ui, repo, rev)
   554         numcached += len(cached)
   570         numcached += len(cached)
   555     ui.status(_("%d largefiles cached\n") % numcached)
   571     ui.status(_("%d largefiles cached\n") % numcached)
   556 
       
   557 # -- hg commands declarations ------------------------------------------------
       
   558 
       
   559 cmdtable = {
       
   560     'lfconvert': (lfconvert,
       
   561                   [('s', 'size', '',
       
   562                     _('minimum size (MB) for files to be converted '
       
   563                       'as largefiles'),
       
   564                     'SIZE'),
       
   565                   ('', 'to-normal', False,
       
   566                    _('convert from a largefiles repo to a normal repo')),
       
   567                   ],
       
   568                   _('hg lfconvert SOURCE DEST [FILE ...]')),
       
   569     'lfpull': (lfpull,
       
   570                [('r', 'rev', [], _('pull largefiles for these revisions'))
       
   571                 ] +  commands.remoteopts,
       
   572                _('-r REV... [-e CMD] [--remotecmd CMD] [SOURCE]')
       
   573                ),
       
   574     }
       
   575 
       
   576 commands.inferrepo += " lfconvert"