tests/test-pushvars.t
author Raphaël Gomès <rgomes@octobus.net>
Mon, 03 Jul 2023 15:28:17 +0200
branchstable
changeset 50735 2eaa883778f7
parent 50722 7e5be4a7cda7
child 52188 2cdd3e85abf7
permissions -rw-r--r--
heptapod-ci: (hopefully) fix the pipeline savings system There is no easy way for me to test this outside of the actual repo since it would require setting up `heptapod-runner` locally, making a Git repo with the right changes, etc. It's not worth my time at this point. If this fails, I'll try to ask for help from Georges, the maintainer of Heptapod.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
50722
7e5be4a7cda7 tests: use grep -E instead of obsolescent egrep
Mads Kiilerich <mads@kiilerich.com>
parents: 42903
diff changeset
     8
  > env | grep -E "^HG_USERVAR_(DEBUG|BYPASS_REVIEW)" | sort
33719
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
  > EOF
db3dc11356ed pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    15
db3dc11356ed pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    16
  $ hg init repo
db3dc11356ed pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    17
  $ hg clone -q repo child
db3dc11356ed pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    18
  $ cd child
db3dc11356ed pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    19
db3dc11356ed pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    20
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
    21
db3dc11356ed pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    22
  $ echo b > a
db3dc11356ed pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    23
  $ hg commit -Aqm a
db3dc11356ed pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    24
  $ 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
    25
  pushing to $TESTTMP/repo
33719
db3dc11356ed pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    26
  searching for changes
db3dc11356ed pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    27
  adding changesets
db3dc11356ed pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    28
  adding manifests
db3dc11356ed pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    29
  adding file changes
db3dc11356ed pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    30
  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
    31
db3dc11356ed pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    32
Setting pushvars.sever = true and then pushing.
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
  $ echo [push] >> $HGRCPATH
db3dc11356ed pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    35
  $ echo "pushvars.server = true" >> $HGRCPATH
db3dc11356ed pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    36
  $ echo b >> a
db3dc11356ed pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    37
  $ hg commit -Aqm a
db3dc11356ed pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    38
  $ 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
    39
  pushing to $TESTTMP/repo
33719
db3dc11356ed pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    40
  searching for changes
db3dc11356ed pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    41
  adding changesets
db3dc11356ed pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    42
  adding manifests
db3dc11356ed pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    43
  adding file changes
db3dc11356ed pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    44
  HG_USERVAR_BYPASS_REVIEW=true
db3dc11356ed pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    45
  HG_USERVAR_DEBUG=1
42903
d7304434390f changegroup: move message about added changes to transaction summary
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 36195
diff changeset
    46
  added 1 changesets with 1 changes to 1 files
33719
db3dc11356ed pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    47
db3dc11356ed pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    48
Test pushing var with empty right-hand side
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
  $ echo b >> a
db3dc11356ed pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    51
  $ hg commit -Aqm a
db3dc11356ed pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    52
  $ 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
    53
  pushing to $TESTTMP/repo
33719
db3dc11356ed pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    54
  searching for changes
db3dc11356ed pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    55
  adding changesets
db3dc11356ed pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    56
  adding manifests
db3dc11356ed pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    57
  adding file changes
42903
d7304434390f changegroup: move message about added changes to transaction summary
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 36195
diff changeset
    58
  HG_USERVAR_DEBUG=
33719
db3dc11356ed pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    59
  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
    60
db3dc11356ed pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    61
Test pushing bad vars
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
  $ echo b >> a
db3dc11356ed pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    64
  $ hg commit -Aqm b
db3dc11356ed pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    65
  $ 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
    66
  pushing to $TESTTMP/repo
33903
800bb35d891e pushvars: do not mangle repo state
Jun Wu <quark@fb.com>
parents: 33817
diff changeset
    67
  searching for changes
33719
db3dc11356ed pushvars: move fb extension pushvars to core
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    68
  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
    69
  [255]