hgext/largefiles/lfcommands.py
changeset 24788 b8c3a0994b37
parent 24180 d8e0c591781c
child 25325 fcd2f9b06629
equal deleted inserted replaced
24787:9d5c27890790 24788:b8c3a0994b37
   435     if totalmissing > 0:
   435     if totalmissing > 0:
   436         ui.status(_("%d largefiles failed to download\n") % totalmissing)
   436         ui.status(_("%d largefiles failed to download\n") % totalmissing)
   437     return totalsuccess, totalmissing
   437     return totalsuccess, totalmissing
   438 
   438 
   439 def updatelfiles(ui, repo, filelist=None, printmessage=None,
   439 def updatelfiles(ui, repo, filelist=None, printmessage=None,
   440                  normallookup=False, checked=False):
   440                  normallookup=False):
   441     '''Update largefiles according to standins in the working directory
   441     '''Update largefiles according to standins in the working directory
   442 
   442 
   443     If ``printmessage`` is other than ``None``, it means "print (or
   443     If ``printmessage`` is other than ``None``, it means "print (or
   444     ignore, for false) message forcibly".
   444     ignore, for false) message forcibly".
   445     '''
   445     '''
   462                 if (os.path.exists(absstandin + '.orig') and
   462                 if (os.path.exists(absstandin + '.orig') and
   463                     os.path.exists(abslfile)):
   463                     os.path.exists(abslfile)):
   464                     shutil.copyfile(abslfile, abslfile + '.orig')
   464                     shutil.copyfile(abslfile, abslfile + '.orig')
   465                     util.unlinkpath(absstandin + '.orig')
   465                     util.unlinkpath(absstandin + '.orig')
   466                 expecthash = lfutil.readstandin(repo, lfile)
   466                 expecthash = lfutil.readstandin(repo, lfile)
   467                 if (expecthash != '' and
   467                 if expecthash != '':
   468                     (checked or
       
   469                      not os.path.exists(abslfile) or
       
   470                      expecthash != lfutil.hashfile(abslfile))):
       
   471                     if lfile not in repo[None]: # not switched to normal file
   468                     if lfile not in repo[None]: # not switched to normal file
   472                         util.unlinkpath(abslfile, ignoremissing=True)
   469                         util.unlinkpath(abslfile, ignoremissing=True)
   473                     # use normallookup() to allocate an entry in largefiles
   470                     # use normallookup() to allocate an entry in largefiles
   474                     # dirstate to prevent lfilesrepo.status() from reporting
   471                     # dirstate to prevent lfilesrepo.status() from reporting
   475                     # missing files as removed.
   472                     # missing files as removed.