tests/test-topic-push.t
branchmercurial-3.9
changeset 2801 49494d0155b7
parent 2800 13c4d518327a
parent 2702 167567795f6c
child 2802 41c9a4df628e
child 2811 35d053d7bd87
equal deleted inserted replaced
2800:13c4d518327a 2801:49494d0155b7
     1   $ . "$TESTDIR/testlib/topic_setup.sh"
       
     2 
       
     3   $ cat << EOF >> $HGRCPATH
       
     4   > [ui]
       
     5   > logtemplate = {rev} {branch} {get(namespaces, "topics")} {phase} {desc|firstline}\n
       
     6   > ssh =python "$RUNTESTDIR/dummyssh"
       
     7   > EOF
       
     8 
       
     9   $ hg init main
       
    10   $ hg init draft
       
    11   $ cat << EOF >> draft/.hg/hgrc
       
    12   > [phases]
       
    13   > publish=False
       
    14   > EOF
       
    15   $ hg clone main client
       
    16   updating to branch default
       
    17   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
    18   $ cat << EOF >> client/.hg/hgrc
       
    19   > [paths]
       
    20   > draft=../draft
       
    21   > EOF
       
    22 
       
    23 
       
    24 Testing core behavior to make sure we did not break anything
       
    25 ============================================================
       
    26 
       
    27 Pushing a first changeset
       
    28 
       
    29   $ cd client
       
    30   $ echo aaa > aaa
       
    31   $ hg add aaa
       
    32   $ hg commit -m 'CA'
       
    33   $ hg outgoing -G
       
    34   comparing with $TESTTMP/main (glob)
       
    35   searching for changes
       
    36   @  0 default  draft CA
       
    37   
       
    38   $ hg push
       
    39   pushing to $TESTTMP/main (glob)
       
    40   searching for changes
       
    41   adding changesets
       
    42   adding manifests
       
    43   adding file changes
       
    44   added 1 changesets with 1 changes to 1 files
       
    45 
       
    46 Pushing two heads
       
    47 
       
    48   $ echo aaa > bbb
       
    49   $ hg add bbb
       
    50   $ hg commit -m 'CB'
       
    51   $ echo aaa > ccc
       
    52   $ hg up 'desc(CA)'
       
    53   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
       
    54   $ hg add ccc
       
    55   $ hg commit -m 'CC'
       
    56   created new head
       
    57   $ hg outgoing -G
       
    58   comparing with $TESTTMP/main (glob)
       
    59   searching for changes
       
    60   @  2 default  draft CC
       
    61   
       
    62   o  1 default  draft CB
       
    63   
       
    64   $ hg push
       
    65   pushing to $TESTTMP/main (glob)
       
    66   searching for changes
       
    67   abort: push creates new remote head 9fe81b7f425d!
       
    68   (merge or see 'hg help push' for details about pushing new heads)
       
    69   [255]
       
    70   $ hg outgoing -r 'desc(CB)' -G
       
    71   comparing with $TESTTMP/main (glob)
       
    72   searching for changes
       
    73   o  1 default  draft CB
       
    74   
       
    75   $ hg push -r 'desc(CB)'
       
    76   pushing to $TESTTMP/main (glob)
       
    77   searching for changes
       
    78   adding changesets
       
    79   adding manifests
       
    80   adding file changes
       
    81   added 1 changesets with 1 changes to 1 files
       
    82 
       
    83 Pushing a new branch
       
    84 
       
    85   $ hg branch mountain
       
    86   marked working directory as branch mountain
       
    87   (branches are permanent and global, did you want a bookmark?)
       
    88   $ hg commit --amend
       
    89   $ hg outgoing -G
       
    90   comparing with $TESTTMP/main (glob)
       
    91   searching for changes
       
    92   @  4 mountain  draft CC
       
    93   
       
    94   $ hg push 
       
    95   pushing to $TESTTMP/main (glob)
       
    96   searching for changes
       
    97   abort: push creates new remote branches: mountain!
       
    98   (use 'hg push --new-branch' to create new remote branches)
       
    99   [255]
       
   100   $ hg push --new-branch
       
   101   pushing to $TESTTMP/main (glob)
       
   102   searching for changes
       
   103   adding changesets
       
   104   adding manifests
       
   105   adding file changes
       
   106   added 1 changesets with 1 changes to 1 files (+1 heads)
       
   107   2 new obsolescence markers
       
   108 
       
   109 Including on non-publishing
       
   110 
       
   111   $ hg push --new-branch draft
       
   112   pushing to $TESTTMP/draft (glob)
       
   113   searching for changes
       
   114   adding changesets
       
   115   adding manifests
       
   116   adding file changes
       
   117   added 3 changesets with 3 changes to 3 files (+1 heads)
       
   118   2 new obsolescence markers
       
   119 
       
   120 Testing topic behavior
       
   121 ======================
       
   122 
       
   123 Local peer tests
       
   124 ----------------
       
   125 
       
   126   $ hg up -r 'desc(CA)'
       
   127   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
       
   128   $ hg topic babar
       
   129   $ echo aaa > ddd
       
   130   $ hg add ddd
       
   131   $ hg commit -m 'CD'
       
   132   $ hg log -G # keep track of phase because I saw some strange bug during developement
       
   133   @  5 default babar draft CD
       
   134   |
       
   135   | o  4 mountain  public CC
       
   136   |/
       
   137   | o  1 default  public CB
       
   138   |/
       
   139   o  0 default  public CA
       
   140   
       
   141 
       
   142 Pushing a new topic to a non publishing server should not be seen as a new head
       
   143 
       
   144   $ hg push draft
       
   145   pushing to $TESTTMP/draft (glob)
       
   146   searching for changes
       
   147   adding changesets
       
   148   adding manifests
       
   149   adding file changes
       
   150   added 1 changesets with 1 changes to 1 files (+1 heads)
       
   151   $ hg log -G
       
   152   @  5 default babar draft CD
       
   153   |
       
   154   | o  4 mountain  public CC
       
   155   |/
       
   156   | o  1 default  public CB
       
   157   |/
       
   158   o  0 default  public CA
       
   159   
       
   160 
       
   161 Pushing a new topic to a publishing server should be seen as a new head
       
   162 
       
   163   $ hg push
       
   164   pushing to $TESTTMP/main (glob)
       
   165   searching for changes
       
   166   abort: push creates new remote head 67f579af159d!
       
   167   (merge or see 'hg help push' for details about pushing new heads)
       
   168   [255]
       
   169   $ hg log -G
       
   170   @  5 default babar draft CD
       
   171   |
       
   172   | o  4 mountain  public CC
       
   173   |/
       
   174   | o  1 default  public CB
       
   175   |/
       
   176   o  0 default  public CA
       
   177   
       
   178 
       
   179 wireprotocol tests
       
   180 ------------------
       
   181 
       
   182   $ hg up -r 'desc(CA)'
       
   183   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
       
   184   $ hg topic celeste
       
   185   $ echo aaa > eee
       
   186   $ hg add eee
       
   187   $ hg commit -m 'CE'
       
   188   $ hg log -G # keep track of phase because I saw some strange bug during developement
       
   189   @  6 default celeste draft CE
       
   190   |
       
   191   | o  5 default babar draft CD
       
   192   |/
       
   193   | o  4 mountain  public CC
       
   194   |/
       
   195   | o  1 default  public CB
       
   196   |/
       
   197   o  0 default  public CA
       
   198   
       
   199 
       
   200 Pushing a new topic to a non publishing server without topic -> new head
       
   201 
       
   202   $ cat << EOF >> ../draft/.hg/hgrc
       
   203   > [extensions]
       
   204   > topic=!
       
   205   > EOF
       
   206   $ hg push ssh://user@dummy/draft
       
   207   pushing to ssh://user@dummy/draft
       
   208   searching for changes
       
   209   abort: push creates new remote head 84eaf32db6c3!
       
   210   (merge or see 'hg help push' for details about pushing new heads)
       
   211   [255]
       
   212   $ hg log -G
       
   213   @  6 default celeste draft CE
       
   214   |
       
   215   | o  5 default babar draft CD
       
   216   |/
       
   217   | o  4 mountain  public CC
       
   218   |/
       
   219   | o  1 default  public CB
       
   220   |/
       
   221   o  0 default  public CA
       
   222   
       
   223 
       
   224 Pushing a new topic to a non publishing server should not be seen as a new head
       
   225 
       
   226   $ printf "topic=" >> ../draft/.hg/hgrc
       
   227   $ hg config extensions.topic >> ../draft/.hg/hgrc
       
   228   $ hg push ssh://user@dummy/draft
       
   229   pushing to ssh://user@dummy/draft
       
   230   searching for changes
       
   231   remote: adding changesets
       
   232   remote: adding manifests
       
   233   remote: adding file changes
       
   234   remote: added 1 changesets with 1 changes to 1 files (+1 heads)
       
   235   $ hg log -G
       
   236   @  6 default celeste draft CE
       
   237   |
       
   238   | o  5 default babar draft CD
       
   239   |/
       
   240   | o  4 mountain  public CC
       
   241   |/
       
   242   | o  1 default  public CB
       
   243   |/
       
   244   o  0 default  public CA
       
   245   
       
   246 
       
   247 Pushing a new topic to a publishing server should be seen as a new head
       
   248 
       
   249   $ hg push ssh://user@dummy/main
       
   250   pushing to ssh://user@dummy/main
       
   251   searching for changes
       
   252   abort: push creates new remote head 67f579af159d!
       
   253   (merge or see 'hg help push' for details about pushing new heads)
       
   254   [255]
       
   255   $ hg log -G
       
   256   @  6 default celeste draft CE
       
   257   |
       
   258   | o  5 default babar draft CD
       
   259   |/
       
   260   | o  4 mountain  public CC
       
   261   |/
       
   262   | o  1 default  public CB
       
   263   |/
       
   264   o  0 default  public CA
       
   265   
       
   266 
       
   267 Check that we reject multiple head on the same topic
       
   268 ----------------------------------------------------
       
   269 
       
   270   $ hg up 'desc(CB)'
       
   271   1 files updated, 0 files merged, 1 files removed, 0 files unresolved
       
   272   $ hg topic babar
       
   273   $ echo aaa > fff
       
   274   $ hg add fff
       
   275   $ hg commit -m 'CF'
       
   276   $ hg log -G
       
   277   @  7 default babar draft CF
       
   278   |
       
   279   | o  6 default celeste draft CE
       
   280   | |
       
   281   | | o  5 default babar draft CD
       
   282   | |/
       
   283   | | o  4 mountain  public CC
       
   284   | |/
       
   285   o |  1 default  public CB
       
   286   |/
       
   287   o  0 default  public CA
       
   288   
       
   289 
       
   290   $ hg push draft
       
   291   pushing to $TESTTMP/draft (glob)
       
   292   searching for changes
       
   293   abort: push creates new remote head f0bc62a661be on branch 'default:babar'!
       
   294   (merge or see 'hg help push' for details about pushing new heads)
       
   295   [255]
       
   296 
       
   297 Multiple head on a branch merged in a topic changesets
       
   298 ------------------------------------------------------------------------
       
   299 
       
   300 
       
   301   $ hg up 'desc(CA)'
       
   302   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
       
   303   $ echo aaa > ggg
       
   304   $ hg add ggg
       
   305   $ hg commit -m 'CG'
       
   306   created new head
       
   307   $ hg up 'desc(CF)'
       
   308   switching to topic babar
       
   309   2 files updated, 0 files merged, 1 files removed, 0 files unresolved
       
   310   $ hg merge 'desc(CG)'
       
   311   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   312   (branch merge, don't forget to commit)
       
   313   $ hg commit -m 'CM'
       
   314   $ hg log -G
       
   315   @    9 default babar draft CM
       
   316   |\
       
   317   | o  8 default  draft CG
       
   318   | |
       
   319   o |  7 default babar draft CF
       
   320   | |
       
   321   | | o  6 default celeste draft CE
       
   322   | |/
       
   323   | | o  5 default babar draft CD
       
   324   | |/
       
   325   | | o  4 mountain  public CC
       
   326   | |/
       
   327   o |  1 default  public CB
       
   328   |/
       
   329   o  0 default  public CA
       
   330   
       
   331 
       
   332 Reject when pushing to draft
       
   333 
       
   334   $ hg push draft -r .
       
   335   pushing to $TESTTMP/draft (glob)
       
   336   searching for changes
       
   337   abort: push creates new remote head 4937c4cad39e!
       
   338   (merge or see 'hg help push' for details about pushing new heads)
       
   339   [255]
       
   340 
       
   341 
       
   342 Reject when pushing to publishing
       
   343 
       
   344   $ hg push -r .
       
   345   pushing to $TESTTMP/main (glob)
       
   346   searching for changes
       
   347   adding changesets
       
   348   adding manifests
       
   349   adding file changes
       
   350   added 3 changesets with 2 changes to 2 files
       
   351 
       
   352   $ cd ..
       
   353 
       
   354 Test phase move
       
   355 ==================================
       
   356 
       
   357 setup, two repo knowns about two small topic branch
       
   358 
       
   359   $ hg init repoA
       
   360   $ hg clone repoA repoB
       
   361   updating to branch default
       
   362   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   363   $ cat << EOF >> repoA/.hg/hgrc
       
   364   > [phases]
       
   365   > publish=False
       
   366   > EOF
       
   367   $ cat << EOF >> repoB/.hg/hgrc
       
   368   > [phases]
       
   369   > publish=False
       
   370   > EOF
       
   371   $ cd repoA
       
   372   $ echo aaa > base
       
   373   $ hg add base
       
   374   $ hg commit -m 'CBASE'
       
   375   $ echo aaa > aaa
       
   376   $ hg add aaa
       
   377   $ hg topic topicA
       
   378   $ hg commit -m 'CA'
       
   379   $ hg up 'desc(CBASE)'
       
   380   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
       
   381   $ echo aaa > bbb
       
   382   $ hg add bbb
       
   383   $ hg topic topicB
       
   384   $ hg commit -m 'CB'
       
   385   $ cd ..
       
   386   $ hg push -R repoA repoB
       
   387   pushing to repoB
       
   388   searching for changes
       
   389   adding changesets
       
   390   adding manifests
       
   391   adding file changes
       
   392   added 3 changesets with 3 changes to 3 files (+1 heads)
       
   393   $ hg log -G -R repoA
       
   394   @  2 default topicB draft CB
       
   395   |
       
   396   | o  1 default topicA draft CA
       
   397   |/
       
   398   o  0 default  draft CBASE
       
   399   
       
   400 
       
   401 We turn different topic to public on each side,
       
   402 
       
   403   $ hg -R repoA phase --public topicA
       
   404   $ hg -R repoB phase --public topicB
       
   405 
       
   406 Pushing should complain because it create to heads on default
       
   407 
       
   408   $ hg push -R repoA repoB
       
   409   pushing to repoB
       
   410   searching for changes
       
   411   no changes found
       
   412   abort: push create a new head on branch "default"
       
   413   [255]