hgext/largefiles/overrides.py
changeset 50928 d718eddf01d9
parent 50892 34a27addc286
child 51601 ea3343104f07
equal deleted inserted replaced
50927:7a8ea1397816 50928:d718eddf01d9
  1165     return result
  1165     return result
  1166 
  1166 
  1167 
  1167 
  1168 @eh.wrapcommand(b'rebase', extension=b'rebase')
  1168 @eh.wrapcommand(b'rebase', extension=b'rebase')
  1169 def overriderebasecmd(orig, ui, repo, **opts):
  1169 def overriderebasecmd(orig, ui, repo, **opts):
  1170     if not util.safehasattr(repo, '_largefilesenabled'):
  1170     if not hasattr(repo, '_largefilesenabled'):
  1171         return orig(ui, repo, **opts)
  1171         return orig(ui, repo, **opts)
  1172 
  1172 
  1173     resuming = opts.get('continue')
  1173     resuming = opts.get('continue')
  1174     repo._lfcommithooks.append(lfutil.automatedcommithook(resuming))
  1174     repo._lfcommithooks.append(lfutil.automatedcommithook(resuming))
  1175     repo._lfstatuswriters.append(lambda *msg, **opts: None)
  1175     repo._lfstatuswriters.append(lambda *msg, **opts: None)
  1296             # TODO: Only hgsubrepo instances have `_repo`, so figure out how to
  1296             # TODO: Only hgsubrepo instances have `_repo`, so figure out how to
  1297             # infer and possibly set lfstatus in hgsubrepoarchive.  That would
  1297             # infer and possibly set lfstatus in hgsubrepoarchive.  That would
  1298             # allow only hgsubrepos to set this, instead of the current scheme
  1298             # allow only hgsubrepos to set this, instead of the current scheme
  1299             # where the parent sets this for the child.
  1299             # where the parent sets this for the child.
  1300             with (
  1300             with (
  1301                 util.safehasattr(sub, '_repo')
  1301                 hasattr(sub, '_repo')
  1302                 and lfstatus(sub._repo)
  1302                 and lfstatus(sub._repo)
  1303                 or util.nullcontextmanager()
  1303                 or util.nullcontextmanager()
  1304             ):
  1304             ):
  1305                 sub.archive(archiver, subprefix, submatch)
  1305                 sub.archive(archiver, subprefix, submatch)
  1306 
  1306 
  1307     archiver.done()
  1307     archiver.done()
  1308 
  1308 
  1309 
  1309 
  1310 @eh.wrapfunction(subrepo.hgsubrepo, 'archive')
  1310 @eh.wrapfunction(subrepo.hgsubrepo, 'archive')
  1311 def hgsubrepoarchive(orig, repo, archiver, prefix, match=None, decode=True):
  1311 def hgsubrepoarchive(orig, repo, archiver, prefix, match=None, decode=True):
  1312     lfenabled = util.safehasattr(repo._repo, '_largefilesenabled')
  1312     lfenabled = hasattr(repo._repo, '_largefilesenabled')
  1313     if not lfenabled or not repo._repo.lfstatus:
  1313     if not lfenabled or not repo._repo.lfstatus:
  1314         return orig(repo, archiver, prefix, match, decode)
  1314         return orig(repo, archiver, prefix, match, decode)
  1315 
  1315 
  1316     repo._get(repo._state + (b'hg',))
  1316     repo._get(repo._state + (b'hg',))
  1317     rev = repo._state[1]
  1317     rev = repo._state[1]
  1362         # TODO: Only hgsubrepo instances have `_repo`, so figure out how to
  1362         # TODO: Only hgsubrepo instances have `_repo`, so figure out how to
  1363         # infer and possibly set lfstatus at the top of this function.  That
  1363         # infer and possibly set lfstatus at the top of this function.  That
  1364         # would allow only hgsubrepos to set this, instead of the current scheme
  1364         # would allow only hgsubrepos to set this, instead of the current scheme
  1365         # where the parent sets this for the child.
  1365         # where the parent sets this for the child.
  1366         with (
  1366         with (
  1367             util.safehasattr(sub, '_repo')
  1367             hasattr(sub, '_repo')
  1368             and lfstatus(sub._repo)
  1368             and lfstatus(sub._repo)
  1369             or util.nullcontextmanager()
  1369             or util.nullcontextmanager()
  1370         ):
  1370         ):
  1371             sub.archive(archiver, subprefix, submatch, decode)
  1371             sub.archive(archiver, subprefix, submatch, decode)
  1372 
  1372