tests/test-cat.t
author Gregory Szorc <gregory.szorc@gmail.com>
Tue, 06 Jan 2015 20:14:52 -0800
changeset 23745 513d47905114
parent 21078 50107a4b32e7
child 24381 82b82168d045
permissions -rw-r--r--
hgweb: extract changelist entry generation into own function I want to supplement changelist entries (used by shortlog and changelog endpoints) with custom metadata from an extension. i.e. I have extra per-changeset metadata that I wish to make available to templates so it can be rendered on hgweb. To facilitate this, I've extracted the logic for creating a changeset data structure into its own function, where it can be wrapped by extensions. Ideally, hgweb would use the same templater as the command line and have full access to templatekw.keywords. But that's a lot of work. This patch gets us some of the benefit without all the work. Many other hgweb commands could benefit from similar refactorings. I'm going to wait to see how this patch is received before I go crazy on extracting inline functions.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
11874
a3c1234b3761 tests: unify test-cat
Martin Geisler <mg@lazybytes.net>
parents: 6328
diff changeset
     1
  $ hg init
a3c1234b3761 tests: unify test-cat
Martin Geisler <mg@lazybytes.net>
parents: 6328
diff changeset
     2
  $ echo 0 > a
a3c1234b3761 tests: unify test-cat
Martin Geisler <mg@lazybytes.net>
parents: 6328
diff changeset
     3
  $ echo 0 > b
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 12070
diff changeset
     4
  $ hg ci -A -m m
11874
a3c1234b3761 tests: unify test-cat
Martin Geisler <mg@lazybytes.net>
parents: 6328
diff changeset
     5
  adding a
a3c1234b3761 tests: unify test-cat
Martin Geisler <mg@lazybytes.net>
parents: 6328
diff changeset
     6
  adding b
a3c1234b3761 tests: unify test-cat
Martin Geisler <mg@lazybytes.net>
parents: 6328
diff changeset
     7
  $ hg rm a
a3c1234b3761 tests: unify test-cat
Martin Geisler <mg@lazybytes.net>
parents: 6328
diff changeset
     8
  $ hg cat a
a3c1234b3761 tests: unify test-cat
Martin Geisler <mg@lazybytes.net>
parents: 6328
diff changeset
     9
  0
a3c1234b3761 tests: unify test-cat
Martin Geisler <mg@lazybytes.net>
parents: 6328
diff changeset
    10
  $ hg cat --decode a # more tests in test-encode
a3c1234b3761 tests: unify test-cat
Martin Geisler <mg@lazybytes.net>
parents: 6328
diff changeset
    11
  0
a3c1234b3761 tests: unify test-cat
Martin Geisler <mg@lazybytes.net>
parents: 6328
diff changeset
    12
  $ echo 1 > b
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 12070
diff changeset
    13
  $ hg ci -m m
11874
a3c1234b3761 tests: unify test-cat
Martin Geisler <mg@lazybytes.net>
parents: 6328
diff changeset
    14
  $ echo 2 > b
a3c1234b3761 tests: unify test-cat
Martin Geisler <mg@lazybytes.net>
parents: 6328
diff changeset
    15
  $ hg cat -r 0 a
a3c1234b3761 tests: unify test-cat
Martin Geisler <mg@lazybytes.net>
parents: 6328
diff changeset
    16
  0
a3c1234b3761 tests: unify test-cat
Martin Geisler <mg@lazybytes.net>
parents: 6328
diff changeset
    17
  $ hg cat -r 0 b
a3c1234b3761 tests: unify test-cat
Martin Geisler <mg@lazybytes.net>
parents: 6328
diff changeset
    18
  0
a3c1234b3761 tests: unify test-cat
Martin Geisler <mg@lazybytes.net>
parents: 6328
diff changeset
    19
  $ hg cat -r 1 a
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 12070
diff changeset
    20
  a: no such file in rev 7040230c159c
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    21
  [1]
11874
a3c1234b3761 tests: unify test-cat
Martin Geisler <mg@lazybytes.net>
parents: 6328
diff changeset
    22
  $ hg cat -r 1 b
a3c1234b3761 tests: unify test-cat
Martin Geisler <mg@lazybytes.net>
parents: 6328
diff changeset
    23
  1
17371
1310489eb5d6 fileset: fix generator vs list bug in fast path
Patrick Mezard <patrick@mezard.eu>
parents: 12316
diff changeset
    24
1310489eb5d6 fileset: fix generator vs list bug in fast path
Patrick Mezard <patrick@mezard.eu>
parents: 12316
diff changeset
    25
Test fileset
1310489eb5d6 fileset: fix generator vs list bug in fast path
Patrick Mezard <patrick@mezard.eu>
parents: 12316
diff changeset
    26
1310489eb5d6 fileset: fix generator vs list bug in fast path
Patrick Mezard <patrick@mezard.eu>
parents: 12316
diff changeset
    27
  $ echo 3 > c
1310489eb5d6 fileset: fix generator vs list bug in fast path
Patrick Mezard <patrick@mezard.eu>
parents: 12316
diff changeset
    28
  $ hg ci -Am addmore c
1310489eb5d6 fileset: fix generator vs list bug in fast path
Patrick Mezard <patrick@mezard.eu>
parents: 12316
diff changeset
    29
  $ hg cat 'set:not(b) or a'
1310489eb5d6 fileset: fix generator vs list bug in fast path
Patrick Mezard <patrick@mezard.eu>
parents: 12316
diff changeset
    30
  3
1310489eb5d6 fileset: fix generator vs list bug in fast path
Patrick Mezard <patrick@mezard.eu>
parents: 12316
diff changeset
    31
  $ hg cat 'set:c or b'
1310489eb5d6 fileset: fix generator vs list bug in fast path
Patrick Mezard <patrick@mezard.eu>
parents: 12316
diff changeset
    32
  1
1310489eb5d6 fileset: fix generator vs list bug in fast path
Patrick Mezard <patrick@mezard.eu>
parents: 12316
diff changeset
    33
  3
1310489eb5d6 fileset: fix generator vs list bug in fast path
Patrick Mezard <patrick@mezard.eu>
parents: 12316
diff changeset
    34
21078
50107a4b32e7 cat: explicitly document the supported formatter rules
Matt Harbison <matt_harbison@yahoo.com>
parents: 17371
diff changeset
    35
  $ mkdir tmp
50107a4b32e7 cat: explicitly document the supported formatter rules
Matt Harbison <matt_harbison@yahoo.com>
parents: 17371
diff changeset
    36
  $ hg cat --output tmp/HH_%H c
50107a4b32e7 cat: explicitly document the supported formatter rules
Matt Harbison <matt_harbison@yahoo.com>
parents: 17371
diff changeset
    37
  $ hg cat --output tmp/RR_%R c
50107a4b32e7 cat: explicitly document the supported formatter rules
Matt Harbison <matt_harbison@yahoo.com>
parents: 17371
diff changeset
    38
  $ hg cat --output tmp/h_%h c
50107a4b32e7 cat: explicitly document the supported formatter rules
Matt Harbison <matt_harbison@yahoo.com>
parents: 17371
diff changeset
    39
  $ hg cat --output tmp/r_%r c
50107a4b32e7 cat: explicitly document the supported formatter rules
Matt Harbison <matt_harbison@yahoo.com>
parents: 17371
diff changeset
    40
  $ hg cat --output tmp/%s_s c
50107a4b32e7 cat: explicitly document the supported formatter rules
Matt Harbison <matt_harbison@yahoo.com>
parents: 17371
diff changeset
    41
  $ hg cat --output tmp/%d%%_d c
50107a4b32e7 cat: explicitly document the supported formatter rules
Matt Harbison <matt_harbison@yahoo.com>
parents: 17371
diff changeset
    42
  $ hg cat --output tmp/%p_p c
50107a4b32e7 cat: explicitly document the supported formatter rules
Matt Harbison <matt_harbison@yahoo.com>
parents: 17371
diff changeset
    43
  $ hg log -r . --template "{rev}: {node|short}\n"
50107a4b32e7 cat: explicitly document the supported formatter rules
Matt Harbison <matt_harbison@yahoo.com>
parents: 17371
diff changeset
    44
  2: 45116003780e
50107a4b32e7 cat: explicitly document the supported formatter rules
Matt Harbison <matt_harbison@yahoo.com>
parents: 17371
diff changeset
    45
  $ find tmp -type f | sort
50107a4b32e7 cat: explicitly document the supported formatter rules
Matt Harbison <matt_harbison@yahoo.com>
parents: 17371
diff changeset
    46
  tmp/.%_d
50107a4b32e7 cat: explicitly document the supported formatter rules
Matt Harbison <matt_harbison@yahoo.com>
parents: 17371
diff changeset
    47
  tmp/HH_45116003780e3678b333fb2c99fa7d559c8457e9
50107a4b32e7 cat: explicitly document the supported formatter rules
Matt Harbison <matt_harbison@yahoo.com>
parents: 17371
diff changeset
    48
  tmp/RR_2
50107a4b32e7 cat: explicitly document the supported formatter rules
Matt Harbison <matt_harbison@yahoo.com>
parents: 17371
diff changeset
    49
  tmp/c_p
50107a4b32e7 cat: explicitly document the supported formatter rules
Matt Harbison <matt_harbison@yahoo.com>
parents: 17371
diff changeset
    50
  tmp/c_s
50107a4b32e7 cat: explicitly document the supported formatter rules
Matt Harbison <matt_harbison@yahoo.com>
parents: 17371
diff changeset
    51
  tmp/h_45116003780e
50107a4b32e7 cat: explicitly document the supported formatter rules
Matt Harbison <matt_harbison@yahoo.com>
parents: 17371
diff changeset
    52
  tmp/r_2
50107a4b32e7 cat: explicitly document the supported formatter rules
Matt Harbison <matt_harbison@yahoo.com>
parents: 17371
diff changeset
    53