##// END OF EJS Templates
subrepo: avoid sanitizing ".hg/hgrc" in meta data area for non-hg subrepos...
FUJIWARA Katsunori -
r21567:5900bc09 stable
parent child Browse files
Show More
@@ -314,8 +314,12 b' def _abssource(repo, push=False, abort=T'
314 if abort:
314 if abort:
315 raise util.Abort(_("default path for subrepository not found"))
315 raise util.Abort(_("default path for subrepository not found"))
316
316
317 def _sanitize(ui, path):
317 def _sanitize(ui, path, ignore):
318 for dirname, dirs, names in os.walk(path):
318 for dirname, dirs, names in os.walk(path):
319 for i, d in enumerate(dirs):
320 if d.lower() == ignore:
321 del dirs[i]
322 break
319 if os.path.basename(dirname).lower() != '.hg':
323 if os.path.basename(dirname).lower() != '.hg':
320 continue
324 continue
321 for f in names:
325 for f in names:
@@ -1050,7 +1054,7 b' class svnsubrepo(abstractsubrepo):'
1050 # update to a directory which has since been deleted and recreated.
1054 # update to a directory which has since been deleted and recreated.
1051 args.append('%s@%s' % (state[0], state[1]))
1055 args.append('%s@%s' % (state[0], state[1]))
1052 status, err = self._svncommand(args, failok=True)
1056 status, err = self._svncommand(args, failok=True)
1053 _sanitize(self._ui, self._ctx._repo.wjoin(self._path))
1057 _sanitize(self._ui, self._ctx._repo.wjoin(self._path), '.svn')
1054 if not re.search('Checked out revision [0-9]+.', status):
1058 if not re.search('Checked out revision [0-9]+.', status):
1055 if ('is already a working copy for a different URL' in err
1059 if ('is already a working copy for a different URL' in err
1056 and (self._wcchanged()[:2] == (False, False))):
1060 and (self._wcchanged()[:2] == (False, False))):
@@ -1343,7 +1347,7 b' class gitsubrepo(abstractsubrepo):'
1343 self._gitcommand(['reset', 'HEAD'])
1347 self._gitcommand(['reset', 'HEAD'])
1344 cmd.append('-f')
1348 cmd.append('-f')
1345 self._gitcommand(cmd + args)
1349 self._gitcommand(cmd + args)
1346 _sanitize(self._ui, self._abspath)
1350 _sanitize(self._ui, self._abspath, '.git')
1347
1351
1348 def rawcheckout():
1352 def rawcheckout():
1349 # no branch to checkout, check it out with no branch
1353 # no branch to checkout, check it out with no branch
@@ -1392,7 +1396,7 b' class gitsubrepo(abstractsubrepo):'
1392 if tracking[remote] != self._gitcurrentbranch():
1396 if tracking[remote] != self._gitcurrentbranch():
1393 checkout([tracking[remote]])
1397 checkout([tracking[remote]])
1394 self._gitcommand(['merge', '--ff', remote])
1398 self._gitcommand(['merge', '--ff', remote])
1395 _sanitize(self._ui, self._abspath)
1399 _sanitize(self._ui, self._abspath, '.git')
1396 else:
1400 else:
1397 # a real merge would be required, just checkout the revision
1401 # a real merge would be required, just checkout the revision
1398 rawcheckout()
1402 rawcheckout()
@@ -1428,7 +1432,7 b' class gitsubrepo(abstractsubrepo):'
1428 self.get(state) # fast forward merge
1432 self.get(state) # fast forward merge
1429 elif base != self._state[1]:
1433 elif base != self._state[1]:
1430 self._gitcommand(['merge', '--no-commit', revision])
1434 self._gitcommand(['merge', '--no-commit', revision])
1431 _sanitize(self._ui, self._abspath)
1435 _sanitize(self._ui, self._abspath, '.git')
1432
1436
1433 if self.dirty():
1437 if self.dirty():
1434 if self._gitstate() != revision:
1438 if self._gitstate() != revision:
@@ -658,4 +658,13 b' additional test for "git merge --ff" rou'
658 $ cat s/sub/.hg/hgrc
658 $ cat s/sub/.hg/hgrc
659 cat: s/sub/.hg/hgrc: No such file or directory
659 cat: s/sub/.hg/hgrc: No such file or directory
660 [1]
660 [1]
661
662 Test that sanitizing is omitted in meta data area:
663
664 $ mkdir s/.git/.hg
665 $ echo '.hg/hgrc in git metadata area' > s/.git/.hg/hgrc
666 $ hg update -q -C af6d2edbb0d3
667 checking out detached HEAD in subrepo s
668 check out a git branch if you intend to make changes
669
661 $ cd ..
670 $ cd ..
@@ -676,4 +676,10 b' Test sanitizing ".hg/hgrc" in subrepo'
676 cat: s/sub/.hg/hgrc: No such file or directory
676 cat: s/sub/.hg/hgrc: No such file or directory
677 [1]
677 [1]
678
678
679 Test that sanitizing is omitted in meta data area:
680
681 $ mkdir s/.svn/.hg
682 $ echo '.hg/hgrc in svn metadata area' > s/.svn/.hg/hgrc
683 $ hg update -q -C '.^1'
684
679 $ cd ../..
685 $ cd ../..
General Comments 0
You need to be logged in to leave comments. Login now