mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 08:47:12 +03:00
98d9269874
Summary: Create a fork of the Mercurial code that we can use to build server rpms. The hg servers will continue to exist for a few more months while we move the darkstorm and ediscovery use cases off them. In the mean time, we want to start making breaking changes to the client, so let's create a stable copy of the hg code to produce rpms for the hg servers. The fork is based off c7770c78d, the latest hg release. This copies the files as is, then adds some minor tweaks to get it to build: - Disables some lint checks that appear to be bypassed by path - sed replace eden/scm with eden/hg-server - Removed a dependency on scm/telemetry from the edenfs-client tests since scm/telemetry pulls in the original eden/scm/lib/configparser which conflicts with the hg-server conflict parser. allow-large-files Reviewed By: quark-zju Differential Revision: D27632557 fbshipit-source-id: b2f442f4ec000ea08e4d62de068750832198e1f4
131 lines
3.6 KiB
Python
131 lines
3.6 KiB
Python
# Copyright (c) Facebook, Inc. and its affiliates.
|
|
# Copyright (c) Mercurial Contributors.
|
|
#
|
|
# This software may be used and distributed according to the terms of the
|
|
# GNU General Public License version 2 or any later version.
|
|
|
|
from __future__ import absolute_import
|
|
|
|
from testutil.dott import feature, sh, testtmp # noqa: F401
|
|
|
|
|
|
# Setup
|
|
|
|
sh % "cat" << r"""
|
|
#!/bin/bash
|
|
env | egrep "^HG_USERVAR_(DEBUG|BYPASS_REVIEW)" | sort
|
|
exit 0
|
|
""" > "$TESTTMP/pretxnchangegroup.sh"
|
|
sh % "cat" << r"""
|
|
[hooks]
|
|
pretxnchangegroup = bash $TESTTMP/pretxnchangegroup.sh
|
|
""" >> "$HGRCPATH"
|
|
|
|
sh % "hg init repo"
|
|
sh % "hg clone -q repo child"
|
|
sh % "cd child"
|
|
|
|
# Test pushing vars to repo with pushvars.server explicitly disabled
|
|
|
|
sh % "cd ../repo"
|
|
sh % "setconfig 'push.pushvars.server=False'"
|
|
sh % "cd ../child"
|
|
sh % "echo b" > "a"
|
|
sh % "hg commit -Aqm a"
|
|
sh % "hg push --pushvars 'DEBUG=1' --pushvars 'BYPASS_REVIEW=true' --config 'push.pushvars.server=False'" == r"""
|
|
pushing to $TESTTMP/repo
|
|
searching for changes
|
|
adding changesets
|
|
adding manifests
|
|
adding file changes
|
|
added 1 changesets with 1 changes to 1 files"""
|
|
|
|
# Setting pushvars.sever = true and then pushing.
|
|
|
|
sh % "cd ../repo"
|
|
sh % "setconfig 'push.pushvars.server=True'"
|
|
sh % "cd ../child"
|
|
sh % "echo b" >> "a"
|
|
sh % "hg commit -Aqm a"
|
|
sh % "hg push --pushvars 'DEBUG=1' --pushvars 'BYPASS_REVIEW=true'" == r"""
|
|
pushing to $TESTTMP/repo
|
|
searching for changes
|
|
adding changesets
|
|
adding manifests
|
|
adding file changes
|
|
added 1 changesets with 1 changes to 1 files
|
|
HG_USERVAR_BYPASS_REVIEW=true
|
|
HG_USERVAR_DEBUG=1"""
|
|
|
|
# Test pushing var with empty right-hand side
|
|
|
|
sh % "echo b" >> "a"
|
|
sh % "hg commit -Aqm a"
|
|
sh % "hg push --pushvars 'DEBUG='" == r"""
|
|
pushing to $TESTTMP/repo
|
|
searching for changes
|
|
adding changesets
|
|
adding manifests
|
|
adding file changes
|
|
added 1 changesets with 1 changes to 1 files
|
|
HG_USERVAR_DEBUG="""
|
|
|
|
# Test pushing bad vars
|
|
|
|
sh % "echo b" >> "a"
|
|
sh % "hg commit -Aqm b"
|
|
sh % "hg push --pushvars DEBUG" == r"""
|
|
pushing to $TESTTMP/repo
|
|
searching for changes
|
|
abort: unable to parse variable 'DEBUG', should follow 'KEY=VALUE' or 'KEY=' format
|
|
[255]"""
|
|
|
|
# Test Python hooks
|
|
|
|
sh % "cat" << r"""
|
|
def hook(ui, repo, hooktype, **kwargs):
|
|
for k, v in sorted(kwargs.items()):
|
|
if "USERVAR" in k:
|
|
ui.write("Got pushvar: %s=%s\n" % (k, v))
|
|
""" >> "$TESTTMP/pyhook.py"
|
|
|
|
sh % 'cp "$HGRCPATH" "$TESTTMP/hgrc.bak"'
|
|
sh % "cat" << r"""
|
|
[hooks]
|
|
pretxnchangegroup.pyhook = python:$TESTTMP/pyhook.py:hook
|
|
""" >> "$HGRCPATH"
|
|
|
|
sh % "hg push --pushvars 'A=1' --pushvars 'B=2'" == r"""
|
|
pushing to $TESTTMP/repo
|
|
searching for changes
|
|
adding changesets
|
|
adding manifests
|
|
adding file changes
|
|
added 1 changesets with 1 changes to 1 files
|
|
Got pushvar: USERVAR_A=1
|
|
Got pushvar: USERVAR_B=2"""
|
|
sh % 'cp "$TESTTMP/hgrc.bak" "$HGRCPATH"'
|
|
|
|
# Test pushvars for enforcing push reasons
|
|
sh % "cat" << r"""
|
|
[push]
|
|
requirereason=True
|
|
requirereasonmsg="Because I said so"
|
|
""" >> ".hg/hgrc"
|
|
sh % "echo c" >> "a"
|
|
sh % "hg commit -Aqm c"
|
|
sh % "hg push" == r"""
|
|
pushing to $TESTTMP/repo
|
|
abort: "Because I said so"
|
|
(use `--pushvars PUSH_REASON='because ...'`)
|
|
[255]"""
|
|
sh % "hg push --pushvars 'PUSH_REASON=I want to'" == r"""
|
|
pushing to $TESTTMP/repo
|
|
searching for changes
|
|
adding changesets
|
|
adding manifests
|
|
adding file changes
|
|
added 1 changesets with 1 changes to 1 files"""
|
|
sh % 'hg blackbox --pattern \'{"legacy_log": {"service": "pushreason"}}\'' == "* [legacy][pushreason] bypassing push block with reason: I want to (glob)"
|
|
sh % 'cp "$TESTTMP/hgrc.bak" "$HGRCPATH"'
|