hgext/largefiles/lfcommands.py
changeset 15170 c1a4a3220711
parent 15168 cfccd3bee7b3
child 15171 547da6115d1d
equal deleted inserted replaced
15169:aa262fff87ac 15170:c1a4a3220711
    37         if not size:
    37         if not size:
    38             size = ui.config(lfutil.longname, 'size', default=None)
    38             size = ui.config(lfutil.longname, 'size', default=None)
    39             try:
    39             try:
    40                 size = int(size)
    40                 size = int(size)
    41             except ValueError:
    41             except ValueError:
    42                 raise util.Abort(_('largefiles.size must be integer, was %s\n') % \
    42                 raise util.Abort(_('largefiles.size must be integer, was %s\n')
    43                     size)
    43                                  % size)
    44             except TypeError:
    44             except TypeError:
    45                 raise util.Abort(_('size must be specified'))
    45                 raise util.Abort(_('size must be specified'))
    46 
    46 
    47     try:
    47     try:
    48         rsrc = hg.repository(ui, src)
    48         rsrc = hg.repository(ui, src)
   230                 renamedlfile = renamed and renamed[0] in lfiles
   230                 renamedlfile = renamed and renamed[0] in lfiles
   231                 islfile |= renamedlfile
   231                 islfile |= renamedlfile
   232                 if 'l' in fctx.flags():
   232                 if 'l' in fctx.flags():
   233                     if renamedlfile:
   233                     if renamedlfile:
   234                         raise util.Abort(
   234                         raise util.Abort(
   235                             _('Renamed/copied largefile %s becomes symlink') % f)
   235                             _('Renamed/copied largefile %s becomes symlink')
       
   236                             % f)
   236                     islfile = False
   237                     islfile = False
   237             if islfile:
   238             if islfile:
   238                 lfiles.add(f)
   239                 lfiles.add(f)
   239             else:
   240             else:
   240                 normalfiles.add(f)
   241                 normalfiles.add(f)
   339     store = basestore._openstore(rsrc, rdst, put=True)
   340     store = basestore._openstore(rsrc, rdst, put=True)
   340 
   341 
   341     at = 0
   342     at = 0
   342     files = filter(lambda h: not store.exists(h), files)
   343     files = filter(lambda h: not store.exists(h), files)
   343     for hash in files:
   344     for hash in files:
   344         ui.progress(_('uploading largefiles'), at, unit='largefile', total=len(files))
   345         ui.progress(_('uploading largefiles'), at, unit='largefile',
       
   346                     total=len(files))
   345         source = lfutil.findfile(rsrc, hash)
   347         source = lfutil.findfile(rsrc, hash)
   346         if not source:
   348         if not source:
   347             raise util.Abort(_('Missing largefile %s needs to be uploaded') % hash)
   349             raise util.Abort(_('Missing largefile %s needs to be uploaded')
       
   350                              % hash)
   348         # XXX check for errors here
   351         # XXX check for errors here
   349         store.put(source, hash)
   352         store.put(source, hash)
   350         at += 1
   353         at += 1
   351     ui.progress('uploading largefiles', None)
   354     ui.progress('uploading largefiles', None)
   352 
   355 
   473 
   476 
   474 
   477 
   475 cmdtable = {
   478 cmdtable = {
   476     'lfconvert': (lfconvert,
   479     'lfconvert': (lfconvert,
   477                   [('s', 'size', 0, 'All files over this size (in megabytes) '
   480                   [('s', 'size', 0, 'All files over this size (in megabytes) '
   478                   'will be considered largefiles. This can also be specified in '
   481                   'will be considered largefiles. This can also be specified '
   479                   'your hgrc as [largefiles].size.'),
   482                   'in your hgrc as [largefiles].size.'),
   480                   ('','tonormal',False,
   483                   ('','tonormal',False,
   481                       'Convert from a largefiles repo to a normal repo')],
   484                       'Convert from a largefiles repo to a normal repo')],
   482                   _('hg lfconvert SOURCE DEST [FILE ...]')),
   485                   _('hg lfconvert SOURCE DEST [FILE ...]')),
   483     }
   486     }