comparison mercurial/subrepo.py @ 41642:3d9d5e612e67

subrepo: adjust subrepo prefix before calling subrepo.archive() (API) Differential Revision: https://phab.mercurial-scm.org/D5887
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 07 Feb 2019 10:20:57 -0800
parents 3d094bfaf885
children d8cdd5320f75
comparison
equal deleted inserted replaced
41641:3d094bfaf885 41642:3d9d5e612e67
341 progress.update(0) 341 progress.update(0)
342 for name in files: 342 for name in files:
343 flags = self.fileflags(name) 343 flags = self.fileflags(name)
344 mode = 'x' in flags and 0o755 or 0o644 344 mode = 'x' in flags and 0o755 or 0o644
345 symlink = 'l' in flags 345 symlink = 'l' in flags
346 archiver.addfile(prefix + self._path + '/' + name, 346 archiver.addfile(prefix + name, mode, symlink,
347 mode, symlink, self.filedata(name, decode)) 347 self.filedata(name, decode))
348 progress.increment() 348 progress.increment()
349 progress.complete() 349 progress.complete()
350 return total 350 return total
351 351
352 def walk(self, match): 352 def walk(self, match):
574 scmutil.matchfiles(self._repo, files)) 574 scmutil.matchfiles(self._repo, files))
575 total = abstractsubrepo.archive(self, archiver, prefix, match) 575 total = abstractsubrepo.archive(self, archiver, prefix, match)
576 for subpath in ctx.substate: 576 for subpath in ctx.substate:
577 s = subrepo(ctx, subpath, True) 577 s = subrepo(ctx, subpath, True)
578 submatch = matchmod.subdirmatcher(subpath, match) 578 submatch = matchmod.subdirmatcher(subpath, match)
579 total += s.archive(archiver, prefix + self._path + '/', submatch, 579 subprefix = prefix + subpath + '/'
580 total += s.archive(archiver, subprefix, submatch,
580 decode) 581 decode)
581 return total 582 return total
582 583
583 @annotatesubrepoerror 584 @annotatesubrepoerror
584 def dirty(self, ignoreupdate=False, missing=False): 585 def dirty(self, ignoreupdate=False, missing=False):
1671 continue 1672 continue
1672 if info.issym(): 1673 if info.issym():
1673 data = info.linkname 1674 data = info.linkname
1674 else: 1675 else:
1675 data = tar.extractfile(info).read() 1676 data = tar.extractfile(info).read()
1676 archiver.addfile(prefix + self._path + '/' + bname, 1677 archiver.addfile(prefix + bname, info.mode, info.issym(), data)
1677 info.mode, info.issym(), data)
1678 total += 1 1678 total += 1
1679 progress.increment() 1679 progress.increment()
1680 progress.complete() 1680 progress.complete()
1681 return total 1681 return total
1682 1682