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-12 13:21:57 -07:00
parent ace7ce91a8
commit 53506b7433

View File

@ -86,6 +86,7 @@ def checkout(git_dir, tag):
cwd=git_dir)
process.communicate()
### hg functions
def untracked_files(hg_dir):
@ -153,6 +154,18 @@ def setup(**kwargs):
assert current_package
current_package_info[current_package] = kwargs
def checkout_tag(src, directory, version):
"""
front end to checkout + version_tag;
if version is None, checkout HEAD
"""
if version is None:
tag = 'HEAD'
else:
tag = version_tag(directory, version)
checkout(src, tag)
def check_consistency(*package_info):
"""checks consistency between a set of packages"""
@ -213,6 +226,8 @@ def main(args=sys.argv[1:]):
formatter=PlainDescriptionFormatter())
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")
parser.add_option('--packages', dest='output_packages',
default=False, action='store_true',
help="generate packages.txt and exit")
@ -277,10 +292,17 @@ def main(args=sys.argv[1:]):
# ensure all directories and tags are available
for index, (directory, version) in enumerate(versions):
setup_py = os.path.join(src, directory, 'setup.py')
assert os.path.exists(setup_py), "'%s' not found" % setup_py
if not version:
if options.develop:
# use HEAD of package; keep version=None
continue
# choose maximum version from setup.py
setup_py = os.path.join(src, directory, 'setup.py')
assert os.path.exists(setup_py), "'%s' not found" % setup_py
with file(setup_py) as f:
for line in f.readlines():
line = line.strip()
@ -305,8 +327,7 @@ def main(args=sys.argv[1:]):
for directory, version in versions:
# checkout appropriate revision of mozbase
tag = version_tag(directory, version)
checkout(src, tag)
checkout_tag(src, directory, version)
# update the package information
setup_py = os.path.join(src, directory, 'setup.py')
@ -324,8 +345,7 @@ def main(args=sys.argv[1:]):
for directory, version in versions:
# checkout appropriate revision of mozbase
tag = version_tag(directory, version)
checkout(src, tag)
checkout_tag(src, directory, version)
# replace the directory
remove(os.path.join(here, directory))