##// END OF EJS Templates
phabupdate: allow revisions to be marked with "plan changes"...
Matt Harbison -
r45695:225588c4 default
parent child Browse files
Show More
@@ -0,0 +1,141 b''
1 {
2 "version": 1,
3 "interactions": [
4 {
5 "response": {
6 "headers": {
7 "x-xss-protection": [
8 "1; mode=block"
9 ],
10 "expires": [
11 "Sat, 01 Jan 2000 00:00:00 GMT"
12 ],
13 "server": [
14 "Apache/2.4.10 (Debian)"
15 ],
16 "date": [
17 "Wed, 15 Jul 2020 17:23:27 GMT"
18 ],
19 "cache-control": [
20 "no-store"
21 ],
22 "content-type": [
23 "application/json"
24 ],
25 "transfer-encoding": [
26 "chunked"
27 ],
28 "strict-transport-security": [
29 "max-age=0; includeSubdomains; preload"
30 ],
31 "x-frame-options": [
32 "Deny"
33 ],
34 "referrer-policy": [
35 "no-referrer"
36 ],
37 "x-content-type-options": [
38 "nosniff"
39 ]
40 },
41 "body": {
42 "string": "{\"result\":[{\"id\":\"6876\",\"phid\":\"PHID-DREV-looitrxgt3omaau7a7qk\",\"title\":\"phabricator: support automatically obsoleting old revisions of pulled commits\",\"uri\":\"https:\\/\\/phab.mercurial-scm.org\\/D6876\",\"dateCreated\":\"1569388644\",\"dateModified\":\"1579887103\",\"authorPHID\":\"PHID-USER-tzhaient733lwrlbcag5\",\"status\":\"1\",\"statusName\":\"Needs Revision\",\"properties\":{\"draft.broadcast\":true,\"lines.added\":68,\"lines.removed\":1},\"branch\":null,\"summary\":\"This is basically an import of the `pullcreatemarkers` extension[1] from the FB\\nrepo, with minor adjustments to `getmatchingdiff()` to work with modern hg.\\nSince this is very phabricator specific, it makes more sense to me to bundle it\\ninto the existing extension. It wasn't very obvious from the old name what\\nfunctionality was provided, and it may make sense to do this in other scenarios\\nbesides `hg pull`.\\n\\nThere are two use cases that I can see- first, ensuring that old revisions are\\ncleaned up for a contributor (I seem to recall something I submitted recently\\nneeded to be explicitly pruned, though most submissions do clean up\\nautomatically). Second, any `hg phabread | hg import -` would otherwise need to\\nbe manually cleaned up. The latter is annoying enough that I tend not to grab\\nthe code and try it when reviewing.\\n\\nIt is currently guarded by a config option (off by default), because @marmoute\\nexpressed concerns about duplicate marker creation if the pushing reviewer also\\ncreates a marker. I don't think that's possible here, since the obsolete\\nrevisions are explicitly excluded. But maybe there are other reasons someone\\nwouldn't want older revisions obsoleted. The config name reflects the fact that\\nI'm not sure if other things like import should get this too.\\n\\nI suspect that we could wrap a function deeper in the pull sequence to improve\\nboth the code and the UX. For example, when pulling an obsolete marker, it can\\nprint out a warning that the working directory parent is obsolete, but that\\ndoesn't happen here. (It won't happen with this test. It *should* without the\\n`--bypass` option, but doesn't.) It should also be possible to not have to\\nquery the range of new revisions, and maybe it can be added to the existing\\ntransaction.\\n\\n[1] https:\\/\\/bitbucket.org\\/facebook\\/hg-experimental\\/src\\/default\\/hgext3rd\\/pullcreatemarkers.py\",\"testPlan\":\"\",\"lineCount\":\"69\",\"activeDiffPHID\":\"PHID-DIFF-jdpqpzciqcooaxf2kojh\",\"diffs\":[\"16604\"],\"commits\":[],\"reviewers\":{\"PHID-PROJ-3dvcxzznrjru2xmmses3\":\"PHID-PROJ-3dvcxzznrjru2xmmses3\",\"PHID-USER-cah4b6i3kszy6debh3bl\":\"PHID-USER-cah4b6i3kszy6debh3bl\"},\"ccs\":[\"PHID-USER-34jnztnonbr4lhwuybwl\",\"PHID-USER-e66t6wbudjtigdnqbl3e\",\"PHID-USER-5iy6mkoveguhm2zthvww\",\"PHID-USER-q42dn7cc3donqriafhjx\",\"PHID-USER-vflsibccj4unqydwfvne\"],\"hashes\":[],\"auxiliary\":{\"phabricator:projects\":[],\"phabricator:depends-on\":[\"PHID-DREV-2dbanvk64h5wguhxta2o\"]},\"repositoryPHID\":\"PHID-REPO-bvunnehri4u2isyr7bc3\",\"sourcePath\":null}],\"error_code\":null,\"error_info\":null}"
43 },
44 "status": {
45 "message": "OK",
46 "code": 200
47 }
48 },
49 "request": {
50 "uri": "https://phab.mercurial-scm.org//api/differential.query",
51 "body": "output=json&params=%7B%22__conduit__%22%3A+%7B%22token%22%3A+%22cli-hahayouwish%22%7D%2C+%22ids%22%3A+%5B6876%5D%7D&__conduit__=1",
52 "method": "POST",
53 "headers": {
54 "content-length": [
55 "146"
56 ],
57 "accept": [
58 "application/mercurial-0.1"
59 ],
60 "content-type": [
61 "application/x-www-form-urlencoded"
62 ],
63 "user-agent": [
64 "mercurial/proto-1.0 (Mercurial 5.4.2+207-8403cc54bc83+20200709)"
65 ],
66 "host": [
67 "phab.mercurial-scm.org"
68 ]
69 }
70 }
71 },
72 {
73 "response": {
74 "headers": {
75 "x-xss-protection": [
76 "1; mode=block"
77 ],
78 "expires": [
79 "Sat, 01 Jan 2000 00:00:00 GMT"
80 ],
81 "server": [
82 "Apache/2.4.10 (Debian)"
83 ],
84 "date": [
85 "Wed, 15 Jul 2020 17:23:28 GMT"
86 ],
87 "cache-control": [
88 "no-store"
89 ],
90 "content-type": [
91 "application/json"
92 ],
93 "transfer-encoding": [
94 "chunked"
95 ],
96 "strict-transport-security": [
97 "max-age=0; includeSubdomains; preload"
98 ],
99 "x-frame-options": [
100 "Deny"
101 ],
102 "referrer-policy": [
103 "no-referrer"
104 ],
105 "x-content-type-options": [
106 "nosniff"
107 ]
108 },
109 "body": {
110 "string": "{\"result\":{\"object\":{\"id\":6876,\"phid\":\"PHID-DREV-looitrxgt3omaau7a7qk\"},\"transactions\":[{\"phid\":\"PHID-XACT-DREV-g2xkgr2sjkrmhcr\"},{\"phid\":\"PHID-XACT-DREV-lgbrex6poz6x5pk\"}]},\"error_code\":null,\"error_info\":null}"
111 },
112 "status": {
113 "message": "OK",
114 "code": 200
115 }
116 },
117 "request": {
118 "uri": "https://phab.mercurial-scm.org//api/differential.revision.edit",
119 "body": "output=json&params=%7B%22__conduit__%22%3A+%7B%22token%22%3A+%22cli-hahayouwish%22%7D%2C+%22objectIdentifier%22%3A+%22PHID-DREV-looitrxgt3omaau7a7qk%22%2C+%22transactions%22%3A+%5B%7B%22type%22%3A+%22plan-changes%22%2C+%22value%22%3A+true%7D%5D%7D&__conduit__=1",
120 "method": "POST",
121 "headers": {
122 "content-length": [
123 "278"
124 ],
125 "accept": [
126 "application/mercurial-0.1"
127 ],
128 "content-type": [
129 "application/x-www-form-urlencoded"
130 ],
131 "user-agent": [
132 "mercurial/proto-1.0 (Mercurial 5.4.2+207-8403cc54bc83+20200709)"
133 ],
134 "host": [
135 "phab.mercurial-scm.org"
136 ]
137 }
138 }
139 }
140 ]
141 } No newline at end of file
@@ -2164,6 +2164,7 b' def phabimport(ui, repo, *specs, **opts)'
2164 2164 (b'', b'reject', False, _(b'reject revisions')),
2165 2165 (b'', b'abandon', False, _(b'abandon revisions')),
2166 2166 (b'', b'reclaim', False, _(b'reclaim revisions')),
2167 (b'', b'plan-changes', False, _(b'plan changes for revisions')),
2167 2168 (b'm', b'comment', b'', _(b'comment on the last revision')),
2168 2169 ],
2169 2170 _(b'DREVSPEC... [OPTIONS]'),
@@ -2176,7 +2177,14 b' def phabupdate(ui, repo, *specs, **opts)'
2176 2177 DREVSPEC selects revisions. See :hg:`help phabread` for its usage.
2177 2178 """
2178 2179 opts = pycompat.byteskwargs(opts)
2179 flags = [n for n in b'accept reject abandon reclaim'.split() if opts.get(n)]
2180 transactions = [
2181 b'abandon',
2182 b'accept',
2183 b'plan-changes',
2184 b'reclaim',
2185 b'reject',
2186 ]
2187 flags = [n for n in transactions if opts.get(n.replace(b'-', b'_'))]
2180 2188 if len(flags) > 1:
2181 2189 raise error.Abort(_(b'%s cannot be used together') % b', '.join(flags))
2182 2190
@@ -86,6 +86,10 b' phabupdate with an accept:'
86 86 [255]
87 87 $ hg phabupdate --accept D7913 -m 'LGTM' --test-vcr "$VCR/accept-7913.json"
88 88
89 phabupdate with --plan-changes:
90
91 $ hg phabupdate --plan-changes D6876 --test-vcr "$VCR/phabupdate-change-6876.json"
92
89 93 Create a differential diff:
90 94 $ HGENCODING=utf-8; export HGENCODING
91 95 $ echo alpha > alpha
General Comments 0
You need to be logged in to leave comments. Login now