tests/test-bugzilla.t
author Jun Wu <quark@fb.com>
Wed, 30 Nov 2016 19:25:18 +0000
changeset 30556 c059286a0f9c
parent 29102 22c53b3a390d
child 33432 fbfecd1dbfb5
permissions -rw-r--r--
tests: replace "cp -r" with "cp -R" The POSIX documentation about "cp" [1] says: .... RATIONALE .... Earlier versions of this standard included support for the -r option to copy file hierarchies. The -r option is historical practice on BSD and BSD-derived systems. This option is no longer specified by POSIX.1-2008 but may be present in some implementations. The -R option was added as a close synonym to the -r option, selected for consistency with all other options in this volume of POSIX.1-2008 that do recursive directory descent. The difference between -R and the removed -r option is in the treatment by cp of file types other than regular and directory. It was implementation-defined how the - option treated special files to allow both historical implementations and those that chose to support -r with the same abilities as -R defined by this volume of POSIX.1-2008. The original -r flag, for historic reasons, did not handle special files any differently from regular files, but always read the file and copied its contents. This had obvious problems in the presence of special file types; for example, character devices, FIFOs, and sockets. .... .... Issue 6 The -r option is marked obsolescent. .... Issue 7 .... The obsolescent -r option is removed. .... (No "Issue 8" yet) Therefore it's clear that "cp -R" is strictly better than "cp -r". The issue was discovered when running tests on OS X after 0d87b1caed92. [1]: pubs.opengroup.org/onlinepubs/9699919799/utilities/cp.html
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
28950
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
     1
mock bugzilla driver for testing template output:
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
     2
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
     3
  $ cat <<EOF > bzmock.py
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
     4
  > from __future__ import absolute_import
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
     5
  > from mercurial import extensions
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
     6
  > 
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
     7
  > def extsetup(ui):
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
     8
  >     bugzilla = extensions.find('bugzilla')
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
     9
  >     class bzmock(bugzilla.bzaccess):
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    10
  >         def __init__(self, ui):
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    11
  >             super(bzmock, self).__init__(ui)
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    12
  >             self._logfile = ui.config('bugzilla', 'mocklog')
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    13
  >         def updatebug(self, bugid, newstate, text, committer):
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    14
  >             with open(self._logfile, 'a') as f:
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    15
  >                 f.write('update bugid=%r, newstate=%r, committer=%r\n'
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    16
  >                         % (bugid, newstate, committer))
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    17
  >                 f.write('----\n' + text + '\n----\n')
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    18
  >         def notify(self, bugs, committer):
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    19
  >             with open(self._logfile, 'a') as f:
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    20
  >                 f.write('notify bugs=%r, committer=%r\n'
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    21
  >                         % (bugs, committer))
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    22
  >     bugzilla.bugzilla._versions['mock'] = bzmock
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    23
  > EOF
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    24
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    25
set up mock repository:
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    26
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    27
  $ hg init mockremote
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    28
  $ cat <<EOF > mockremote/.hg/hgrc
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    29
  > [extensions]
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    30
  > bugzilla =
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    31
  > bzmock = $TESTTMP/bzmock.py
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    32
  > 
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    33
  > [bugzilla]
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    34
  > version = mock
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    35
  > mocklog = $TESTTMP/bzmock.log
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    36
  > 
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    37
  > [hooks]
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    38
  > incoming.bugzilla = python:hgext.bugzilla.hook
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    39
  > 
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    40
  > [web]
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    41
  > baseurl=http://example.org/hg
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    42
  > 
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    43
  > %include $TESTTMP/bzstyle.hgrc
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    44
  > EOF
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    45
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    46
  $ hg clone -q mockremote mocklocal
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    47
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    48
push with default template:
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    49
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    50
  $ echo '[bugzilla]' > bzstyle.hgrc
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    51
  $ echo foo > mocklocal/foo
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    52
  $ hg ci -R mocklocal -Aqm 'Fixes bug 123'
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    53
  $ hg -R mocklocal push -q
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    54
  $ cat bzmock.log && rm bzmock.log
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    55
  update bugid=123, newstate={}, committer='test'
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    56
  ----
29102
22c53b3a390d tests: add globs for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 28950
diff changeset
    57
  changeset 7875a8342c6f in repo $TESTTMP/mockremote refers to bug 123. (glob)
28950
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    58
  details:
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    59
  	Fixes bug 123
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    60
  ----
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    61
  notify bugs={123: {}}, committer='test'
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    62
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    63
push with style:
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    64
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    65
  $ cat <<EOF > bzstyle.map
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    66
  > changeset = "{node|short} refers to bug {bug}."
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    67
  > EOF
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    68
  $ echo "style = $TESTTMP/bzstyle.map" >> bzstyle.hgrc
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    69
  $ echo foo >> mocklocal/foo
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    70
  $ hg ci -R mocklocal -qm 'Fixes bug 456'
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    71
  $ hg -R mocklocal push -q
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    72
  $ cat bzmock.log && rm bzmock.log
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    73
  update bugid=456, newstate={}, committer='test'
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    74
  ----
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    75
  2808b172464b refers to bug 456.
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    76
  ----
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    77
  notify bugs={456: {}}, committer='test'
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    78
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    79
push with template (overrides style):
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    80
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    81
  $ cat <<EOF >> bzstyle.hgrc
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    82
  > template = Changeset {node|short} in {root|basename}.
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    83
  >            {hgweb}/rev/{node|short}\n
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    84
  >            {desc}
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    85
  > EOF
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    86
  $ echo foo >> mocklocal/foo
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    87
  $ hg ci -R mocklocal -qm 'Fixes bug 789'
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    88
  $ hg -R mocklocal push -q
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    89
  $ cat bzmock.log && rm bzmock.log
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    90
  update bugid=789, newstate={}, committer='test'
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    91
  ----
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    92
  Changeset a770f3e409f2 in mockremote.
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    93
  http://example.org/hg/rev/a770f3e409f2
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    94
  
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    95
  Fixes bug 789
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    96
  ----
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    97
  notify bugs={789: {}}, committer='test'