Mercurial > hg
view tests/test-rebase-transaction.t @ 36858:01f6bba64424
hgweb: remove support for POST form data (BC)
Previously, we called out to cgi.parse(), which for POST requests
parsed multipart/form-data and application/x-www-form-urlencoded
Content-Type requests for form data, combined it with query string
parameters, returned a union of the values.
As far as I know, nothing in Mercurial actually uses this mechanism
to submit data to the HTTP server. The wire protocol has its own
mechanism for passing parameters. And the web interface only does
GET requests. Removing support for parsing POST data doesn't break
any tests.
Another reason to not like this feature is that cgi.parse() may
modify the QUERY_STRING environment variable as a side-effect.
In addition, it merges both POST data and the query string into
one data structure. This prevents consumers from knowing whether
a variable came from the query string or POST data. That can matter
for some operations.
I suspect we use cgi.parse() because back when this code was
initially implemented, it was the function that was readily
available. In other words, I don't think there was conscious
choice to support POST data: we just got it because cgi.parse()
supported it.
Since nothing uses the feature and it is untested, let's remove
support for parsing POST form data. We can add it back in easily
enough if we need it in the future.
.. bc::
Hgweb no longer reads form data in POST requests from
multipart/form-data and application/x-www-form-urlencoded
requests. Arguments should be specified as URL path components
or in the query string in the URL instead.
Differential Revision: https://phab.mercurial-scm.org/D2774
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sat, 10 Mar 2018 11:07:53 -0800 |
parents | 9ab7eba99fe5 |
children | 17a744c5e270 |
line wrap: on
line source
Rebasing using a single transaction $ cat >> $HGRCPATH <<EOF > [extensions] > rebase= > drawdag=$TESTDIR/drawdag.py > > [rebase] > singletransaction=True > > [phases] > publish=False > > [alias] > tglog = log -G --template "{rev}: {desc}" > EOF Check that a simple rebase works $ hg init simple && cd simple $ hg debugdrawdag <<'EOF' > Z > | > | D > | | > | C > | | > Y B > |/ > A > EOF - We should only see two status stored messages. One from the start, one from - the end. $ hg rebase --debug -b D -d Z | grep 'status stored' rebase status stored rebase status stored $ hg tglog o 5: D | o 4: C | o 3: B | o 2: Z | o 1: Y | o 0: A $ cd .. Check that --collapse works $ hg init collapse && cd collapse $ hg debugdrawdag <<'EOF' > Z > | > | D > | | > | C > | | > Y B > |/ > A > EOF - We should only see two status stored messages. One from the start, one from - the end. $ hg rebase --collapse --debug -b D -d Z | grep 'status stored' rebase status stored rebase status stored $ hg tglog o 3: Collapsed revision | * B | * C | * D o 2: Z | o 1: Y | o 0: A $ cd .. With --collapse, check that conflicts can be resolved and rebase can then be continued $ hg init collapse-conflict && cd collapse-conflict $ hg debugdrawdag <<'EOF' > Z # Z/conflict=Z > | > | D > | | > | C # C/conflict=C > | | > Y B > |/ > A > EOF $ hg rebase --collapse -b D -d Z rebasing 1:112478962961 "B" (B) rebasing 3:c26739dbe603 "C" (C) merging conflict warning: conflicts while merging conflict! (edit, then use 'hg resolve --mark') unresolved conflicts (see hg resolve, then hg rebase --continue) [1] $ hg tglog o 5: D | | @ 4: Z | | @ | 3: C | | | o 2: Y | | o | 1: B |/ o 0: A $ hg st M C M conflict A B ? conflict.orig $ echo resolved > conflict $ hg resolve -m (no more unresolved files) continue: hg rebase --continue $ hg rebase --continue already rebased 1:112478962961 "B" (B) as 79bc8f4973ce rebasing 3:c26739dbe603 "C" (C) rebasing 5:d24bb333861c "D" (D tip) saved backup bundle to $TESTTMP/collapse-conflict/.hg/strip-backup/112478962961-b5b34645-rebase.hg $ hg tglog o 3: Collapsed revision | * B | * C | * D o 2: Z | o 1: Y | o 0: A $ cd .. With --collapse, check that the commit message editing can be canceled and rebase can then be continued $ hg init collapse-cancel-editor && cd collapse-cancel-editor $ hg debugdrawdag <<'EOF' > Z > | > | D > | | > | C > | | > Y B > |/ > A > EOF $ HGEDITOR=false hg --config ui.interactive=1 rebase --collapse -b D -d Z rebasing 1:112478962961 "B" (B) rebasing 3:26805aba1e60 "C" (C) rebasing 5:f585351a92f8 "D" (D tip) abort: edit failed: false exited with status 1 [255] $ hg tglog o 5: D | | @ 4: Z | | o | 3: C | | | o 2: Y | | o | 1: B |/ o 0: A $ hg rebase --continue already rebased 1:112478962961 "B" (B) as e9b22a392ce0 already rebased 3:26805aba1e60 "C" (C) as e9b22a392ce0 already rebased 5:f585351a92f8 "D" (D tip) as e9b22a392ce0 saved backup bundle to $TESTTMP/collapse-cancel-editor/.hg/strip-backup/112478962961-cb2a9b47-rebase.hg $ hg tglog o 3: Collapsed revision | * B | * C | * D o 2: Z | o 1: Y | o 0: A $ cd ..