tests/test-phabricator.t
changeset 44717 3dc6a70779f2
parent 44716 ed81fa859426
child 44718 0680b8a1992a
equal deleted inserted replaced
44716:ed81fa859426 44717:3dc6a70779f2
   414   repository tip rolled back to revision 1 (undo phabimport)
   414   repository tip rolled back to revision 1 (undo phabimport)
   415   $ hg phabimport --no-stack D7917 D7918 --test-vcr "$VCR/phabimport-multi-drev.json"
   415   $ hg phabimport --no-stack D7917 D7918 --test-vcr "$VCR/phabimport-multi-drev.json"
   416   applying patch from D7917
   416   applying patch from D7917
   417   applying patch from D7918
   417   applying patch from D7918
   418 
   418 
       
   419 Validate arguments with --fold
       
   420 
       
   421   $ hg phabsend --fold -r 1
       
   422   abort: cannot fold a single revision
       
   423   [255]
       
   424   $ hg phabsend --fold --no-amend -r 1::
       
   425   abort: cannot fold with --no-amend
       
   426   [255]
       
   427   $ hg phabsend --fold -r 0+3
       
   428   abort: cannot fold non-linear revisions
       
   429   [255]
       
   430   $ hg phabsend --fold -r 1::
       
   431   abort: cannot fold revisions with different DREV values
       
   432   [255]
       
   433 
       
   434 Setup a series of commits to be folded, and include the Test Plan field multiple
       
   435 times to test the concatenation logic.  No Test Plan field in the last one to
       
   436 ensure missing fields are skipped.
       
   437 
       
   438   $ hg init ../folded
       
   439   $ cd ../folded
       
   440   $ cat >> .hg/hgrc <<EOF
       
   441   > [phabricator]
       
   442   > url = https://phab.mercurial-scm.org/
       
   443   > callsign = HG
       
   444   > EOF
       
   445 
       
   446   $ echo 'added' > file.txt
       
   447   $ hg ci -Aqm 'added file'
       
   448 
       
   449   $ cat > log.txt <<EOF
       
   450   > one: first commit to review
       
   451   > 
       
   452   > This file was modified with 'mod1' as its contents.
       
   453   > 
       
   454   > Test Plan:
       
   455   > LOL!  What testing?!
       
   456   > EOF
       
   457   $ echo mod1 > file.txt
       
   458   $ hg ci -l log.txt
       
   459 
       
   460   $ cat > log.txt <<EOF
       
   461   > two: second commit to review
       
   462   > 
       
   463   > This file was modified with 'mod2' as its contents.
       
   464   > 
       
   465   > Test Plan:
       
   466   > Haha! yeah, right.
       
   467   > 
       
   468   > EOF
       
   469   $ echo mod2 > file.txt
       
   470   $ hg ci -l log.txt
       
   471 
       
   472   $ echo mod3 > file.txt
       
   473   $ hg ci -m '3: a commit with no detailed message'
       
   474 
       
   475 The folding of immutable commits works...
       
   476 
       
   477   $ hg phase -r tip --public
       
   478   $ hg phabsend --fold -r 1:: --test-vcr "$VCR/phabsend-fold-immutable.json"
       
   479   D8386 - created - a959a3f69d8d: one: first commit to review
       
   480   D8386 - created - 24a4438154ba: two: second commit to review
       
   481   D8386 - created - d235829e802c: 3: a commit with no detailed message
       
   482   warning: not updating public commit 1:a959a3f69d8d
       
   483   warning: not updating public commit 2:24a4438154ba
       
   484   warning: not updating public commit 3:d235829e802c
       
   485   no newnodes to update
       
   486 
       
   487   $ hg phase -r 0 --draft --force
       
   488 
       
   489 ... as does the initial mutable fold...
       
   490 
       
   491   $ echo y | hg phabsend --fold --confirm -r 1:: \
       
   492   >          --test-vcr "$VCR/phabsend-fold-initial.json"
       
   493   NEW - a959a3f69d8d: one: first commit to review
       
   494   NEW - 24a4438154ba: two: second commit to review
       
   495   NEW - d235829e802c: 3: a commit with no detailed message
       
   496   Send the above changes to https://phab.mercurial-scm.org/ (yn)? y
       
   497   D8387 - created - a959a3f69d8d: one: first commit to review
       
   498   D8387 - created - 24a4438154ba: two: second commit to review
       
   499   D8387 - created - d235829e802c: 3: a commit with no detailed message
       
   500   updating local commit list for D8387
       
   501   new commits: ['602c4e738243', '832553266fe8', '921f8265efbd']
       
   502   saved backup bundle to $TESTTMP/folded/.hg/strip-backup/a959a3f69d8d-a4a24136-phabsend.hg
       
   503 
       
   504 ... and doesn't mangle the local commits.
       
   505 
       
   506   $ hg log -T '{rev}:{node|short}\n{indent(desc, "  ")}\n'
       
   507   3:921f8265efbd
       
   508     3: a commit with no detailed message
       
   509   
       
   510     Differential Revision: https://phab.mercurial-scm.org/D8387
       
   511   2:832553266fe8
       
   512     two: second commit to review
       
   513   
       
   514     This file was modified with 'mod2' as its contents.
       
   515   
       
   516     Test Plan:
       
   517     Haha! yeah, right.
       
   518   
       
   519     Differential Revision: https://phab.mercurial-scm.org/D8387
       
   520   1:602c4e738243
       
   521     one: first commit to review
       
   522   
       
   523     This file was modified with 'mod1' as its contents.
       
   524   
       
   525     Test Plan:
       
   526     LOL!  What testing?!
       
   527   
       
   528     Differential Revision: https://phab.mercurial-scm.org/D8387
       
   529   0:98d480e0d494
       
   530     added file
       
   531 
       
   532 Setup some obsmarkers by adding a file to the middle commit.  This stress tests
       
   533 getoldnodedrevmap() in later phabsends.
       
   534 
       
   535   $ hg up '.^'
       
   536   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   537   $ echo 'modified' > file2.txt
       
   538   $ hg add file2.txt
       
   539   $ hg amend --config experimental.evolution=all --config extensions.amend=
       
   540   1 new orphan changesets
       
   541   $ hg up 3
       
   542   obsolete feature not enabled but 1 markers found!
       
   543   1 files updated, 0 files merged, 1 files removed, 0 files unresolved
       
   544   $ hg rebase --config experimental.evolution=all --config extensions.rebase=
       
   545   note: not rebasing 2:832553266fe8 "two: second commit to review", already in destination as 4:0124e5474c88 "two: second commit to review" (tip)
       
   546   rebasing 3:921f8265efbd "3: a commit with no detailed message"
       
   547 
       
   548 When commits have changed locally, the local commit list on Phabricator is
       
   549 updated.
       
   550 
       
   551   $ echo y | hg phabsend --fold --confirm -r 1:: \
       
   552   >          --test-vcr "$VCR/phabsend-fold-updated.json"
       
   553   obsolete feature not enabled but 2 markers found!
       
   554   602c4e738243 mapped to old nodes ['602c4e738243']
       
   555   0124e5474c88 mapped to old nodes ['832553266fe8']
       
   556   e4edb1fe3565 mapped to old nodes ['921f8265efbd']
       
   557   D8387 - 602c4e738243: one: first commit to review
       
   558   D8387 - 0124e5474c88: two: second commit to review
       
   559   D8387 - e4edb1fe3565: 3: a commit with no detailed message
       
   560   Send the above changes to https://phab.mercurial-scm.org/ (yn)? y
       
   561   D8387 - updated - 602c4e738243: one: first commit to review
       
   562   D8387 - updated - 0124e5474c88: two: second commit to review
       
   563   D8387 - updated - e4edb1fe3565: 3: a commit with no detailed message
       
   564   obsolete feature not enabled but 2 markers found! (?)
       
   565   updating local commit list for D8387
       
   566   new commits: ['602c4e738243', '0124e5474c88', 'e4edb1fe3565']
       
   567   $ hg log -Tcompact
       
   568   obsolete feature not enabled but 2 markers found!
       
   569   5[tip]   e4edb1fe3565   1970-01-01 00:00 +0000   test
       
   570     3: a commit with no detailed message
       
   571   
       
   572   4:1   0124e5474c88   1970-01-01 00:00 +0000   test
       
   573     two: second commit to review
       
   574   
       
   575   1   602c4e738243   1970-01-01 00:00 +0000   test
       
   576     one: first commit to review
       
   577   
       
   578   0   98d480e0d494   1970-01-01 00:00 +0000   test
       
   579     added file
       
   580   
       
   581 When nothing has changed locally since the last phabsend, the commit list isn't
       
   582 updated, and nothing is changed locally afterward.
       
   583 
       
   584   $ hg phabsend --fold -r 1:: --test-vcr "$VCR/phabsend-fold-no-changes.json"
       
   585   obsolete feature not enabled but 2 markers found!
       
   586   602c4e738243 mapped to old nodes ['602c4e738243']
       
   587   0124e5474c88 mapped to old nodes ['0124e5474c88']
       
   588   e4edb1fe3565 mapped to old nodes ['e4edb1fe3565']
       
   589   D8387 - updated - 602c4e738243: one: first commit to review
       
   590   D8387 - updated - 0124e5474c88: two: second commit to review
       
   591   D8387 - updated - e4edb1fe3565: 3: a commit with no detailed message
       
   592   obsolete feature not enabled but 2 markers found! (?)
       
   593   local commit list for D8387 is already up-to-date
       
   594   $ hg log -Tcompact
       
   595   obsolete feature not enabled but 2 markers found!
       
   596   5[tip]   e4edb1fe3565   1970-01-01 00:00 +0000   test
       
   597     3: a commit with no detailed message
       
   598   
       
   599   4:1   0124e5474c88   1970-01-01 00:00 +0000   test
       
   600     two: second commit to review
       
   601   
       
   602   1   602c4e738243   1970-01-01 00:00 +0000   test
       
   603     one: first commit to review
       
   604   
       
   605   0   98d480e0d494   1970-01-01 00:00 +0000   test
       
   606     added file
       
   607   
       
   608 Fold will accept new revisions at the end...
       
   609 
       
   610   $ echo 'another mod' > file2.txt
       
   611   $ hg ci -m 'four: extend the fold range'
       
   612   obsolete feature not enabled but 2 markers found!
       
   613   $ hg phabsend --fold -r 1:: --test-vcr "$VCR/phabsend-fold-extend-end.json" \
       
   614   >             --config experimental.evolution=all
       
   615   602c4e738243 mapped to old nodes ['602c4e738243']
       
   616   0124e5474c88 mapped to old nodes ['0124e5474c88']
       
   617   e4edb1fe3565 mapped to old nodes ['e4edb1fe3565']
       
   618   D8387 - updated - 602c4e738243: one: first commit to review
       
   619   D8387 - updated - 0124e5474c88: two: second commit to review
       
   620   D8387 - updated - e4edb1fe3565: 3: a commit with no detailed message
       
   621   D8387 - created - 94aaae213b23: four: extend the fold range
       
   622   updating local commit list for D8387
       
   623   new commits: ['602c4e738243', '0124e5474c88', 'e4edb1fe3565', '51a04fea8707']
       
   624   $ hg log -r . -T '{desc}\n'
       
   625   four: extend the fold range
       
   626   
       
   627   Differential Revision: https://phab.mercurial-scm.org/D8387
       
   628   $ hg log -T'{rev} {if(phabreview, "{phabreview.url} {phabreview.id}")}\n' -r 1::
       
   629   obsolete feature not enabled but 3 markers found!
       
   630   1 https://phab.mercurial-scm.org/D8387 D8387
       
   631   4 https://phab.mercurial-scm.org/D8387 D8387
       
   632   5 https://phab.mercurial-scm.org/D8387 D8387
       
   633   7 https://phab.mercurial-scm.org/D8387 D8387
       
   634 
       
   635 ... and also accepts new revisions at the beginning of the range
       
   636 
       
   637 It's a bit unfortunate that not having a Differential URL on the first commit
       
   638 causes a new Differential Revision to be created, though it isn't *entirely*
       
   639 unreasonable.  At least this updates the subsequent commits.
       
   640 
       
   641 TODO: See if it can reuse the existing Differential.
       
   642 
       
   643   $ hg phabsend --fold -r 0:: --test-vcr "$VCR/phabsend-fold-extend-front.json" \
       
   644   >             --config experimental.evolution=all
       
   645   602c4e738243 mapped to old nodes ['602c4e738243']
       
   646   0124e5474c88 mapped to old nodes ['0124e5474c88']
       
   647   e4edb1fe3565 mapped to old nodes ['e4edb1fe3565']
       
   648   51a04fea8707 mapped to old nodes ['51a04fea8707']
       
   649   D8388 - created - 98d480e0d494: added file
       
   650   D8388 - updated - 602c4e738243: one: first commit to review
       
   651   D8388 - updated - 0124e5474c88: two: second commit to review
       
   652   D8388 - updated - e4edb1fe3565: 3: a commit with no detailed message
       
   653   D8388 - updated - 51a04fea8707: four: extend the fold range
       
   654   updating local commit list for D8388
       
   655   new commits: ['15e9b14b4b4c', '6320b7d714cf', '3ee132d41dbc', '30682b960804', 'ac7db67f0991']
       
   656 
       
   657   $ hg log -T '{rev}:{node|short}\n{indent(desc, "  ")}\n'
       
   658   obsolete feature not enabled but 8 markers found!
       
   659   12:ac7db67f0991
       
   660     four: extend the fold range
       
   661   
       
   662     Differential Revision: https://phab.mercurial-scm.org/D8388
       
   663   11:30682b960804
       
   664     3: a commit with no detailed message
       
   665   
       
   666     Differential Revision: https://phab.mercurial-scm.org/D8388
       
   667   10:3ee132d41dbc
       
   668     two: second commit to review
       
   669   
       
   670     This file was modified with 'mod2' as its contents.
       
   671   
       
   672     Test Plan:
       
   673     Haha! yeah, right.
       
   674   
       
   675     Differential Revision: https://phab.mercurial-scm.org/D8388
       
   676   9:6320b7d714cf
       
   677     one: first commit to review
       
   678   
       
   679     This file was modified with 'mod1' as its contents.
       
   680   
       
   681     Test Plan:
       
   682     LOL!  What testing?!
       
   683   
       
   684     Differential Revision: https://phab.mercurial-scm.org/D8388
       
   685   8:15e9b14b4b4c
       
   686     added file
       
   687   
       
   688     Differential Revision: https://phab.mercurial-scm.org/D8388
       
   689 
       
   690 Test phabsend --fold with an `hg split` at the end of the range
       
   691 
       
   692   $ echo foo > file3.txt
       
   693   $ hg add file3.txt
       
   694 
       
   695   $ hg log -r . -T '{desc}' > log.txt
       
   696   $ echo 'amended mod' > file2.txt
       
   697   $ hg ci --amend -l log.txt --config experimental.evolution=all
       
   698 
       
   699   $ cat <<EOF | hg --config extensions.split= --config ui.interactive=True \
       
   700   >                --config experimental.evolution=all split -r .
       
   701   > n
       
   702   > y
       
   703   > y
       
   704   > y
       
   705   > y
       
   706   > EOF
       
   707   diff --git a/file2.txt b/file2.txt
       
   708   1 hunks, 1 lines changed
       
   709   examine changes to 'file2.txt'?
       
   710   (enter ? for help) [Ynesfdaq?] n
       
   711   
       
   712   diff --git a/file3.txt b/file3.txt
       
   713   new file mode 100644
       
   714   examine changes to 'file3.txt'?
       
   715   (enter ? for help) [Ynesfdaq?] y
       
   716   
       
   717   @@ -0,0 +1,1 @@
       
   718   +foo
       
   719   record change 2/2 to 'file3.txt'?
       
   720   (enter ? for help) [Ynesfdaq?] y
       
   721   
       
   722   created new head
       
   723   diff --git a/file2.txt b/file2.txt
       
   724   1 hunks, 1 lines changed
       
   725   examine changes to 'file2.txt'?
       
   726   (enter ? for help) [Ynesfdaq?] y
       
   727   
       
   728   @@ -1,1 +1,1 @@
       
   729   -modified
       
   730   +amended mod
       
   731   record this change to 'file2.txt'?
       
   732   (enter ? for help) [Ynesfdaq?] y
       
   733   
       
   734   $ hg phabsend --fold -r 8:: --test-vcr "$VCR/phabsend-fold-split-end.json" \
       
   735   >             --config experimental.evolution=all
       
   736   15e9b14b4b4c mapped to old nodes ['15e9b14b4b4c']
       
   737   6320b7d714cf mapped to old nodes ['6320b7d714cf']
       
   738   3ee132d41dbc mapped to old nodes ['3ee132d41dbc']
       
   739   30682b960804 mapped to old nodes ['30682b960804']
       
   740   6bc15dc99efd mapped to old nodes ['ac7db67f0991']
       
   741   b50946d5e490 mapped to old nodes ['ac7db67f0991']
       
   742   D8388 - updated - 15e9b14b4b4c: added file
       
   743   D8388 - updated - 6320b7d714cf: one: first commit to review
       
   744   D8388 - updated - 3ee132d41dbc: two: second commit to review
       
   745   D8388 - updated - 30682b960804: 3: a commit with no detailed message
       
   746   D8388 - updated - 6bc15dc99efd: four: extend the fold range
       
   747   D8388 - updated - b50946d5e490: four: extend the fold range
       
   748   updating local commit list for D8388
       
   749   new commits: ['15e9b14b4b4c', '6320b7d714cf', '3ee132d41dbc', '30682b960804', '6bc15dc99efd', 'b50946d5e490']
       
   750 
       
   751 Test phabsend --fold with an `hg fold` at the end of the range
       
   752 
       
   753   $ hg --config experimental.evolution=all --config extensions.rebase= \
       
   754   >    rebase -r '.^' -r . -d '.^^' --collapse -l log.txt
       
   755   rebasing 14:6bc15dc99efd "four: extend the fold range"
       
   756   rebasing 15:b50946d5e490 "four: extend the fold range" (tip)
       
   757 
       
   758   $ hg phabsend --fold -r 8:: --test-vcr "$VCR/phabsend-fold-fold-end.json" \
       
   759   >             --config experimental.evolution=all
       
   760   15e9b14b4b4c mapped to old nodes ['15e9b14b4b4c']
       
   761   6320b7d714cf mapped to old nodes ['6320b7d714cf']
       
   762   3ee132d41dbc mapped to old nodes ['3ee132d41dbc']
       
   763   30682b960804 mapped to old nodes ['30682b960804']
       
   764   e919cdf3d4fe mapped to old nodes ['6bc15dc99efd', 'b50946d5e490']
       
   765   D8388 - updated - 15e9b14b4b4c: added file
       
   766   D8388 - updated - 6320b7d714cf: one: first commit to review
       
   767   D8388 - updated - 3ee132d41dbc: two: second commit to review
       
   768   D8388 - updated - 30682b960804: 3: a commit with no detailed message
       
   769   D8388 - updated - e919cdf3d4fe: four: extend the fold range
       
   770   updating local commit list for D8388
       
   771   new commits: ['15e9b14b4b4c', '6320b7d714cf', '3ee132d41dbc', '30682b960804', 'e919cdf3d4fe']
       
   772 
       
   773   $ hg log -r tip -v
       
   774   obsolete feature not enabled but 12 markers found!
       
   775   changeset:   16:e919cdf3d4fe
       
   776   tag:         tip
       
   777   parent:      11:30682b960804
       
   778   user:        test
       
   779   date:        Thu Jan 01 00:00:00 1970 +0000
       
   780   files:       file2.txt file3.txt
       
   781   description:
       
   782   four: extend the fold range
       
   783   
       
   784   Differential Revision: https://phab.mercurial-scm.org/D8388
       
   785   
       
   786   
       
   787 
   419   $ cd ..
   788   $ cd ..