hgext/largefiles/overrides.py
changeset 18979 1176832fc757
parent 18978 8abaadab9abb
child 18980 9717a326d270
equal deleted inserted replaced
18978:8abaadab9abb 18979:1176832fc757
   754             revs.append(repo[rev].rev())
   754             revs.append(repo[rev].rev())
   755         lfcommands.downloadlfiles(ui, repo, revs)
   755         lfcommands.downloadlfiles(ui, repo, revs)
   756     lfrevs = opts.get('lfrev', [])
   756     lfrevs = opts.get('lfrev', [])
   757     if lfrevs and revspostpull > revsprepull:
   757     if lfrevs and revspostpull > revsprepull:
   758         numcached = 0
   758         numcached = 0
   759         for rev in scmutil.revrange(repo, lfrevs):
   759         repo.firstpulled = revsprepull # for pulled() revset expression
   760             ui.note(_('pulling largefiles for revision %s\n') % rev)
   760         try:
   761             (cached, missing) = lfcommands.cachelfiles(ui, repo, rev)
   761             for rev in scmutil.revrange(repo, lfrevs):
   762             numcached += len(cached)
   762                 ui.note(_('pulling largefiles for revision %s\n') % rev)
       
   763                 (cached, missing) = lfcommands.cachelfiles(ui, repo, rev)
       
   764                 numcached += len(cached)
       
   765         finally:
       
   766             del repo.firstpulled
   763         ui.status(_("%d largefiles cached\n") % numcached)
   767         ui.status(_("%d largefiles cached\n") % numcached)
   764     return result
   768     return result
       
   769 
       
   770 def pulledrevsetsymbol(repo, subset, x):
       
   771     """``pulled()``
       
   772     Changesets that just has been pulled.
       
   773 
       
   774     Only available with largefiles from pull --lfrev expressions.
       
   775 
       
   776     .. container:: verbose
       
   777 
       
   778       Some examples:
       
   779 
       
   780       - pull largefiles for all new changesets::
       
   781 
       
   782           hg pull -lfrev "pulled()"
       
   783 
       
   784       - pull largefiles for all new branch heads::
       
   785 
       
   786           hg pull -lfrev "head(pulled()) and not closed()"
       
   787 
       
   788     """
       
   789 
       
   790     try:
       
   791         firstpulled = repo.firstpulled
       
   792     except AttributeError:
       
   793         raise util.Abort(_("pulled() only available in --lfrev"))
       
   794     return [r for r in subset if r >= firstpulled]
   765 
   795 
   766 def overrideclone(orig, ui, source, dest=None, **opts):
   796 def overrideclone(orig, ui, source, dest=None, **opts):
   767     d = dest
   797     d = dest
   768     if d is None:
   798     if d is None:
   769         d = hg.defaultdest(source)
   799         d = hg.defaultdest(source)