servo-vcs-sync: call hg overlay with --noncontiguous when filtering by author (
Bug 1375901). r?gps
This change should make sure we're using --noncontiguous when author
filtering is used in production.
MozReview-Commit-ID: ASIoA1J6dao
--- a/vcssync/mozvcssync/cli.py
+++ b/vcssync/mozvcssync/cli.py
@@ -221,16 +221,18 @@ def overlay_hg_repos_cli():
help='URL of repository where changesets will be '
'overlayed')
parser.add_argument('dest_repo_path',
help='Local path to clone of <dest_repo_url>')
parser.add_argument('--source_revs',
help='Revset describing changesets to overlay')
parser.add_argument('--result-push-url',
help='URL where to push the overlayed result')
+ parser.add_argument('--noncontiguous', action='store_true',
+ help='Allow a non-contiguous source_revs')
args = parser.parse_args()
if args.hg:
hglib.HGPATH = args.hg
configure_logging()
@@ -241,17 +243,18 @@ def overlay_hg_repos_cli():
attempt += 1
try:
overlay_hg_repos(
args.source_repo_url,
args.dest_repo_url,
args.dest_repo_path,
source_rev=args.source_revs,
dest_prefix=args.into,
- result_push_url=args.result_push_url)
+ result_push_url=args.result_push_url,
+ noncontiguous=args.noncontiguous)
sys.exit(0)
except PushRaceError:
logger.warn('likely push race on attempt %d/%d' % (
attempt, MAX_ATTEMPTS))
if attempt < MAX_ATTEMPTS:
logger.warn('retrying immediately...')
except PushRemoteFail:
logger.warn('push failed by remote on attempt %d/%d' % (
--- a/vcssync/mozvcssync/overlay.py
+++ b/vcssync/mozvcssync/overlay.py
@@ -23,17 +23,17 @@ class PushRaceError(Exception):
class PushRemoteFail(Exception):
"""Raised when a push fails due to an error on the remote."""
def overlay_hg_repos(source_repo_url, dest_repo_url, dest_repo_path,
dest_prefix, source_rev=None, dest_rev='tip',
- result_push_url=None):
+ result_push_url=None, noncontiguous=False):
"""Overlay changesets from an hg repo into a sub-directory of another.
This function will take changesets from the Mercurial repo
at ``source_url`` and apply them to the Mercurial repo at
``dest_repo_url``, rewriting file paths so they are stored in
the directory ``dest_prefix`` of the destination repository.
A copy of ``dest_repo_url`` is managed at ``dest_repo_path``,
@@ -90,16 +90,20 @@ def overlay_hg_repos(source_repo_url, de
# The destination revision is now present locally. Commence the overlay!
args = [
b'overlay',
source_repo_url,
b'--into', dest_prefix,
b'-d', dest_node,
]
+
+ if noncontiguous:
+ args.append('--noncontiguous')
+
if source_rev:
args.append(source_rev)
logger.warn('commencing overlay of %s' % source_repo_url)
run_hg(logger, hrepo, args)
new_tip = hrepo[b'tip']
if new_tip.rev() == old_tip.rev():
--- a/vcssync/mozvcssync/servo.py
+++ b/vcssync/mozvcssync/servo.py
@@ -313,17 +313,19 @@ def overlay_cli():
if args.result_push_url:
overlay_hg_repos.extend(['--result-push-url', args.result_push_url])
if args.hg:
overlay_hg_repos.extend(['--hg', args.hg])
# Exclude pull requests generated by servo-backout-pr
if os.getenv('BACKOUT_AUTHOR'):
overlay_hg_repos.extend([
- '--source_revs', 'not author("%s")' % os.getenv('BACKOUT_AUTHOR')])
+ '--source_revs', 'not author("%s")' % os.getenv('BACKOUT_AUTHOR'),
+ '--noncontiguous',
+ ])
try:
subprocess.check_call(overlay_hg_repos)
except Exception as e:
# A stack trace from here is not useful.
logger.error('abort: %s' % str(e))
sys.exit(1)