##// END OF EJS Templates
subrepo: use vfs.reljoin instead of os.path.join
FUJIWARA Katsunori -
r24675:47e7d5fb default
parent child Browse files
Show More
@@ -509,7 +509,7 b' class abstractsubrepo(object):'
509 flags = self.fileflags(name)
509 flags = self.fileflags(name)
510 mode = 'x' in flags and 0755 or 0644
510 mode = 'x' in flags and 0755 or 0644
511 symlink = 'l' in flags
511 symlink = 'l' in flags
512 archiver.addfile(os.path.join(prefix, self._path, name),
512 archiver.addfile(self.wvfs.reljoin(prefix, self._path, name),
513 mode, symlink, self.filedata(name))
513 mode, symlink, self.filedata(name))
514 self.ui.progress(_('archiving (%s)') % relpath, i + 1,
514 self.ui.progress(_('archiving (%s)') % relpath, i + 1,
515 unit=_('files'), total=total)
515 unit=_('files'), total=total)
@@ -667,8 +667,8 b' class hgsubrepo(abstractsubrepo):'
667 @annotatesubrepoerror
667 @annotatesubrepoerror
668 def add(self, ui, match, prefix, explicitonly, **opts):
668 def add(self, ui, match, prefix, explicitonly, **opts):
669 return cmdutil.add(ui, self._repo, match,
669 return cmdutil.add(ui, self._repo, match,
670 os.path.join(prefix, self._path), explicitonly,
670 self.wvfs.reljoin(prefix, self._path),
671 **opts)
671 explicitonly, **opts)
672
672
673 @annotatesubrepoerror
673 @annotatesubrepoerror
674 def addremove(self, m, prefix, opts, dry_run, similarity):
674 def addremove(self, m, prefix, opts, dry_run, similarity):
@@ -678,7 +678,7 b' class hgsubrepo(abstractsubrepo):'
678 opts = copy.copy(opts)
678 opts = copy.copy(opts)
679 opts['subrepos'] = True
679 opts['subrepos'] = True
680 return scmutil.addremove(self._repo, m,
680 return scmutil.addremove(self._repo, m,
681 os.path.join(prefix, self._path), opts,
681 self.wvfs.reljoin(prefix, self._path), opts,
682 dry_run, similarity)
682 dry_run, similarity)
683
683
684 @annotatesubrepoerror
684 @annotatesubrepoerror
@@ -725,7 +725,7 b' class hgsubrepo(abstractsubrepo):'
725 s = subrepo(ctx, subpath)
725 s = subrepo(ctx, subpath)
726 submatch = matchmod.narrowmatcher(subpath, match)
726 submatch = matchmod.narrowmatcher(subpath, match)
727 total += s.archive(
727 total += s.archive(
728 archiver, os.path.join(prefix, self._path), submatch)
728 archiver, self.wvfs.reljoin(prefix, self._path), submatch)
729 return total
729 return total
730
730
731 @annotatesubrepoerror
731 @annotatesubrepoerror
@@ -909,13 +909,13 b' class hgsubrepo(abstractsubrepo):'
909 @annotatesubrepoerror
909 @annotatesubrepoerror
910 def forget(self, match, prefix):
910 def forget(self, match, prefix):
911 return cmdutil.forget(self.ui, self._repo, match,
911 return cmdutil.forget(self.ui, self._repo, match,
912 os.path.join(prefix, self._path), True)
912 self.wvfs.reljoin(prefix, self._path), True)
913
913
914 @annotatesubrepoerror
914 @annotatesubrepoerror
915 def removefiles(self, matcher, prefix, after, force, subrepos):
915 def removefiles(self, matcher, prefix, after, force, subrepos):
916 return cmdutil.remove(self.ui, self._repo, matcher,
916 return cmdutil.remove(self.ui, self._repo, matcher,
917 os.path.join(prefix, self._path), after, force,
917 self.wvfs.reljoin(prefix, self._path),
918 subrepos)
918 after, force, subrepos)
919
919
920 @annotatesubrepoerror
920 @annotatesubrepoerror
921 def revert(self, substate, *pats, **opts):
921 def revert(self, substate, *pats, **opts):
@@ -981,7 +981,8 b' class svnsubrepo(abstractsubrepo):'
981 cmd.append('--non-interactive')
981 cmd.append('--non-interactive')
982 cmd.extend(commands)
982 cmd.extend(commands)
983 if filename is not None:
983 if filename is not None:
984 path = os.path.join(self._ctx.repo().origroot, self._path, filename)
984 path = self.wvfs.reljoin(self._ctx.repo().origroot,
985 self._path, filename)
985 cmd.append(path)
986 cmd.append(path)
986 env = dict(os.environ)
987 env = dict(os.environ)
987 # Avoid localized output, preserve current locale for everything else.
988 # Avoid localized output, preserve current locale for everything else.
@@ -1663,7 +1664,7 b' class gitsubrepo(abstractsubrepo):'
1663 data = info.linkname
1664 data = info.linkname
1664 else:
1665 else:
1665 data = tar.extractfile(info).read()
1666 data = tar.extractfile(info).read()
1666 archiver.addfile(os.path.join(prefix, self._path, info.name),
1667 archiver.addfile(self.wvfs.reljoin(prefix, self._path, info.name),
1667 info.mode, info.issym(), data)
1668 info.mode, info.issym(), data)
1668 total += 1
1669 total += 1
1669 self.ui.progress(_('archiving (%s)') % relpath, i + 1,
1670 self.ui.progress(_('archiving (%s)') % relpath, i + 1,
@@ -1685,7 +1686,7 b' class gitsubrepo(abstractsubrepo):'
1685 output = self._gitcommand(["show", "%s:%s" % (rev, f)])
1686 output = self._gitcommand(["show", "%s:%s" % (rev, f)])
1686 fp = cmdutil.makefileobj(self._subparent, opts.get('output'),
1687 fp = cmdutil.makefileobj(self._subparent, opts.get('output'),
1687 self._ctx.node(),
1688 self._ctx.node(),
1688 pathname=os.path.join(prefix, f))
1689 pathname=self.wvfs.reljoin(prefix, f))
1689 fp.write(output)
1690 fp.write(output)
1690 fp.close()
1691 fp.close()
1691 return 0
1692 return 0
@@ -1768,7 +1769,7 b' class gitsubrepo(abstractsubrepo):'
1768 # for Git, this also implies '-p'
1769 # for Git, this also implies '-p'
1769 cmd.append('-U%d' % diffopts.context)
1770 cmd.append('-U%d' % diffopts.context)
1770
1771
1771 gitprefix = os.path.join(prefix, self._path)
1772 gitprefix = self.wvfs.reljoin(prefix, self._path)
1772
1773
1773 if diffopts.noprefix:
1774 if diffopts.noprefix:
1774 cmd.extend(['--src-prefix=%s/' % gitprefix,
1775 cmd.extend(['--src-prefix=%s/' % gitprefix,
General Comments 0
You need to be logged in to leave comments. Login now