Fri, 16 Jan 2015 18:13:44 +0100
Integrate suggestion from review to improve consistency with existing code.
michael@0 | 1 | # -*- makefile -*- |
michael@0 | 2 | # vim:set ts=8 sw=8 sts=8 noet: |
michael@0 | 3 | # |
michael@0 | 4 | # This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 5 | # License, v. 2.0. If a copy of the MPL was not distributed with this file, |
michael@0 | 6 | # You can obtain one at http://mozilla.org/MPL/2.0/. |
michael@0 | 7 | # |
michael@0 | 8 | |
michael@0 | 9 | ifdef USE_RCS_MK #{ |
michael@0 | 10 | |
michael@0 | 11 | ifndef INCLUDED_RCS_MK #{ |
michael@0 | 12 | |
michael@0 | 13 | MOZ_RCS_TYPE_HG ?= $(notdir $(wildcard $(topsrcdir)/.hg)) |
michael@0 | 14 | MOZ_RCS_TYPE_GIT ?= $(notdir $(wildcard $(topsrcdir)/.git)) |
michael@0 | 15 | |
michael@0 | 16 | |
michael@0 | 17 | ########################################################################### |
michael@0 | 18 | # HAVE_MERCURIAL_RCS |
michael@0 | 19 | ########################################################################### |
michael@0 | 20 | ifeq (.hg,$(MOZ_RCS_TYPE_HG)) #{ |
michael@0 | 21 | |
michael@0 | 22 | # Intent: Retrieve the http:// repository path for a directory. |
michael@0 | 23 | # Usage: $(call getSourceRepo[,repo_dir|args]) |
michael@0 | 24 | # Args: |
michael@0 | 25 | # path (optional): repository to query. Defaults to $(topsrcdir) |
michael@0 | 26 | getSourceRepo = \ |
michael@0 | 27 | $(call FUNC_getSourceRepo,$(if $(1),cd $(1) && hg,hg --repository $(topsrcdir))) |
michael@0 | 28 | |
michael@0 | 29 | # return: http://hg.mozilla.org/mozilla-central |
michael@0 | 30 | FUNC_getSourceRepo = \ |
michael@0 | 31 | $(strip \ |
michael@0 | 32 | $(patsubst %/,%,\ |
michael@0 | 33 | $(patsubst ssh://%,http://%,\ |
michael@0 | 34 | $(firstword $(shell $(getargv) showconfig paths.default))\ |
michael@0 | 35 | ))) |
michael@0 | 36 | |
michael@0 | 37 | #} HAVE_MERCURIAL_RCS |
michael@0 | 38 | |
michael@0 | 39 | ########################################################################### |
michael@0 | 40 | # HAVE_GIT_RCS |
michael@0 | 41 | ########################################################################### |
michael@0 | 42 | else ifeq (.git,$(MOZ_RCS_TYPE_GIT)) #{ |
michael@0 | 43 | |
michael@0 | 44 | GIT ?= git |
michael@0 | 45 | getSourceRepo = \ |
michael@0 | 46 | $(shell cd $(topsrcdir) && $(GIT) rev-parse --verify HEAD) |
michael@0 | 47 | |
michael@0 | 48 | endif #} HAVE_GIT_RCS |
michael@0 | 49 | |
michael@0 | 50 | |
michael@0 | 51 | INCLUDED_RCS_MK := 1 |
michael@0 | 52 | endif #} |
michael@0 | 53 | |
michael@0 | 54 | endif #} |