-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
hgserver: add test for fastannotate (bug 1504794); r=sheehan
fastannotate has broken before. Let's add test coverage to ensure it continues to work. We already have a helper script in the test environment to set hgrc options. However, it doesn't work with %include, which is a special directive. Rather than complicate that script with %include functionality, I wrote a simple, non-generic script to accomplish what we need. Differential Revision: https://phabricator.services.mozilla.com/D11131 --HG-- extra : moz-landing-system : lando
- Loading branch information
Showing
3 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/usr/bin/env python3.6 | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, v. 2.0. If a copy of the MPL was not distributed with this | ||
# file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
import os | ||
import sys | ||
|
||
repo = sys.argv[1] | ||
|
||
with open(os.path.join(repo, '.hg', 'hgrc'), 'ab') as fh: | ||
fh.write(b'\n%include /etc/mercurial/hgrc-fastannotate\n') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#require hgmodocker | ||
|
||
$ . $TESTDIR/hgserver/tests/helpers.sh | ||
$ hgmoenv | ||
$ standarduser | ||
|
||
$ hgmo create-repo mozilla-central scm_level_1 | ||
(recorded repository creation in replication log) | ||
$ hgmo exec hgweb0 /var/hg/venv_replication/bin/vcsreplicator-consumer --wait-for-no-lag /etc/mercurial/vcsreplicator.ini | ||
$ hgmo exec hgweb0 /enable-fastannotate /repo/hg/mozilla/mozilla-central | ||
|
||
$ hg -q clone ssh://$SSH_SERVER:$HGPORT/mozilla-central | ||
$ cd mozilla-central | ||
$ cat > foo << EOF | ||
> line0 | ||
> line1 | ||
> line2 | ||
> line3 | ||
> EOF | ||
$ hg add foo | ||
$ hg commit -m 'commit 1' | ||
$ cat > foo << EOF | ||
> line0 | ||
> line1 modified | ||
> line2 | ||
> line3 | ||
> EOF | ||
$ hg commit -m 'commit 2' | ||
$ cat > foo << EOF | ||
> line0 | ||
> line1 modified | ||
> line2 modified | ||
> line3 | ||
> EOF | ||
$ hg commit -m 'commit 3' | ||
$ hg -q push | ||
|
||
$ hgmo exec hgweb0 /var/hg/venv_replication/bin/vcsreplicator-consumer --wait-for-no-lag /etc/mercurial/vcsreplicator.ini | ||
|
||
$ http ${HGWEB_0_URL}mozilla-central/annotate/f01fe54ccaa1/foo | grep '<pre>' | ||
<td class="followlines-btn-parent"><pre><a class="linenr" href="#l1"> 1</a></pre></td> | ||
<td><pre>line0 | ||
<td class="followlines-btn-parent"><pre><a class="linenr" href="#l2"> 2</a></pre></td> | ||
<td><pre>line1 modified | ||
<td class="followlines-btn-parent"><pre><a class="linenr" href="#l3"> 3</a></pre></td> | ||
<td><pre>line2 | ||
<td class="followlines-btn-parent"><pre><a class="linenr" href="#l4"> 4</a></pre></td> | ||
<td><pre>line3 | ||
|
||
$ hgmo exec hgweb0 /var/hg/venv_hgweb/bin/hg --cwd /repo/hg/mozilla/mozilla-central --config fastannotate.modes=fastannotate fastannotate -r f01fe54ccaa1 foo | ||
0: line0 | ||
1: line1 modified | ||
0: line2 | ||
0: line3 | ||
|
||
$ hgmo exec hgweb0 ls /repo/hg/mozilla/mozilla-central/.hg/fastannotate/default | ||
foo.l | ||
foo.m | ||
|
||
$ hgmo clean |