comparison hgsubversion/svnexternals.py @ 1119:2efc4abd4602

svnexternals: remove pre-1.9 pegrev code
author Sean Farley <sean.michael.farley@gmail.com>
date Fri, 06 Sep 2013 19:22:39 -0500
parents 5490194e688e
children 9d5cff8d7f67
comparison
equal deleted inserted replaced
1118:5490194e688e 1119:2efc4abd4602
3 import os, re, shutil, stat, subprocess 3 import os, re, shutil, stat, subprocess
4 from mercurial import util as hgutil 4 from mercurial import util as hgutil
5 from mercurial.i18n import _ 5 from mercurial.i18n import _
6 from mercurial import subrepo 6 from mercurial import subrepo
7 7
8 passpegrev = True # see svnsubrepo below
9 try: 8 try:
10 canonpath = hgutil.canonpath 9 from mercurial import scmutil
10 canonpath = scmutil.canonpath
11 except (ImportError, AttributeError): 11 except (ImportError, AttributeError):
12 passpegrev = False 12 from mercurial import pathutil
13 try: 13 canonpath = pathutil.canonpath
14 from mercurial import scmutil
15 canonpath = scmutil.canonpath
16 except (ImportError, AttributeError):
17 from mercurial import pathutil
18 canonpath = pathutil.canonpath
19 14
20 import util 15 import util
21 16
22 class externalsfile(dict): 17 class externalsfile(dict):
23 """Map svn directories to lists of externals entries. 18 """Map svn directories to lists of externals entries.
406 source = resolvesource(self._ui, None, source) 401 source = resolvesource(self._ui, None, source)
407 except RelativeSourceError: 402 except RelativeSourceError:
408 svnurl = self._ctx._repo.ui.expandpath('default') 403 svnurl = self._ctx._repo.ui.expandpath('default')
409 svnroot = getsvninfo(util.normalize_url(svnurl))[1] 404 svnroot = getsvninfo(util.normalize_url(svnurl))[1]
410 source = resolvesource(self._ui, svnroot, source) 405 source = resolvesource(self._ui, svnroot, source)
411 # hg < 1.9 svnsubrepo calls "svn checkout" with --rev 406 # hg 1.9 and higher, append the rev as a peg revision to
412 # only, so peg revisions are correctly used. 1.9 and 407 # the source URL, so we cannot add our own. We assume
413 # higher, append the rev as a peg revision to the source 408 # that "-r10 url@2" will be similar to "url@10" most of
414 # URL, so we cannot add our own. We assume that "-r10 409 # the time.
415 # url@2" will be similar to "url@10" most of the time.
416 if pegrev is not None and passpegrev:
417 source = source + '@' + pegrev
418 state = (source, state[1]) 410 state = (source, state[1])
419 return super(svnsubrepo, self).get(state, *args, **kwargs) 411 return super(svnsubrepo, self).get(state, *args, **kwargs)
420 412
421 def dirty(self, ignoreupdate=False): 413 def dirty(self, ignoreupdate=False):
422 # You cannot compare anything with HEAD. Just accept it 414 # You cannot compare anything with HEAD. Just accept it