Mercurial > hg-stable
annotate tests/test-pushvars.t @ 35400:4441705b7111
tests: remove (glob) annotations that were only for '\' matches
# skip-blame because this was mechanically rewritten the following script. I
ran it on both *.t and *.py, but none of the *.py changes were proper. All *.t
ones appear to be, and they run without addition failures on both Windows and
Linux.
import argparse
import os
import re
ap = argparse.ArgumentParser()
ap.add_argument('path', nargs='+')
opts = ap.parse_args()
globre = re.compile(r'^(.*) \(glob\)(.*)$')
for p in opts.path:
tmp = p + '.tmp'
with open(p, 'rb') as src, open(tmp, 'wb') as dst:
for line in src:
m = globre.match(line)
if not m or '$LOCALIP' in line or '*' in line:
dst.write(line)
continue
if '?' in line[:-3] or ('?' in line[:-3] and line[-3:] != '(?)'):
dst.write(line)
continue
dst.write(m.group(1) + m.group(2) + '\n')
os.unlink(p)
os.rename(tmp, p)
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Sun, 10 Dec 2017 22:50:57 -0500 |
parents | 800bb35d891e |
children | 2405ca783672 |
rev | line source |
---|---|
33719
db3dc11356ed
pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
1 Setup |
db3dc11356ed
pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
2 |
db3dc11356ed
pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
3 $ PYTHONPATH=$TESTDIR/..:$PYTHONPATH |
db3dc11356ed
pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
4 $ export PYTHONPATH |
db3dc11356ed
pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
5 |
db3dc11356ed
pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
6 $ cat > $TESTTMP/pretxnchangegroup.sh << EOF |
db3dc11356ed
pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
7 > #!/bin/sh |
db3dc11356ed
pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
8 > env | egrep "^HG_USERVAR_(DEBUG|BYPASS_REVIEW)" | sort |
db3dc11356ed
pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
9 > exit 0 |
db3dc11356ed
pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
10 > EOF |
db3dc11356ed
pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
11 $ cat >> $HGRCPATH << EOF |
db3dc11356ed
pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
12 > [hooks] |
33817
4f8c241b2bfa
test-pushvars: invoke shell script hook via `sh` for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents:
33719
diff
changeset
|
13 > pretxnchangegroup = sh $TESTTMP/pretxnchangegroup.sh |
33719
db3dc11356ed
pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
14 > [experimental] |
db3dc11356ed
pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
15 > bundle2-exp = true |
db3dc11356ed
pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
16 > EOF |
db3dc11356ed
pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
17 |
db3dc11356ed
pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
18 $ hg init repo |
db3dc11356ed
pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
19 $ hg clone -q repo child |
db3dc11356ed
pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
20 $ cd child |
db3dc11356ed
pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
21 |
db3dc11356ed
pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
22 Test pushing vars to repo with pushvars.server not set |
db3dc11356ed
pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
23 |
db3dc11356ed
pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
24 $ echo b > a |
db3dc11356ed
pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
25 $ hg commit -Aqm a |
db3dc11356ed
pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
26 $ hg push --pushvars "DEBUG=1" --pushvars "BYPASS_REVIEW=true" |
35400
4441705b7111
tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents:
33903
diff
changeset
|
27 pushing to $TESTTMP/repo |
33719
db3dc11356ed
pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
28 searching for changes |
db3dc11356ed
pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
29 adding changesets |
db3dc11356ed
pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
30 adding manifests |
db3dc11356ed
pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
31 adding file changes |
db3dc11356ed
pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
32 added 1 changesets with 1 changes to 1 files |
db3dc11356ed
pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
33 |
db3dc11356ed
pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
34 Setting pushvars.sever = true and then pushing. |
db3dc11356ed
pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
35 |
db3dc11356ed
pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
36 $ echo [push] >> $HGRCPATH |
db3dc11356ed
pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
37 $ echo "pushvars.server = true" >> $HGRCPATH |
db3dc11356ed
pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
38 $ echo b >> a |
db3dc11356ed
pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
39 $ hg commit -Aqm a |
db3dc11356ed
pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
40 $ hg push --pushvars "DEBUG=1" --pushvars "BYPASS_REVIEW=true" |
35400
4441705b7111
tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents:
33903
diff
changeset
|
41 pushing to $TESTTMP/repo |
33719
db3dc11356ed
pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
42 searching for changes |
db3dc11356ed
pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
43 adding changesets |
db3dc11356ed
pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
44 adding manifests |
db3dc11356ed
pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
45 adding file changes |
db3dc11356ed
pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
46 added 1 changesets with 1 changes to 1 files |
db3dc11356ed
pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
47 HG_USERVAR_BYPASS_REVIEW=true |
db3dc11356ed
pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
48 HG_USERVAR_DEBUG=1 |
db3dc11356ed
pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
49 |
db3dc11356ed
pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
50 Test pushing var with empty right-hand side |
db3dc11356ed
pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
51 |
db3dc11356ed
pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
52 $ echo b >> a |
db3dc11356ed
pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
53 $ hg commit -Aqm a |
db3dc11356ed
pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
54 $ hg push --pushvars "DEBUG=" |
35400
4441705b7111
tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents:
33903
diff
changeset
|
55 pushing to $TESTTMP/repo |
33719
db3dc11356ed
pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
56 searching for changes |
db3dc11356ed
pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
57 adding changesets |
db3dc11356ed
pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
58 adding manifests |
db3dc11356ed
pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
59 adding file changes |
db3dc11356ed
pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
60 added 1 changesets with 1 changes to 1 files |
db3dc11356ed
pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
61 HG_USERVAR_DEBUG= |
db3dc11356ed
pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
62 |
db3dc11356ed
pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
63 Test pushing bad vars |
db3dc11356ed
pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
64 |
db3dc11356ed
pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
65 $ echo b >> a |
db3dc11356ed
pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
66 $ hg commit -Aqm b |
db3dc11356ed
pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
67 $ hg push --pushvars "DEBUG" |
35400
4441705b7111
tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents:
33903
diff
changeset
|
68 pushing to $TESTTMP/repo |
33903 | 69 searching for changes |
33719
db3dc11356ed
pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
70 abort: unable to parse variable 'DEBUG', should follow 'KEY=VALUE' or 'KEY=' format |
db3dc11356ed
pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
71 [255] |