зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1279048 - Check MOZ_SOURCE_REPO for repository URL; r=ted
MOZ_SOURCE_REPO is set by automation to indicate the URL of the current repository. I'm not sure what SRCSRV_ROOT is from. Probably legacy. Use MOZ_SOURCE_REPO instead of SRCSRV_ROOT. MozReview-Commit-ID: IfCSiaqgJb5 --HG-- extra : rebase_source : e59cec6c2a85a464f9dd92666a179f34c5ef3887
This commit is contained in:
Родитель
8abf247ae1
Коммит
3294bf1789
|
@ -136,11 +136,15 @@ def read_output(*args):
|
|||
class HGRepoInfo:
|
||||
def __init__(self, path):
|
||||
self.path = path
|
||||
|
||||
rev = os.environ.get('MOZ_SOURCE_CHANGESET')
|
||||
if not rev:
|
||||
rev = read_output('hg', '-R', path,
|
||||
'parent', '--template={node|short}')
|
||||
# Look for the default hg path. If SRVSRV_ROOT is set, we
|
||||
|
||||
# Look for the default hg path. If MOZ_SOURCE_REPO is set, we
|
||||
# don't bother asking hg.
|
||||
hg_root = os.environ.get("SRCSRV_ROOT")
|
||||
hg_root = os.environ.get('MOZ_SOURCE_REPO')
|
||||
if hg_root:
|
||||
root = hg_root
|
||||
else:
|
||||
|
@ -158,7 +162,7 @@ class HGRepoInfo:
|
|||
if cleanroot is None:
|
||||
print >> sys.stderr, textwrap.dedent("""\
|
||||
Could not determine repo info for %s. This is either not a clone of the web-based
|
||||
repository, or you have not specified SRCSRV_ROOT, or the clone is corrupt.""") % path
|
||||
repository, or you have not specified MOZ_SOURCE_REPO, or the clone is corrupt.""") % path
|
||||
sys.exit(1)
|
||||
self.rev = rev
|
||||
self.root = root
|
||||
|
@ -205,7 +209,7 @@ class GitRepoInfo:
|
|||
if cleanroot is None:
|
||||
print >> sys.stderr, textwrap.dedent("""\
|
||||
Could not determine repo info for %s (%s). This is either not a clone of a web-based
|
||||
repository, or you have not specified SRCSRV_ROOT, or the clone is corrupt.""") % (path, root)
|
||||
repository, or you have not specified MOZ_SOURCE_REPO, or the clone is corrupt.""") % (path, root)
|
||||
sys.exit(1)
|
||||
self.rev = rev
|
||||
self.cleanroot = cleanroot
|
||||
|
@ -614,7 +618,7 @@ class Dumper:
|
|||
|
||||
# tries to get the vcs root from the .mozconfig first - if it's not set
|
||||
# the tinderbox vcs path will be assigned further down
|
||||
vcs_root = os.environ.get("SRCSRV_ROOT")
|
||||
vcs_root = os.environ.get('MOZ_SOURCE_REPO')
|
||||
for arch_num, arch in enumerate(self.archs):
|
||||
self.files_record[files] = 0 # record that we submitted jobs for this tuple of files
|
||||
self.SubmitJob(files[-1], 'ProcessFilesWork', args=(files, arch_num, arch, vcs_root, after, after_arg), callback=self.ProcessFilesFinished)
|
||||
|
|
|
@ -59,6 +59,13 @@ class HelperMixin(object):
|
|||
symbolstore.srcdirRepoInfo = {}
|
||||
symbolstore.vcsFileInfoCache = {}
|
||||
|
||||
# Remove environment variables that can influence tests.
|
||||
for e in ('MOZ_SOURCE_CHANGESET', 'MOZ_SOURCE_REPO'):
|
||||
try:
|
||||
del os.environ[e]
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
def tearDown(self):
|
||||
shutil.rmtree(self.test_dir)
|
||||
symbolstore.srcdirRepoInfo = {}
|
||||
|
@ -264,6 +271,16 @@ class TestGetVCSFilename(HelperMixin, unittest.TestCase):
|
|||
self.assertEqual("hg:example.com/other:bar.c:0987ffff",
|
||||
symbolstore.GetVCSFilename(filename2, [srcdir1, srcdir2])[0])
|
||||
|
||||
def testVCSFilenameEnv(self):
|
||||
# repo URL and changeset read from environment variables if defined.
|
||||
os.environ['MOZ_SOURCE_REPO'] = 'https://somewhere.com/repo'
|
||||
os.environ['MOZ_SOURCE_CHANGESET'] = 'abcdef0123456'
|
||||
os.mkdir(os.path.join(self.test_dir, '.hg'))
|
||||
filename = os.path.join(self.test_dir, 'foo.c')
|
||||
self.assertEqual('hg:somewhere.com/repo:foo.c:abcdef0123456',
|
||||
symbolstore.GetVCSFilename(filename, [self.test_dir])[0])
|
||||
|
||||
|
||||
class TestRepoManifest(HelperMixin, unittest.TestCase):
|
||||
def testRepoManifest(self):
|
||||
manifest = os.path.join(self.test_dir, "sources.xml")
|
||||
|
|
Загрузка…
Ссылка в новой задаче