hgext/largefiles/lfcommands.py
changeset 23189 fb139f5553d6
parent 23139 e53f6b72a0e4
child 23276 4be754832829
equal deleted inserted replaced
23188:94ac64bcf6fe 23189:fb139f5553d6
   433     ui.status(_("%d additional largefiles cached\n") % totalsuccess)
   433     ui.status(_("%d additional largefiles cached\n") % totalsuccess)
   434     if totalmissing > 0:
   434     if totalmissing > 0:
   435         ui.status(_("%d largefiles failed to download\n") % totalmissing)
   435         ui.status(_("%d largefiles failed to download\n") % totalmissing)
   436     return totalsuccess, totalmissing
   436     return totalsuccess, totalmissing
   437 
   437 
   438 def updatelfiles(ui, repo, filelist=None, printmessage=True,
   438 def updatelfiles(ui, repo, filelist=None, printmessage=None,
   439                  normallookup=False):
   439                  normallookup=False):
       
   440     '''Update largefiles according to standins in the working directory
       
   441 
       
   442     If ``printmessage`` is other than ``None``, it means "print (or
       
   443     ignore, for false) message forcibly".
       
   444     '''
       
   445     statuswriter = lfutil.getstatuswriter(ui, repo, printmessage)
   440     wlock = repo.wlock()
   446     wlock = repo.wlock()
   441     try:
   447     try:
   442         lfdirstate = lfutil.openlfdirstate(ui, repo)
   448         lfdirstate = lfutil.openlfdirstate(ui, repo)
   443         lfiles = set(lfutil.listlfiles(repo)) | set(lfdirstate)
   449         lfiles = set(lfutil.listlfiles(repo)) | set(lfdirstate)
   444 
   450 
   480 
   486 
   481         # largefile processing might be slow and be interrupted - be prepared
   487         # largefile processing might be slow and be interrupted - be prepared
   482         lfdirstate.write()
   488         lfdirstate.write()
   483 
   489 
   484         if lfiles:
   490         if lfiles:
   485             if printmessage:
   491             statuswriter(_('getting changed largefiles\n'))
   486                 ui.status(_('getting changed largefiles\n'))
       
   487             cachelfiles(ui, repo, None, lfiles)
   492             cachelfiles(ui, repo, None, lfiles)
   488 
   493 
   489         for lfile in lfiles:
   494         for lfile in lfiles:
   490             update1 = 0
   495             update1 = 0
   491 
   496 
   525             for lfile in lfdirstate:
   530             for lfile in lfdirstate:
   526                 if lfile not in filelist:
   531                 if lfile not in filelist:
   527                     lfutil.synclfdirstate(repo, lfdirstate, lfile, True)
   532                     lfutil.synclfdirstate(repo, lfdirstate, lfile, True)
   528 
   533 
   529         lfdirstate.write()
   534         lfdirstate.write()
   530         if printmessage and lfiles:
   535         if lfiles:
   531             ui.status(_('%d largefiles updated, %d removed\n') % (updated,
   536             statuswriter(_('%d largefiles updated, %d removed\n') % (updated,
   532                 removed))
   537                 removed))
   533     finally:
   538     finally:
   534         wlock.release()
   539         wlock.release()
   535 
   540 
   536 @command('lfpull',
   541 @command('lfpull',