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
151 lines
3.5 KiB
Perl
151 lines
3.5 KiB
Perl
#chg-compatible
|
|
|
|
$ newrepo
|
|
$ enable stablerev
|
|
$ hg debugdrawdag <<'EOS'
|
|
> D
|
|
> |
|
|
> C
|
|
> |
|
|
> B
|
|
> |
|
|
> A
|
|
> EOS
|
|
$ setconfig alias.log="log -T '[{node|short}]: {desc}\n'"
|
|
|
|
# Basics
|
|
|
|
If the script doesn't return anything, an abort is raised:
|
|
$ printf "#!/bin/bash\n" > stable.sh
|
|
$ chmod +x stable.sh
|
|
$ setconfig stablerev.script=./stable.sh
|
|
$ hg log -r "getstablerev()"
|
|
abort: stable rev returned by script (./stable.sh) was empty
|
|
[255]
|
|
|
|
Make the script return something:
|
|
$ printf "#!/bin/bash\n\necho 'B'" > stable.sh
|
|
$ hg log -r "getstablerev()"
|
|
[112478962961]: B
|
|
|
|
Change the script, change the result:
|
|
$ printf "#!/bin/bash\n\necho 'C'" > stable.sh
|
|
$ hg log -r "getstablerev()"
|
|
[26805aba1e60]: C
|
|
|
|
The script is always run relative to repo root:
|
|
$ mkdir subdir
|
|
$ cd subdir
|
|
$ hg log -r "getstablerev()"
|
|
[26805aba1e60]: C
|
|
$ cd ..
|
|
|
|
JSON is also supported:
|
|
$ printf "#!/bin/bash\n\necho '{\"node\": \"D\"}'" > stable.sh
|
|
$ hg log -r "getstablerev()"
|
|
[f585351a92f8]: D
|
|
|
|
Invalid JSON aborts:
|
|
$ printf "#!/bin/bash\n\necho '{node\": \"D\"}'" > stable.sh
|
|
$ hg log -r "getstablerev()"
|
|
abort: stable rev returned by script (./stable.sh) was invalid
|
|
[255]
|
|
|
|
An alias can be used for simplicity:
|
|
$ printf "#!/bin/bash\n\necho 'A'" > stable.sh
|
|
$ setconfig revsetalias.stable="getstablerev()"
|
|
$ hg log -r stable
|
|
[426bada5c675]: A
|
|
|
|
# Auto-pull
|
|
|
|
Make another repo with "E" (9bc730a19041):
|
|
$ cd ..
|
|
$ newrepo
|
|
$ drawdag <<'EOS'
|
|
> E
|
|
> |
|
|
> D
|
|
> |
|
|
> C
|
|
> |
|
|
> B
|
|
> |
|
|
> A
|
|
> EOS
|
|
$ cd ../repo1
|
|
|
|
What if the stable commit isn't present locally?
|
|
$ printf "#!/bin/bash\n\necho '9bc730a19041'" > stable.sh
|
|
$ hg log -r stable
|
|
abort: stable commit (9bc730a19041) not in the repo
|
|
(try hg pull first)
|
|
[255]
|
|
|
|
The revset can be configured to automatically pull in this case:
|
|
$ setconfig paths.default=../repo2
|
|
$ setconfig stablerev.pullonmissing=True
|
|
$ hg log -r stable
|
|
stable commit (9bc730a19041) not in repo; pulling to get it...
|
|
pulling from $TESTTMP/repo2
|
|
searching for changes
|
|
adding changesets
|
|
adding manifests
|
|
adding file changes
|
|
added 1 changesets with 1 changes to 1 files
|
|
[9bc730a19041]: E
|
|
|
|
But it might not exist even after pulling:
|
|
$ printf "#!/bin/bash\n\necho 'abcdef123'" > stable.sh
|
|
$ hg log -r stable
|
|
stable commit (abcdef123) not in repo; pulling to get it...
|
|
pulling from $TESTTMP/repo2
|
|
searching for changes
|
|
no changes found
|
|
abort: stable commit (abcdef123) not in the repo
|
|
(try hg pull first)
|
|
[255]
|
|
|
|
# Targets
|
|
|
|
Targets are disabled by default:
|
|
$ hg log -r "getstablerev(foo)"
|
|
abort: targets are not supported in this repo
|
|
[255]
|
|
|
|
But they can be made optional or required:
|
|
$ setconfig stablerev.targetarg=optional
|
|
$ hg log -r "getstablerev(foo)"
|
|
stable commit (abcdef123) not in repo; pulling to get it...
|
|
pulling from $TESTTMP/repo2
|
|
searching for changes
|
|
no changes found
|
|
abort: stable commit (abcdef123) not in the repo
|
|
(try hg pull first)
|
|
[255]
|
|
|
|
$ setconfig stablerev.targetarg=required
|
|
$ hg log -r "getstablerev()"
|
|
abort: must pass a target
|
|
[255]
|
|
|
|
Try making the script return different locations, based on the target:
|
|
$ cat <<'EOF' > stable.sh
|
|
> #!/bin/bash
|
|
> if [ "$TARGET" = "foo" ]; then
|
|
> echo 'D'
|
|
> else
|
|
> echo 'C'
|
|
> fi
|
|
> EOF
|
|
$ hg log -r "getstablerev(foo)"
|
|
[f585351a92f8]: D
|
|
$ hg log -r "getstablerev(bar)"
|
|
[26805aba1e60]: C
|
|
|
|
Lastly, targets can be used in conjunction with aliases:
|
|
|
|
$ setconfig revsetalias.stable="getstablerev(foo)"
|
|
$ hg log -r stable
|
|
[f585351a92f8]: D
|