equal
deleted
inserted
replaced
42 ) |
42 ) |
43 from .utils import ( |
43 from .utils import ( |
44 dateutil, |
44 dateutil, |
45 hashutil, |
45 hashutil, |
46 procutil, |
46 procutil, |
|
47 urlutil, |
47 ) |
48 ) |
48 |
49 |
49 hg = None |
50 hg = None |
50 reporelpath = subrepoutil.reporelpath |
51 reporelpath = subrepoutil.reporelpath |
51 subrelpath = subrepoutil.subrelpath |
52 subrelpath = subrepoutil.subrelpath |
55 |
56 |
56 def _expandedabspath(path): |
57 def _expandedabspath(path): |
57 """ |
58 """ |
58 get a path or url and if it is a path expand it and return an absolute path |
59 get a path or url and if it is a path expand it and return an absolute path |
59 """ |
60 """ |
60 expandedpath = util.urllocalpath(util.expandpath(path)) |
61 expandedpath = urlutil.urllocalpath(util.expandpath(path)) |
61 u = util.url(expandedpath) |
62 u = urlutil.url(expandedpath) |
62 if not u.scheme: |
63 if not u.scheme: |
63 path = util.normpath(os.path.abspath(u.path)) |
64 path = util.normpath(os.path.abspath(u.path)) |
64 return path |
65 return path |
65 |
66 |
66 |
67 |
743 else: |
744 else: |
744 shareopts = {} |
745 shareopts = {} |
745 |
746 |
746 self.ui.status( |
747 self.ui.status( |
747 _(b'cloning subrepo %s from %s\n') |
748 _(b'cloning subrepo %s from %s\n') |
748 % (subrelpath(self), util.hidepassword(srcurl)) |
749 % (subrelpath(self), urlutil.hidepassword(srcurl)) |
749 ) |
750 ) |
750 peer = getpeer() |
751 peer = getpeer() |
751 try: |
752 try: |
752 other, cloned = hg.clone( |
753 other, cloned = hg.clone( |
753 self._repo._subparent.baseui, |
754 self._repo._subparent.baseui, |
763 self._initrepo(parentrepo, source, create=True) |
764 self._initrepo(parentrepo, source, create=True) |
764 self._cachestorehash(srcurl) |
765 self._cachestorehash(srcurl) |
765 else: |
766 else: |
766 self.ui.status( |
767 self.ui.status( |
767 _(b'pulling subrepo %s from %s\n') |
768 _(b'pulling subrepo %s from %s\n') |
768 % (subrelpath(self), util.hidepassword(srcurl)) |
769 % (subrelpath(self), urlutil.hidepassword(srcurl)) |
769 ) |
770 ) |
770 cleansub = self.storeclean(srcurl) |
771 cleansub = self.storeclean(srcurl) |
771 peer = getpeer() |
772 peer = getpeer() |
772 try: |
773 try: |
773 exchange.pull(self._repo, peer) |
774 exchange.pull(self._repo, peer) |
847 dsturl = _abssource(self._repo, True) |
848 dsturl = _abssource(self._repo, True) |
848 if not force: |
849 if not force: |
849 if self.storeclean(dsturl): |
850 if self.storeclean(dsturl): |
850 self.ui.status( |
851 self.ui.status( |
851 _(b'no changes made to subrepo %s since last push to %s\n') |
852 _(b'no changes made to subrepo %s since last push to %s\n') |
852 % (subrelpath(self), util.hidepassword(dsturl)) |
853 % (subrelpath(self), urlutil.hidepassword(dsturl)) |
853 ) |
854 ) |
854 return None |
855 return None |
855 self.ui.status( |
856 self.ui.status( |
856 _(b'pushing subrepo %s to %s\n') |
857 _(b'pushing subrepo %s to %s\n') |
857 % (subrelpath(self), util.hidepassword(dsturl)) |
858 % (subrelpath(self), urlutil.hidepassword(dsturl)) |
858 ) |
859 ) |
859 other = hg.peer(self._repo, {b'ssh': ssh}, dsturl) |
860 other = hg.peer(self._repo, {b'ssh': ssh}, dsturl) |
860 try: |
861 try: |
861 res = exchange.push(self._repo, other, force, newbranch=newbranch) |
862 res = exchange.push(self._repo, other, force, newbranch=newbranch) |
862 finally: |
863 finally: |
1282 # The revision must be specified at the end of the URL to properly |
1283 # The revision must be specified at the end of the URL to properly |
1283 # update to a directory which has since been deleted and recreated. |
1284 # update to a directory which has since been deleted and recreated. |
1284 args.append(b'%s@%s' % (state[0], state[1])) |
1285 args.append(b'%s@%s' % (state[0], state[1])) |
1285 |
1286 |
1286 # SEC: check that the ssh url is safe |
1287 # SEC: check that the ssh url is safe |
1287 util.checksafessh(state[0]) |
1288 urlutil.checksafessh(state[0]) |
1288 |
1289 |
1289 status, err = self._svncommand(args, failok=True) |
1290 status, err = self._svncommand(args, failok=True) |
1290 _sanitize(self.ui, self.wvfs, b'.svn') |
1291 _sanitize(self.ui, self.wvfs, b'.svn') |
1291 if not re.search(b'Checked out revision [0-9]+.', status): |
1292 if not re.search(b'Checked out revision [0-9]+.', status): |
1292 if b'is already a working copy for a different URL' in err and ( |
1293 if b'is already a working copy for a different URL' in err and ( |
1580 return _abssource(self) |
1581 return _abssource(self) |
1581 |
1582 |
1582 def _fetch(self, source, revision): |
1583 def _fetch(self, source, revision): |
1583 if self._gitmissing(): |
1584 if self._gitmissing(): |
1584 # SEC: check for safe ssh url |
1585 # SEC: check for safe ssh url |
1585 util.checksafessh(source) |
1586 urlutil.checksafessh(source) |
1586 |
1587 |
1587 source = self._abssource(source) |
1588 source = self._abssource(source) |
1588 self.ui.status( |
1589 self.ui.status( |
1589 _(b'cloning subrepo %s from %s\n') % (self._relpath, source) |
1590 _(b'cloning subrepo %s from %s\n') % (self._relpath, source) |
1590 ) |
1591 ) |