follow-up: Bug 838733 - generate_diff.py should have a convenience mode for staging;r=ahal ; DONTBUILD because NPOTB

This commit is contained in:
Jeff Hammel 2013-03-13 13:07:05 -07:00
parent d483b1dfd9
commit f86723d135

View File

@ -161,7 +161,7 @@ def checkout_tag(src, directory, version):
"""
if version is None:
tag = 'HEAD'
tag = 'master'
else:
tag = version_tag(directory, version)
checkout(src, tag)
@ -227,7 +227,11 @@ def main(args=sys.argv[1:]):
parser.add_option('-o', '--output', dest='output',
help="specify the output file; otherwise will be in the current directory with a name based on the hash")
parser.add_option('--develop', dest='develop',
help="use development (HEAD) version of packages")
action='store_true', default=False,
help="use development (master) version of packages")
parser.add_option('--no-check', dest='check',
action='store_false', default=True,
help="Do not check current repository state")
parser.add_option('--packages', dest='output_packages',
default=False, action='store_true',
help="generate packages.txt and exit")
@ -268,12 +272,12 @@ def main(args=sys.argv[1:]):
# ensure there are no outstanding changes to m-c
process = subprocess.Popen(['hg', 'diff'], cwd=here, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = process.communicate()
if stdout.strip():
if stdout.strip() and options.check:
error("Outstanding changes in %s; aborting" % hg_root)
# ensure that there are no untracked files in testing/mozbase
untracked = untracked_files(hg_root)
if untracked:
if untracked and options.check:
error("Untracked files in %s:\n %s\naborting" % (hg_root, '\n'.join([' %s' % i for i in untracked])))
tempdir = tempfile.mkdtemp()
@ -299,7 +303,7 @@ def main(args=sys.argv[1:]):
if not version:
if options.develop:
# use HEAD of package; keep version=None
# use master of package; keep version=None
continue
# choose maximum version from setup.py
@ -338,7 +342,7 @@ def main(args=sys.argv[1:]):
sys.modules.pop('setuptools')
if setuptools:
sys.modules['setuptools'] = setuptools
checkout(src, 'HEAD')
checkout(src, 'master')
check_consistency(*current_package_info.values())
# copy mozbase directories to m-c
@ -355,7 +359,9 @@ def main(args=sys.argv[1:]):
generate_packages_txt()
# generate the diff and write to output file
call(['hg', 'addremove'], cwd=hg_root)
command = ['hg', 'addremove']
# TODO: don't add untracked files via `hg addremove --exclude...`
call(command, cwd=hg_root)
process = subprocess.Popen(['hg', 'diff'],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,