annotate tests/test-phabricator.t @ 44550:bbb170f9396d

phabricator: add a `phabimport` command I've had `alias.phabimport = $hg phabread --stack $1 | $hg import --bypass -` for a while now, and I suspect others do too. That's limited though, in that it can't use the information on Phabricator to restore it in the original location, so I'm making it a first class command. This doesn't do anything ambitious like that- this is mostly a simplification of `hg import` to get the equivalent of the alias mentioned above. The `--bypass` option is hardcoded to be enabled and the message about amending rejects dropped (rejects aren't created with `--bypass`), because editing patches on Phabricator seems like an unusual workflow. This will need other options, like `--obsolete` and `--secret`. I think these would be more useful as config settings, as I imagine the workflows are pretty fixed depending on roles. Reviewers who don't queue patches probably never want `--obsolete`, but may need `--secret`. Reviewers who do will want the former, but not the latter. I left `--stack` as an option, but that should probably be a config knob too (or at least default to on)- if the point of this is to avoid rejects, it doesn't make sense to skip dependencies in most cases. Evolve is going to need a fix to its wrapping of `cmdutil.tryimportone()`, as it currently assumes `opts` has an `obsolete` key. It's worked around for now. Differential Revision: https://phab.mercurial-scm.org/D8136
author Matt Harbison <matt_harbison@yahoo.com>
date Sun, 16 Feb 2020 16:13:36 -0500
parents 09f3e003fc2a
children 9bae1d1a0f4c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
39651
a641fd1a1196 tests: add some basic tests of phabricator interactions
Augie Fackler <raf@durin42.com>
parents:
diff changeset
1 #require vcr
a641fd1a1196 tests: add some basic tests of phabricator interactions
Augie Fackler <raf@durin42.com>
parents:
diff changeset
2 $ cat >> $HGRCPATH <<EOF
a641fd1a1196 tests: add some basic tests of phabricator interactions
Augie Fackler <raf@durin42.com>
parents:
diff changeset
3 > [extensions]
39652
d2c81e83de2a phabricator: move extension from contrib to hgext
Augie Fackler <raf@durin42.com>
parents: 39651
diff changeset
4 > phabricator =
39651
a641fd1a1196 tests: add some basic tests of phabricator interactions
Augie Fackler <raf@durin42.com>
parents:
diff changeset
5 > EOF
a641fd1a1196 tests: add some basic tests of phabricator interactions
Augie Fackler <raf@durin42.com>
parents:
diff changeset
6 $ hg init repo
a641fd1a1196 tests: add some basic tests of phabricator interactions
Augie Fackler <raf@durin42.com>
parents:
diff changeset
7 $ cd repo
a641fd1a1196 tests: add some basic tests of phabricator interactions
Augie Fackler <raf@durin42.com>
parents:
diff changeset
8 $ cat >> .hg/hgrc <<EOF
a641fd1a1196 tests: add some basic tests of phabricator interactions
Augie Fackler <raf@durin42.com>
parents:
diff changeset
9 > [phabricator]
a641fd1a1196 tests: add some basic tests of phabricator interactions
Augie Fackler <raf@durin42.com>
parents:
diff changeset
10 > url = https://phab.mercurial-scm.org/
a641fd1a1196 tests: add some basic tests of phabricator interactions
Augie Fackler <raf@durin42.com>
parents:
diff changeset
11 > callsign = HG
a641fd1a1196 tests: add some basic tests of phabricator interactions
Augie Fackler <raf@durin42.com>
parents:
diff changeset
12 >
a641fd1a1196 tests: add some basic tests of phabricator interactions
Augie Fackler <raf@durin42.com>
parents:
diff changeset
13 > [auth]
a641fd1a1196 tests: add some basic tests of phabricator interactions
Augie Fackler <raf@durin42.com>
parents:
diff changeset
14 > hgphab.schemes = https
a641fd1a1196 tests: add some basic tests of phabricator interactions
Augie Fackler <raf@durin42.com>
parents:
diff changeset
15 > hgphab.prefix = phab.mercurial-scm.org
a641fd1a1196 tests: add some basic tests of phabricator interactions
Augie Fackler <raf@durin42.com>
parents:
diff changeset
16 > # When working on the extension and making phabricator interaction
a641fd1a1196 tests: add some basic tests of phabricator interactions
Augie Fackler <raf@durin42.com>
parents:
diff changeset
17 > # changes, edit this to be a real phabricator token. When done, edit
42443
d3c81439e2ee phabricator: auto-sanitise API tokens and HTTP cookies from VCR recordings
Ian Moody <moz-ian@perix.co.uk>
parents: 42431
diff changeset
18 > # it back. The VCR transcripts will be auto-sanitised to replace your real
d3c81439e2ee phabricator: auto-sanitise API tokens and HTTP cookies from VCR recordings
Ian Moody <moz-ian@perix.co.uk>
parents: 42431
diff changeset
19 > # token with this value.
39651
a641fd1a1196 tests: add some basic tests of phabricator interactions
Augie Fackler <raf@durin42.com>
parents:
diff changeset
20 > hgphab.phabtoken = cli-hahayouwish
a641fd1a1196 tests: add some basic tests of phabricator interactions
Augie Fackler <raf@durin42.com>
parents:
diff changeset
21 > EOF
a641fd1a1196 tests: add some basic tests of phabricator interactions
Augie Fackler <raf@durin42.com>
parents:
diff changeset
22 $ VCR="$TESTDIR/phabricator"
44125
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
23
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
24 Error is handled reasonably. We override the phabtoken here so that
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
25 when you're developing changes to phabricator.py you can edit the
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
26 above config and have a real token in the test but not have to edit
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
27 this test.
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
28 $ hg phabread --config auth.hgphab.phabtoken=cli-notavalidtoken \
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
29 > --test-vcr "$VCR/phabread-conduit-error.json" D4480 | head
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
30 abort: Conduit Error (ERR-INVALID-AUTH): API token "cli-notavalidtoken" has the wrong length. API tokens should be 32 characters long.
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
31
44436
09f3e003fc2a phabricator: avoid a stacktrace when command arguments are missing
Matt Harbison <matt_harbison@yahoo.com>
parents: 44329
diff changeset
32 Missing arguments print the command help
09f3e003fc2a phabricator: avoid a stacktrace when command arguments are missing
Matt Harbison <matt_harbison@yahoo.com>
parents: 44329
diff changeset
33
09f3e003fc2a phabricator: avoid a stacktrace when command arguments are missing
Matt Harbison <matt_harbison@yahoo.com>
parents: 44329
diff changeset
34 $ hg phabread
09f3e003fc2a phabricator: avoid a stacktrace when command arguments are missing
Matt Harbison <matt_harbison@yahoo.com>
parents: 44329
diff changeset
35 hg phabread: invalid arguments
09f3e003fc2a phabricator: avoid a stacktrace when command arguments are missing
Matt Harbison <matt_harbison@yahoo.com>
parents: 44329
diff changeset
36 hg phabread DREVSPEC [OPTIONS]
09f3e003fc2a phabricator: avoid a stacktrace when command arguments are missing
Matt Harbison <matt_harbison@yahoo.com>
parents: 44329
diff changeset
37
09f3e003fc2a phabricator: avoid a stacktrace when command arguments are missing
Matt Harbison <matt_harbison@yahoo.com>
parents: 44329
diff changeset
38 print patches from Phabricator suitable for importing
09f3e003fc2a phabricator: avoid a stacktrace when command arguments are missing
Matt Harbison <matt_harbison@yahoo.com>
parents: 44329
diff changeset
39
09f3e003fc2a phabricator: avoid a stacktrace when command arguments are missing
Matt Harbison <matt_harbison@yahoo.com>
parents: 44329
diff changeset
40 options:
09f3e003fc2a phabricator: avoid a stacktrace when command arguments are missing
Matt Harbison <matt_harbison@yahoo.com>
parents: 44329
diff changeset
41
09f3e003fc2a phabricator: avoid a stacktrace when command arguments are missing
Matt Harbison <matt_harbison@yahoo.com>
parents: 44329
diff changeset
42 --stack read dependencies
09f3e003fc2a phabricator: avoid a stacktrace when command arguments are missing
Matt Harbison <matt_harbison@yahoo.com>
parents: 44329
diff changeset
43
09f3e003fc2a phabricator: avoid a stacktrace when command arguments are missing
Matt Harbison <matt_harbison@yahoo.com>
parents: 44329
diff changeset
44 (use 'hg phabread -h' to show more help)
09f3e003fc2a phabricator: avoid a stacktrace when command arguments are missing
Matt Harbison <matt_harbison@yahoo.com>
parents: 44329
diff changeset
45 [255]
09f3e003fc2a phabricator: avoid a stacktrace when command arguments are missing
Matt Harbison <matt_harbison@yahoo.com>
parents: 44329
diff changeset
46
44125
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
47 Basic phabread:
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
48 $ hg phabread --test-vcr "$VCR/phabread-4480.json" D4480 | head
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
49 # HG changeset patch
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
50 # Date 1536771503 0
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
51 # Parent a5de21c9e3703f8e8eb064bd7d893ff2f703c66a
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
52 exchangev2: start to implement pull with wire protocol v2
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
53
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
54 Wire protocol version 2 will take a substantially different
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
55 approach to exchange than version 1 (at least as far as pulling
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
56 is concerned).
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
57
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
58 This commit establishes a new exchangev2 module for holding
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
59
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
60 phabupdate with an accept:
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
61 $ hg phabupdate --accept D4564 \
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
62 > -m 'I think I like where this is headed. Will read rest of series later.'\
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
63 > --test-vcr "$VCR/accept-4564.json"
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
64 abort: Conduit Error (ERR-CONDUIT-CORE): Validation errors:
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
65 - You can not accept this revision because it has already been closed. Only open revisions can be accepted.
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
66 [255]
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
67 $ hg phabupdate --accept D7913 -m 'LGTM' --test-vcr "$VCR/accept-7913.json"
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
68
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
69 Create a differential diff:
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
70 $ HGENCODING=utf-8; export HGENCODING
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
71 $ echo alpha > alpha
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
72 $ hg ci --addremove -m 'create alpha for phabricator test €'
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
73 adding alpha
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
74 $ hg phabsend -r . --test-vcr "$VCR/phabsend-create-alpha.json"
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
75 D7915 - created - d386117f30e6: create alpha for phabricator test \xe2\x82\xac (esc)
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
76 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/d386117f30e6-24ffe649-phabsend.hg
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
77 $ echo more >> alpha
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
78 $ HGEDITOR=true hg ci --amend
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
79 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/347bf67801e5-3bf313e4-amend.hg
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
80 $ echo beta > beta
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
81 $ hg ci --addremove -m 'create beta for phabricator test'
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
82 adding beta
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
83 $ hg phabsend -r ".^::" --test-vcr "$VCR/phabsend-update-alpha-create-beta.json"
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
84 D7915 - updated - c44b38f24a45: create alpha for phabricator test \xe2\x82\xac (esc)
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
85 D7916 - created - 9e6901f21d5b: create beta for phabricator test
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
86 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/9e6901f21d5b-1fcd4f0e-phabsend.hg
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
87 $ unset HGENCODING
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
88
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
89 The amend won't explode after posting a public commit. The local tag is left
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
90 behind to identify it.
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
91
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
92 $ echo 'public change' > beta
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
93 $ hg ci -m 'create public change for phabricator testing'
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
94 $ hg phase --public .
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
95 $ echo 'draft change' > alpha
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
96 $ hg ci -m 'create draft change for phabricator testing'
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
97 $ hg phabsend --amend -r '.^::' --test-vcr "$VCR/phabsend-create-public.json"
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
98 D7917 - created - 7b4185ab5d16: create public change for phabricator testing
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
99 D7918 - created - 251c1c333fc6: create draft change for phabricator testing
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
100 warning: not updating public commit 2:7b4185ab5d16
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
101 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/251c1c333fc6-41cb7c3b-phabsend.hg
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
102 $ hg tags -v
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
103 tip 3:3244dc4a3334
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
104 D7917 2:7b4185ab5d16 local
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
105
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
106 $ hg debugcallconduit user.search --test-vcr "$VCR/phab-conduit.json" <<EOF
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
107 > {
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
108 > "constraints": {
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
109 > "isBot": true
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
110 > }
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
111 > }
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
112 > EOF
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
113 {
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
114 "cursor": {
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
115 "after": null,
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
116 "before": null,
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
117 "limit": 100,
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
118 "order": null
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
119 },
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
120 "data": [],
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
121 "maps": {},
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
122 "query": {
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
123 "queryKey": null
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
124 }
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
125 }
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
126
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
127 Template keywords
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
128 $ hg log -T'{rev} {phabreview|json}\n'
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
129 3 {"id": "D7918", "url": "https://phab.mercurial-scm.org/D7918"}
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
130 2 {"id": "D7917", "url": "https://phab.mercurial-scm.org/D7917"}
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
131 1 {"id": "D7916", "url": "https://phab.mercurial-scm.org/D7916"}
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
132 0 {"id": "D7915", "url": "https://phab.mercurial-scm.org/D7915"}
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
133
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
134 $ hg log -T'{rev} {if(phabreview, "{phabreview.url} {phabreview.id}")}\n'
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
135 3 https://phab.mercurial-scm.org/D7918 D7918
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
136 2 https://phab.mercurial-scm.org/D7917 D7917
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
137 1 https://phab.mercurial-scm.org/D7916 D7916
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
138 0 https://phab.mercurial-scm.org/D7915 D7915
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
139
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
140 Commenting when phabsending:
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
141 $ echo comment > comment
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
142 $ hg ci --addremove -m "create comment for phabricator test"
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
143 adding comment
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
144 $ hg phabsend -r . -m "For default branch" --test-vcr "$VCR/phabsend-comment-created.json"
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
145 D7919 - created - d5dddca9023d: create comment for phabricator test
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
146 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/d5dddca9023d-adf673ba-phabsend.hg
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
147 $ echo comment2 >> comment
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
148 $ hg ci --amend
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
149 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/f7db812bbe1d-8fcded77-amend.hg
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
150 $ hg phabsend -r . -m "Address review comments" --test-vcr "$VCR/phabsend-comment-updated.json"
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
151 D7919 - updated - 1849d7828727: create comment for phabricator test
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
152
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
153 Phabsending a skipped commit:
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
154 $ hg phabsend --no-amend -r . --test-vcr "$VCR/phabsend-skipped.json"
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
155 D7919 - skipped - 1849d7828727: create comment for phabricator test
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
156
44169
5d85e9ddc7b9 phabricator: fix a crash when submitting binaries (issue6260)
Matt Harbison <matt_harbison@yahoo.com>
parents: 44128
diff changeset
157 Phabesending a new binary, a modified binary, and a removed binary
5d85e9ddc7b9 phabricator: fix a crash when submitting binaries (issue6260)
Matt Harbison <matt_harbison@yahoo.com>
parents: 44128
diff changeset
158
5d85e9ddc7b9 phabricator: fix a crash when submitting binaries (issue6260)
Matt Harbison <matt_harbison@yahoo.com>
parents: 44128
diff changeset
159 >>> open('bin', 'wb').write(b'\0a') and None
5d85e9ddc7b9 phabricator: fix a crash when submitting binaries (issue6260)
Matt Harbison <matt_harbison@yahoo.com>
parents: 44128
diff changeset
160 $ hg ci -Am 'add binary'
5d85e9ddc7b9 phabricator: fix a crash when submitting binaries (issue6260)
Matt Harbison <matt_harbison@yahoo.com>
parents: 44128
diff changeset
161 adding bin
5d85e9ddc7b9 phabricator: fix a crash when submitting binaries (issue6260)
Matt Harbison <matt_harbison@yahoo.com>
parents: 44128
diff changeset
162 >>> open('bin', 'wb').write(b'\0b') and None
5d85e9ddc7b9 phabricator: fix a crash when submitting binaries (issue6260)
Matt Harbison <matt_harbison@yahoo.com>
parents: 44128
diff changeset
163 $ hg ci -m 'modify binary'
5d85e9ddc7b9 phabricator: fix a crash when submitting binaries (issue6260)
Matt Harbison <matt_harbison@yahoo.com>
parents: 44128
diff changeset
164 $ hg rm bin
5d85e9ddc7b9 phabricator: fix a crash when submitting binaries (issue6260)
Matt Harbison <matt_harbison@yahoo.com>
parents: 44128
diff changeset
165 $ hg ci -m 'remove binary'
5d85e9ddc7b9 phabricator: fix a crash when submitting binaries (issue6260)
Matt Harbison <matt_harbison@yahoo.com>
parents: 44128
diff changeset
166 $ hg phabsend -r .~2:: --test-vcr "$VCR/phabsend-binary.json"
5d85e9ddc7b9 phabricator: fix a crash when submitting binaries (issue6260)
Matt Harbison <matt_harbison@yahoo.com>
parents: 44128
diff changeset
167 uploading bin@aa24a81f55de
5d85e9ddc7b9 phabricator: fix a crash when submitting binaries (issue6260)
Matt Harbison <matt_harbison@yahoo.com>
parents: 44128
diff changeset
168 D8007 - created - aa24a81f55de: add binary
5d85e9ddc7b9 phabricator: fix a crash when submitting binaries (issue6260)
Matt Harbison <matt_harbison@yahoo.com>
parents: 44128
diff changeset
169 uploading bin@d8d62a881b54
5d85e9ddc7b9 phabricator: fix a crash when submitting binaries (issue6260)
Matt Harbison <matt_harbison@yahoo.com>
parents: 44128
diff changeset
170 D8008 - created - d8d62a881b54: modify binary
5d85e9ddc7b9 phabricator: fix a crash when submitting binaries (issue6260)
Matt Harbison <matt_harbison@yahoo.com>
parents: 44128
diff changeset
171 D8009 - created - af55645b2e29: remove binary
5d85e9ddc7b9 phabricator: fix a crash when submitting binaries (issue6260)
Matt Harbison <matt_harbison@yahoo.com>
parents: 44128
diff changeset
172 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/aa24a81f55de-a3a0cf24-phabsend.hg
5d85e9ddc7b9 phabricator: fix a crash when submitting binaries (issue6260)
Matt Harbison <matt_harbison@yahoo.com>
parents: 44128
diff changeset
173
44329
d1177d39012e phabricator: fix a phabsend crash when processing a renamed binary
Matt Harbison <matt_harbison@yahoo.com>
parents: 44169
diff changeset
174 Phabsend a renamed binary and a copied binary, with and without content changes
d1177d39012e phabricator: fix a phabsend crash when processing a renamed binary
Matt Harbison <matt_harbison@yahoo.com>
parents: 44169
diff changeset
175 to src and dest
d1177d39012e phabricator: fix a phabsend crash when processing a renamed binary
Matt Harbison <matt_harbison@yahoo.com>
parents: 44169
diff changeset
176
d1177d39012e phabricator: fix a phabsend crash when processing a renamed binary
Matt Harbison <matt_harbison@yahoo.com>
parents: 44169
diff changeset
177 >>> open('bin2', 'wb').write(b'\0c') and None
d1177d39012e phabricator: fix a phabsend crash when processing a renamed binary
Matt Harbison <matt_harbison@yahoo.com>
parents: 44169
diff changeset
178 $ hg ci -Am 'add another binary'
d1177d39012e phabricator: fix a phabsend crash when processing a renamed binary
Matt Harbison <matt_harbison@yahoo.com>
parents: 44169
diff changeset
179 adding bin2
d1177d39012e phabricator: fix a phabsend crash when processing a renamed binary
Matt Harbison <matt_harbison@yahoo.com>
parents: 44169
diff changeset
180
d1177d39012e phabricator: fix a phabsend crash when processing a renamed binary
Matt Harbison <matt_harbison@yahoo.com>
parents: 44169
diff changeset
181 TODO: "bin2" can't be viewed in this commit (left or right side), and the URL
d1177d39012e phabricator: fix a phabsend crash when processing a renamed binary
Matt Harbison <matt_harbison@yahoo.com>
parents: 44169
diff changeset
182 looks much different than when viewing "bin2_moved". No idea if this is a phab
d1177d39012e phabricator: fix a phabsend crash when processing a renamed binary
Matt Harbison <matt_harbison@yahoo.com>
parents: 44169
diff changeset
183 bug, or phabsend bug. The patch (as printed by phabread) look reasonable
d1177d39012e phabricator: fix a phabsend crash when processing a renamed binary
Matt Harbison <matt_harbison@yahoo.com>
parents: 44169
diff changeset
184 though.
d1177d39012e phabricator: fix a phabsend crash when processing a renamed binary
Matt Harbison <matt_harbison@yahoo.com>
parents: 44169
diff changeset
185
d1177d39012e phabricator: fix a phabsend crash when processing a renamed binary
Matt Harbison <matt_harbison@yahoo.com>
parents: 44169
diff changeset
186 $ hg mv bin2 bin2_moved
d1177d39012e phabricator: fix a phabsend crash when processing a renamed binary
Matt Harbison <matt_harbison@yahoo.com>
parents: 44169
diff changeset
187 $ hg ci -m "moved binary"
d1177d39012e phabricator: fix a phabsend crash when processing a renamed binary
Matt Harbison <matt_harbison@yahoo.com>
parents: 44169
diff changeset
188
d1177d39012e phabricator: fix a phabsend crash when processing a renamed binary
Matt Harbison <matt_harbison@yahoo.com>
parents: 44169
diff changeset
189 Note: "bin2_moved" is also not viewable in phabricator with this review
d1177d39012e phabricator: fix a phabsend crash when processing a renamed binary
Matt Harbison <matt_harbison@yahoo.com>
parents: 44169
diff changeset
190
d1177d39012e phabricator: fix a phabsend crash when processing a renamed binary
Matt Harbison <matt_harbison@yahoo.com>
parents: 44169
diff changeset
191 $ hg cp bin2_moved bin2_copied
d1177d39012e phabricator: fix a phabsend crash when processing a renamed binary
Matt Harbison <matt_harbison@yahoo.com>
parents: 44169
diff changeset
192 $ hg ci -m "copied binary"
d1177d39012e phabricator: fix a phabsend crash when processing a renamed binary
Matt Harbison <matt_harbison@yahoo.com>
parents: 44169
diff changeset
193
d1177d39012e phabricator: fix a phabsend crash when processing a renamed binary
Matt Harbison <matt_harbison@yahoo.com>
parents: 44169
diff changeset
194 Note: "bin2_moved_again" is marked binary in phabricator, and both sides of it
d1177d39012e phabricator: fix a phabsend crash when processing a renamed binary
Matt Harbison <matt_harbison@yahoo.com>
parents: 44169
diff changeset
195 are viewable in their proper state. "bin2_copied" is not viewable, and not
d1177d39012e phabricator: fix a phabsend crash when processing a renamed binary
Matt Harbison <matt_harbison@yahoo.com>
parents: 44169
diff changeset
196 listed as binary in phabricator.
d1177d39012e phabricator: fix a phabsend crash when processing a renamed binary
Matt Harbison <matt_harbison@yahoo.com>
parents: 44169
diff changeset
197
d1177d39012e phabricator: fix a phabsend crash when processing a renamed binary
Matt Harbison <matt_harbison@yahoo.com>
parents: 44169
diff changeset
198 >>> open('bin2_copied', 'wb').write(b'\0move+mod') and None
d1177d39012e phabricator: fix a phabsend crash when processing a renamed binary
Matt Harbison <matt_harbison@yahoo.com>
parents: 44169
diff changeset
199 $ hg mv bin2_copied bin2_moved_again
d1177d39012e phabricator: fix a phabsend crash when processing a renamed binary
Matt Harbison <matt_harbison@yahoo.com>
parents: 44169
diff changeset
200 $ hg ci -m "move+mod copied binary"
d1177d39012e phabricator: fix a phabsend crash when processing a renamed binary
Matt Harbison <matt_harbison@yahoo.com>
parents: 44169
diff changeset
201
d1177d39012e phabricator: fix a phabsend crash when processing a renamed binary
Matt Harbison <matt_harbison@yahoo.com>
parents: 44169
diff changeset
202 Note: "bin2_moved" and "bin2_moved_copy" are both marked binary, and both
d1177d39012e phabricator: fix a phabsend crash when processing a renamed binary
Matt Harbison <matt_harbison@yahoo.com>
parents: 44169
diff changeset
203 viewable on each side.
d1177d39012e phabricator: fix a phabsend crash when processing a renamed binary
Matt Harbison <matt_harbison@yahoo.com>
parents: 44169
diff changeset
204
d1177d39012e phabricator: fix a phabsend crash when processing a renamed binary
Matt Harbison <matt_harbison@yahoo.com>
parents: 44169
diff changeset
205 >>> open('bin2_moved', 'wb').write(b'\0precopy mod') and None
d1177d39012e phabricator: fix a phabsend crash when processing a renamed binary
Matt Harbison <matt_harbison@yahoo.com>
parents: 44169
diff changeset
206 $ hg cp bin2_moved bin2_moved_copied
d1177d39012e phabricator: fix a phabsend crash when processing a renamed binary
Matt Harbison <matt_harbison@yahoo.com>
parents: 44169
diff changeset
207 >>> open('bin2_moved', 'wb').write(b'\0copy src+mod') and None
d1177d39012e phabricator: fix a phabsend crash when processing a renamed binary
Matt Harbison <matt_harbison@yahoo.com>
parents: 44169
diff changeset
208 $ hg ci -m "copy+mod moved binary"
d1177d39012e phabricator: fix a phabsend crash when processing a renamed binary
Matt Harbison <matt_harbison@yahoo.com>
parents: 44169
diff changeset
209
d1177d39012e phabricator: fix a phabsend crash when processing a renamed binary
Matt Harbison <matt_harbison@yahoo.com>
parents: 44169
diff changeset
210 $ hg phabsend -r .~4:: --test-vcr "$VCR/phabsend-binary-renames.json"
d1177d39012e phabricator: fix a phabsend crash when processing a renamed binary
Matt Harbison <matt_harbison@yahoo.com>
parents: 44169
diff changeset
211 uploading bin2@f42f9195e00c
d1177d39012e phabricator: fix a phabsend crash when processing a renamed binary
Matt Harbison <matt_harbison@yahoo.com>
parents: 44169
diff changeset
212 D8128 - created - f42f9195e00c: add another binary
d1177d39012e phabricator: fix a phabsend crash when processing a renamed binary
Matt Harbison <matt_harbison@yahoo.com>
parents: 44169
diff changeset
213 D8129 - created - 834ab31d80ae: moved binary
d1177d39012e phabricator: fix a phabsend crash when processing a renamed binary
Matt Harbison <matt_harbison@yahoo.com>
parents: 44169
diff changeset
214 D8130 - created - 494b750e5194: copied binary
d1177d39012e phabricator: fix a phabsend crash when processing a renamed binary
Matt Harbison <matt_harbison@yahoo.com>
parents: 44169
diff changeset
215 uploading bin2_moved_again@25f766b50cc2
d1177d39012e phabricator: fix a phabsend crash when processing a renamed binary
Matt Harbison <matt_harbison@yahoo.com>
parents: 44169
diff changeset
216 D8131 - created - 25f766b50cc2: move+mod copied binary
d1177d39012e phabricator: fix a phabsend crash when processing a renamed binary
Matt Harbison <matt_harbison@yahoo.com>
parents: 44169
diff changeset
217 uploading bin2_moved_copied@1b87b363a5e4
d1177d39012e phabricator: fix a phabsend crash when processing a renamed binary
Matt Harbison <matt_harbison@yahoo.com>
parents: 44169
diff changeset
218 uploading bin2_moved@1b87b363a5e4
d1177d39012e phabricator: fix a phabsend crash when processing a renamed binary
Matt Harbison <matt_harbison@yahoo.com>
parents: 44169
diff changeset
219 D8132 - created - 1b87b363a5e4: copy+mod moved binary
d1177d39012e phabricator: fix a phabsend crash when processing a renamed binary
Matt Harbison <matt_harbison@yahoo.com>
parents: 44169
diff changeset
220 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/f42f9195e00c-e82a0769-phabsend.hg
d1177d39012e phabricator: fix a phabsend crash when processing a renamed binary
Matt Harbison <matt_harbison@yahoo.com>
parents: 44169
diff changeset
221
44125
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
222 Phabreading a DREV with a local:commits time as a string:
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
223 $ hg phabread --test-vcr "$VCR/phabread-str-time.json" D1285
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
224 # HG changeset patch
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
225 # User Pulkit Goyal <7895pulkit@gmail.com>
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
226 # Date 1509404054 -19800
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
227 # Node ID 44fc1c1f1774a76423b9c732af6938435099bcc5
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
228 # Parent 8feef8ef8389a3b544e0a74624f1efc3a8d85d35
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
229 repoview: add a new attribute _visibilityexceptions and related API
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
230
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
231 Currently we don't have a defined way in core to make some hidden revisions
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
232 visible in filtered repo. Extensions to achieve the purpose of unhiding some
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
233 hidden commits, wrap repoview.pinnedrevs() function.
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
234
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
235 To make the above task simple and have well defined API, this patch adds a new
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
236 attribute '_visibilityexceptions' to repoview class which will contains
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
237 the hidden revs which should be exception.
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
238 This will allow to set different exceptions for different repoview objects
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
239 backed by the same unfiltered repo.
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
240
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
241 This patch also adds API to add revs to the attribute set and get them.
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
242
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
243 Thanks to Jun for suggesting the use of repoview class instead of localrepo.
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
244
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
245 Differential Revision: https://phab.mercurial-scm.org/D1285
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
246 diff --git a/mercurial/repoview.py b/mercurial/repoview.py
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
247 --- a/mercurial/repoview.py
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
248 +++ b/mercurial/repoview.py
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
249 @@ * @@ (glob)
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
250 subclasses of `localrepo`. Eg: `bundlerepo` or `statichttprepo`.
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
251 """
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
252
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
253 + # hidden revs which should be visible
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
254 + _visibilityexceptions = set()
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
255 +
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
256 def __init__(self, repo, filtername):
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
257 object.__setattr__(self, r'_unfilteredrepo', repo)
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
258 object.__setattr__(self, r'filtername', filtername)
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
259 @@ -231,6 +234,14 @@
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
260 return self
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
261 return self.unfiltered().filtered(name)
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
262
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
263 + def addvisibilityexceptions(self, revs):
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
264 + """adds hidden revs which should be visible to set of exceptions"""
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
265 + self._visibilityexceptions.update(revs)
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
266 +
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
267 + def getvisibilityexceptions(self):
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
268 + """returns the set of hidden revs which should be visible"""
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
269 + return self._visibilityexceptions
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
270 +
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
271 # everything access are forwarded to the proxied repo
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
272 def __getattr__(self, attr):
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
273 return getattr(self._unfilteredrepo, attr)
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
274 diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
275 --- a/mercurial/localrepo.py
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
276 +++ b/mercurial/localrepo.py
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
277 @@ -570,6 +570,14 @@
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
278 def close(self):
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
279 self._writecaches()
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
280
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
281 + def addvisibilityexceptions(self, exceptions):
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
282 + # should be called on a filtered repository
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
283 + pass
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
284 +
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
285 + def getvisibilityexceptions(self):
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
286 + # should be called on a filtered repository
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
287 + return set()
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
288 +
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
289 def _loadextensions(self):
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
290 extensions.loadall(self.ui)
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
291
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
292
44127
59b3fe1e2021 phabricator: use .arcconfig for the callsign if not set locally (issue6243)
Matt Harbison <matt_harbison@yahoo.com>
parents: 44125
diff changeset
293 A bad .arcconfig doesn't error out
59b3fe1e2021 phabricator: use .arcconfig for the callsign if not set locally (issue6243)
Matt Harbison <matt_harbison@yahoo.com>
parents: 44125
diff changeset
294 $ echo 'garbage' > .arcconfig
59b3fe1e2021 phabricator: use .arcconfig for the callsign if not set locally (issue6243)
Matt Harbison <matt_harbison@yahoo.com>
parents: 44125
diff changeset
295 $ hg config phabricator --debug
59b3fe1e2021 phabricator: use .arcconfig for the callsign if not set locally (issue6243)
Matt Harbison <matt_harbison@yahoo.com>
parents: 44125
diff changeset
296 invalid JSON in $TESTTMP/repo/.arcconfig
59b3fe1e2021 phabricator: use .arcconfig for the callsign if not set locally (issue6243)
Matt Harbison <matt_harbison@yahoo.com>
parents: 44125
diff changeset
297 read config from: */.hgrc (glob)
59b3fe1e2021 phabricator: use .arcconfig for the callsign if not set locally (issue6243)
Matt Harbison <matt_harbison@yahoo.com>
parents: 44125
diff changeset
298 $TESTTMP/repo/.hg/hgrc:*: phabricator.url=https://phab.mercurial-scm.org/ (glob)
59b3fe1e2021 phabricator: use .arcconfig for the callsign if not set locally (issue6243)
Matt Harbison <matt_harbison@yahoo.com>
parents: 44125
diff changeset
299 $TESTTMP/repo/.hg/hgrc:*: phabricator.callsign=HG (glob)
59b3fe1e2021 phabricator: use .arcconfig for the callsign if not set locally (issue6243)
Matt Harbison <matt_harbison@yahoo.com>
parents: 44125
diff changeset
300
59b3fe1e2021 phabricator: use .arcconfig for the callsign if not set locally (issue6243)
Matt Harbison <matt_harbison@yahoo.com>
parents: 44125
diff changeset
301 The .arcconfig content overrides global config
59b3fe1e2021 phabricator: use .arcconfig for the callsign if not set locally (issue6243)
Matt Harbison <matt_harbison@yahoo.com>
parents: 44125
diff changeset
302 $ cat >> $HGRCPATH << EOF
59b3fe1e2021 phabricator: use .arcconfig for the callsign if not set locally (issue6243)
Matt Harbison <matt_harbison@yahoo.com>
parents: 44125
diff changeset
303 > [phabricator]
59b3fe1e2021 phabricator: use .arcconfig for the callsign if not set locally (issue6243)
Matt Harbison <matt_harbison@yahoo.com>
parents: 44125
diff changeset
304 > url = global
59b3fe1e2021 phabricator: use .arcconfig for the callsign if not set locally (issue6243)
Matt Harbison <matt_harbison@yahoo.com>
parents: 44125
diff changeset
305 > callsign = global
59b3fe1e2021 phabricator: use .arcconfig for the callsign if not set locally (issue6243)
Matt Harbison <matt_harbison@yahoo.com>
parents: 44125
diff changeset
306 > EOF
59b3fe1e2021 phabricator: use .arcconfig for the callsign if not set locally (issue6243)
Matt Harbison <matt_harbison@yahoo.com>
parents: 44125
diff changeset
307 $ cp $TESTDIR/../.arcconfig .
59b3fe1e2021 phabricator: use .arcconfig for the callsign if not set locally (issue6243)
Matt Harbison <matt_harbison@yahoo.com>
parents: 44125
diff changeset
308 $ mv .hg/hgrc .hg/hgrc.bak
59b3fe1e2021 phabricator: use .arcconfig for the callsign if not set locally (issue6243)
Matt Harbison <matt_harbison@yahoo.com>
parents: 44125
diff changeset
309 $ hg config phabricator --debug
59b3fe1e2021 phabricator: use .arcconfig for the callsign if not set locally (issue6243)
Matt Harbison <matt_harbison@yahoo.com>
parents: 44125
diff changeset
310 read config from: */.hgrc (glob)
59b3fe1e2021 phabricator: use .arcconfig for the callsign if not set locally (issue6243)
Matt Harbison <matt_harbison@yahoo.com>
parents: 44125
diff changeset
311 $TESTTMP/repo/.arcconfig: phabricator.callsign=HG
44128
ff396501e841 phabricator: use .arcconfig for `phabricator.url` if not set locally
Matt Harbison <matt_harbison@yahoo.com>
parents: 44127
diff changeset
312 $TESTTMP/repo/.arcconfig: phabricator.url=https://phab.mercurial-scm.org/
44127
59b3fe1e2021 phabricator: use .arcconfig for the callsign if not set locally (issue6243)
Matt Harbison <matt_harbison@yahoo.com>
parents: 44125
diff changeset
313
59b3fe1e2021 phabricator: use .arcconfig for the callsign if not set locally (issue6243)
Matt Harbison <matt_harbison@yahoo.com>
parents: 44125
diff changeset
314 But it doesn't override local config
59b3fe1e2021 phabricator: use .arcconfig for the callsign if not set locally (issue6243)
Matt Harbison <matt_harbison@yahoo.com>
parents: 44125
diff changeset
315 $ cat >> .hg/hgrc << EOF
59b3fe1e2021 phabricator: use .arcconfig for the callsign if not set locally (issue6243)
Matt Harbison <matt_harbison@yahoo.com>
parents: 44125
diff changeset
316 > [phabricator]
59b3fe1e2021 phabricator: use .arcconfig for the callsign if not set locally (issue6243)
Matt Harbison <matt_harbison@yahoo.com>
parents: 44125
diff changeset
317 > url = local
59b3fe1e2021 phabricator: use .arcconfig for the callsign if not set locally (issue6243)
Matt Harbison <matt_harbison@yahoo.com>
parents: 44125
diff changeset
318 > callsign = local
59b3fe1e2021 phabricator: use .arcconfig for the callsign if not set locally (issue6243)
Matt Harbison <matt_harbison@yahoo.com>
parents: 44125
diff changeset
319 > EOF
59b3fe1e2021 phabricator: use .arcconfig for the callsign if not set locally (issue6243)
Matt Harbison <matt_harbison@yahoo.com>
parents: 44125
diff changeset
320 $ hg config phabricator --debug
59b3fe1e2021 phabricator: use .arcconfig for the callsign if not set locally (issue6243)
Matt Harbison <matt_harbison@yahoo.com>
parents: 44125
diff changeset
321 read config from: */.hgrc (glob)
59b3fe1e2021 phabricator: use .arcconfig for the callsign if not set locally (issue6243)
Matt Harbison <matt_harbison@yahoo.com>
parents: 44125
diff changeset
322 $TESTTMP/repo/.hg/hgrc:*: phabricator.url=local (glob)
59b3fe1e2021 phabricator: use .arcconfig for the callsign if not set locally (issue6243)
Matt Harbison <matt_harbison@yahoo.com>
parents: 44125
diff changeset
323 $TESTTMP/repo/.hg/hgrc:*: phabricator.callsign=local (glob)
59b3fe1e2021 phabricator: use .arcconfig for the callsign if not set locally (issue6243)
Matt Harbison <matt_harbison@yahoo.com>
parents: 44125
diff changeset
324 $ mv .hg/hgrc.bak .hg/hgrc
44125
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
325
44550
bbb170f9396d phabricator: add a `phabimport` command
Matt Harbison <matt_harbison@yahoo.com>
parents: 44436
diff changeset
326 Phabimport works with a stack
bbb170f9396d phabricator: add a `phabimport` command
Matt Harbison <matt_harbison@yahoo.com>
parents: 44436
diff changeset
327
44125
a5e3f38407cb tests: restore phabricator tests and regenerate the recordings
Matt Harbison <matt_harbison@yahoo.com>
parents: 43260
diff changeset
328 $ cd ..
44550
bbb170f9396d phabricator: add a `phabimport` command
Matt Harbison <matt_harbison@yahoo.com>
parents: 44436
diff changeset
329 $ hg clone repo repo2 -qr 1
bbb170f9396d phabricator: add a `phabimport` command
Matt Harbison <matt_harbison@yahoo.com>
parents: 44436
diff changeset
330 $ cp repo/.hg/hgrc repo2/.hg/
bbb170f9396d phabricator: add a `phabimport` command
Matt Harbison <matt_harbison@yahoo.com>
parents: 44436
diff changeset
331 $ cd repo2
bbb170f9396d phabricator: add a `phabimport` command
Matt Harbison <matt_harbison@yahoo.com>
parents: 44436
diff changeset
332 $ hg phabimport --stack 'D7918' --test-vcr "$VCR/phabimport-stack.json"
bbb170f9396d phabricator: add a `phabimport` command
Matt Harbison <matt_harbison@yahoo.com>
parents: 44436
diff changeset
333 applying patch from D7917
bbb170f9396d phabricator: add a `phabimport` command
Matt Harbison <matt_harbison@yahoo.com>
parents: 44436
diff changeset
334 applying patch from D7918
bbb170f9396d phabricator: add a `phabimport` command
Matt Harbison <matt_harbison@yahoo.com>
parents: 44436
diff changeset
335 $ hg log -G -Tcompact
bbb170f9396d phabricator: add a `phabimport` command
Matt Harbison <matt_harbison@yahoo.com>
parents: 44436
diff changeset
336 o 3[tip] aaef04066140 1970-01-01 00:00 +0000 test
bbb170f9396d phabricator: add a `phabimport` command
Matt Harbison <matt_harbison@yahoo.com>
parents: 44436
diff changeset
337 | create draft change for phabricator testing
bbb170f9396d phabricator: add a `phabimport` command
Matt Harbison <matt_harbison@yahoo.com>
parents: 44436
diff changeset
338 |
bbb170f9396d phabricator: add a `phabimport` command
Matt Harbison <matt_harbison@yahoo.com>
parents: 44436
diff changeset
339 o 2 8de3712202d1 1970-01-01 00:00 +0000 test
bbb170f9396d phabricator: add a `phabimport` command
Matt Harbison <matt_harbison@yahoo.com>
parents: 44436
diff changeset
340 | create public change for phabricator testing
bbb170f9396d phabricator: add a `phabimport` command
Matt Harbison <matt_harbison@yahoo.com>
parents: 44436
diff changeset
341 |
bbb170f9396d phabricator: add a `phabimport` command
Matt Harbison <matt_harbison@yahoo.com>
parents: 44436
diff changeset
342 @ 1 a692622e6937 1970-01-01 00:00 +0000 test
bbb170f9396d phabricator: add a `phabimport` command
Matt Harbison <matt_harbison@yahoo.com>
parents: 44436
diff changeset
343 | create beta for phabricator test
bbb170f9396d phabricator: add a `phabimport` command
Matt Harbison <matt_harbison@yahoo.com>
parents: 44436
diff changeset
344 |
bbb170f9396d phabricator: add a `phabimport` command
Matt Harbison <matt_harbison@yahoo.com>
parents: 44436
diff changeset
345 o 0 c44b38f24a45 1970-01-01 00:00 +0000 test
bbb170f9396d phabricator: add a `phabimport` command
Matt Harbison <matt_harbison@yahoo.com>
parents: 44436
diff changeset
346 create alpha for phabricator test \x80 (esc)
bbb170f9396d phabricator: add a `phabimport` command
Matt Harbison <matt_harbison@yahoo.com>
parents: 44436
diff changeset
347
bbb170f9396d phabricator: add a `phabimport` command
Matt Harbison <matt_harbison@yahoo.com>
parents: 44436
diff changeset
348
bbb170f9396d phabricator: add a `phabimport` command
Matt Harbison <matt_harbison@yahoo.com>
parents: 44436
diff changeset
349 $ cd ..