tests/test-sharing.t
branchstable
changeset 4930 44f340c2a8eb
parent 4633 61c2518cd6d2
child 4931 6408d7a01b59
equal deleted inserted replaced
4926:0fad1d376814 4930:44f340c2a8eb
     3 
     3 
     4 Setting things up
     4 Setting things up
     5 
     5 
     6   $ cat >> $HGRCPATH <<EOF
     6   $ cat >> $HGRCPATH <<EOF
     7   > [alias]
     7   > [alias]
     8   > shortlog = log --template '{rev}:{node|short}  {phase}  {desc|firstline}\n'
     8   > shortlog = log --template '{rev}:{node|shortest}  {phase}  {desc|firstline}\n'
     9   > [extensions]
     9   > [extensions]
    10   > rebase =
    10   > rebase =
    11   > EOF
    11   > EOF
    12   $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH
    12   $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH
    13   $ hg init public
    13   $ hg init public
    56   $ hg commit -m'prelim change'
    56   $ hg commit -m'prelim change'
    57   $ hg push -q ../test-repo
    57   $ hg push -q ../test-repo
    58 
    58 
    59 Figure SG01 (roughly)
    59 Figure SG01 (roughly)
    60   $ hg shortlog -G
    60   $ hg shortlog -G
    61   @  1:f6490818a721  draft  prelim change
    61   @  1:f649  draft  prelim change
    62   |
    62   |
    63   o  0:0dc9c9f6ab91  public  create new project
    63   o  0:0dc9  public  create new project
    64   
    64   
    65 Now let's switch to test-repo to test our change and amend::
    65 Now let's switch to test-repo to test our change and amend::
    66   $ cd ../test-repo
    66   $ cd ../test-repo
    67   $ hg update -q
    67   $ hg update -q
    68   $ echo 'Fix fix fix.' > file1
    68   $ echo 'Fix fix fix.' > file1
    69   $ hg amend -m'fix bug 37'
    69   $ hg amend -m'fix bug 37'
    70 
    70 
    71 Figure SG02
    71 Figure SG02
    72   $ hg shortlog --hidden -G
    72   $ hg shortlog --hidden -G
    73   @  2:60ffde5765c5  draft  fix bug 37
    73   @  2:60ff  draft  fix bug 37
    74   |
    74   |
    75   | x  1:f6490818a721  draft  prelim change
    75   | x  1:f649  draft  prelim change
    76   |/
    76   |/
    77   o  0:0dc9c9f6ab91  public  create new project
    77   o  0:0dc9  public  create new project
    78   
    78   
    79 Pull into dev-repo: obsolescence markers are transferred, but not
    79 Pull into dev-repo: obsolescence markers are transferred, but not
    80 the new obsolete changeset.
    80 the new obsolete changeset.
    81   $ cd ../dev-repo
    81   $ cd ../dev-repo
    82   $ hg pull -u
    82   $ hg pull -u
    93   updated to "60ffde5765c5: fix bug 37"
    93   updated to "60ffde5765c5: fix bug 37"
    94   1 other heads for branch "default"
    94   1 other heads for branch "default"
    95 
    95 
    96 Figure SG03
    96 Figure SG03
    97   $ hg shortlog --hidden -G
    97   $ hg shortlog --hidden -G
    98   @  2:60ffde5765c5  draft  fix bug 37
    98   @  2:60ff  draft  fix bug 37
    99   |
    99   |
   100   | x  1:f6490818a721  draft  prelim change
   100   | x  1:f649  draft  prelim change
   101   |/
   101   |/
   102   o  0:0dc9c9f6ab91  public  create new project
   102   o  0:0dc9  public  create new project
   103   
   103   
   104 Amend again in dev-repo
   104 Amend again in dev-repo
   105   $ echo 'Fix, fix, and fix.' > file1
   105   $ echo 'Fix, fix, and fix.' > file1
   106   $ hg amend
   106   $ hg amend
   107   $ hg push -q
   107   $ hg push -q
   108 
   108 
   109 Figure SG04 (dev-repo)
   109 Figure SG04 (dev-repo)
   110   $ hg shortlog --hidden -G
   110   $ hg shortlog --hidden -G
   111   @  3:de6151c48e1c  draft  fix bug 37
   111   @  3:de61  draft  fix bug 37
   112   |
   112   |
   113   | x  2:60ffde5765c5  draft  fix bug 37
   113   | x  2:60ff  draft  fix bug 37
   114   |/
   114   |/
   115   | x  1:f6490818a721  draft  prelim change
   115   | x  1:f649  draft  prelim change
   116   |/
   116   |/
   117   o  0:0dc9c9f6ab91  public  create new project
   117   o  0:0dc9  public  create new project
   118   
   118   
   119 Figure SG04 (test-repo)
   119 Figure SG04 (test-repo)
   120   $ cd ../test-repo
   120   $ cd ../test-repo
   121   $ hg update
   121   $ hg update
   122   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   122   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   123   updated to "de6151c48e1c: fix bug 37"
   123   updated to "de6151c48e1c: fix bug 37"
   124   1 other heads for branch "default"
   124   1 other heads for branch "default"
   125   $ hg shortlog --hidden -G
   125   $ hg shortlog --hidden -G
   126   @  3:de6151c48e1c  draft  fix bug 37
   126   @  3:de61  draft  fix bug 37
   127   |
   127   |
   128   | x  2:60ffde5765c5  draft  fix bug 37
   128   | x  2:60ff  draft  fix bug 37
   129   |/
   129   |/
   130   | x  1:f6490818a721  draft  prelim change
   130   | x  1:f649  draft  prelim change
   131   |/
   131   |/
   132   o  0:0dc9c9f6ab91  public  create new project
   132   o  0:0dc9  public  create new project
   133   
   133   
   134 This bug fix is finished. We can push it to the public repository.
   134 This bug fix is finished. We can push it to the public repository.
   135   $ hg push
   135   $ hg push
   136   pushing to $TESTTMP/public (glob)
   136   pushing to $TESTTMP/public (glob)
   137   searching for changes
   137   searching for changes
   147   (see 'hg help phases' for details)
   147   (see 'hg help phases' for details)
   148   [255]
   148   [255]
   149 
   149 
   150 Figure SG05
   150 Figure SG05
   151   $ hg -R ../public shortlog -G
   151   $ hg -R ../public shortlog -G
   152   o  1:de6151c48e1c  public  fix bug 37
   152   o  1:de61  public  fix bug 37
   153   |
   153   |
   154   o  0:0dc9c9f6ab91  public  create new project
   154   o  0:0dc9  public  create new project
   155   
   155   
   156 Oops, still have draft changesets in dev-repo: push the phase change there.
   156 Oops, still have draft changesets in dev-repo: push the phase change there.
   157   $ hg -R ../dev-repo shortlog -r 'draft()'
   157   $ hg -R ../dev-repo shortlog -r 'draft()'
   158   3:de6151c48e1c  draft  fix bug 37
   158   3:de61  draft  fix bug 37
   159   $ hg push ../dev-repo
   159   $ hg push ../dev-repo
   160   pushing to ../dev-repo
   160   pushing to ../dev-repo
   161   searching for changes
   161   searching for changes
   162   no changes found
   162   no changes found
   163   [1]
   163   [1]
   214   $ hg -R ../review bookmarks
   214   $ hg -R ../review bookmarks
   215      bug15                     3:cbdfbd5a5db2
   215      bug15                     3:cbdfbd5a5db2
   216 
   216 
   217 Figure SG06: review repository after Alice pushes her amended changeset.
   217 Figure SG06: review repository after Alice pushes her amended changeset.
   218   $ hg --hidden -R ../review shortlog -G -r 1::
   218   $ hg --hidden -R ../review shortlog -G -r 1::
   219   o  3:cbdfbd5a5db2  draft  fix bug 15 (v2)
   219   o  3:cbdf  draft  fix bug 15 (v2)
   220   |
   220   |
   221   | x  2:f91e97234c2b  draft  fix bug 15 (v1)
   221   | x  2:f91e  draft  fix bug 15 (v1)
   222   |/
   222   |/
   223   @  1:de6151c48e1c  public  fix bug 37
   223   @  1:de61  public  fix bug 37
   224   |
   224   |
   225   ~
   225   ~
   226 
   226 
   227 Bob commits a draft changeset, pushes to review repo.
   227 Bob commits a draft changeset, pushes to review repo.
   228   $ cd ../bob
   228   $ cd ../bob
   286      bug15                     3:cbdfbd5a5db2
   286      bug15                     3:cbdfbd5a5db2
   287      featureX                  6:540ba8f317e6
   287      featureX                  6:540ba8f317e6
   288 
   288 
   289 Figure SG07: review and public repos after Bob implements feature X.
   289 Figure SG07: review and public repos after Bob implements feature X.
   290   $ hg --hidden -R ../review shortlog -G -r 1::
   290   $ hg --hidden -R ../review shortlog -G -r 1::
   291   o  6:540ba8f317e6  public  implement feature X (v3)
   291   o  6:540b  public  implement feature X (v3)
   292   |
   292   |
   293   | x  5:0eb74a7b6698  draft  implement feature X (v2)
   293   | x  5:0eb7  draft  implement feature X (v2)
   294   |/
   294   |/
   295   | x  4:193657d1e852  draft  implement feature X (v1)
   295   | x  4:1936  draft  implement feature X (v1)
   296   |/
   296   |/
   297   | o  3:cbdfbd5a5db2  draft  fix bug 15 (v2)
   297   | o  3:cbdf  draft  fix bug 15 (v2)
   298   |/
   298   |/
   299   | x  2:f91e97234c2b  draft  fix bug 15 (v1)
   299   | x  2:f91e  draft  fix bug 15 (v1)
   300   |/
   300   |/
   301   @  1:de6151c48e1c  public  fix bug 37
   301   @  1:de61  public  fix bug 37
   302   |
   302   |
   303   ~
   303   ~
   304   $ hg --hidden -R ../public shortlog -G -r 1::
   304   $ hg --hidden -R ../public shortlog -G -r 1::
   305   o  2:540ba8f317e6  public  implement feature X (v3)
   305   o  2:540b  public  implement feature X (v3)
   306   |
   306   |
   307   o  1:de6151c48e1c  public  fix bug 37
   307   o  1:de61  public  fix bug 37
   308   |
   308   |
   309   ~
   309   ~
   310 
   310 
   311 How do things look in the review repo?
   311 How do things look in the review repo?
   312   $ cd ../review
   312   $ cd ../review
   313   $ hg --hidden shortlog -G -r 1::
   313   $ hg --hidden shortlog -G -r 1::
   314   o  6:540ba8f317e6  public  implement feature X (v3)
   314   o  6:540b  public  implement feature X (v3)
   315   |
   315   |
   316   | x  5:0eb74a7b6698  draft  implement feature X (v2)
   316   | x  5:0eb7  draft  implement feature X (v2)
   317   |/
   317   |/
   318   | x  4:193657d1e852  draft  implement feature X (v1)
   318   | x  4:1936  draft  implement feature X (v1)
   319   |/
   319   |/
   320   | o  3:cbdfbd5a5db2  draft  fix bug 15 (v2)
   320   | o  3:cbdf  draft  fix bug 15 (v2)
   321   |/
   321   |/
   322   | x  2:f91e97234c2b  draft  fix bug 15 (v1)
   322   | x  2:f91e  draft  fix bug 15 (v1)
   323   |/
   323   |/
   324   @  1:de6151c48e1c  public  fix bug 37
   324   @  1:de61  public  fix bug 37
   325   |
   325   |
   326   ~
   326   ~
   327 
   327 
   328 Meantime, Alice is back from lunch. While she was away, Bob approved
   328 Meantime, Alice is back from lunch. While she was away, Bob approved
   329 her change, so now she can publish it.
   329 her change, so now she can publish it.
   330   $ cd ../alice
   330   $ cd ../alice
   331   $ hg --hidden shortlog -G -r 1::
   331   $ hg --hidden shortlog -G -r 1::
   332   @  3:cbdfbd5a5db2  draft  fix bug 15 (v2)
   332   @  3:cbdf  draft  fix bug 15 (v2)
   333   |
   333   |
   334   | x  2:f91e97234c2b  draft  fix bug 15 (v1)
   334   | x  2:f91e  draft  fix bug 15 (v1)
   335   |/
   335   |/
   336   o  1:de6151c48e1c  public  fix bug 37
   336   o  1:de61  public  fix bug 37
   337   |
   337   |
   338   ~
   338   ~
   339   $ hg outgoing -q ../public
   339   $ hg outgoing -q ../public
   340   3:cbdfbd5a5db2
   340   3:cbdfbd5a5db2
   341   $ hg push ../public
   341   $ hg push ../public
   361   ~
   361   ~
   362   @  3:cbdfbd5a5db2
   362   @  3:cbdfbd5a5db2
   363   |
   363   |
   364   ~
   364   ~
   365   $ hg --hidden shortlog -G -r 1::
   365   $ hg --hidden shortlog -G -r 1::
   366   o  4:540ba8f317e6  public  implement feature X (v3)
   366   o  4:540b  public  implement feature X (v3)
   367   |
   367   |
   368   | @  3:cbdfbd5a5db2  draft  fix bug 15 (v2)
   368   | @  3:cbdf  draft  fix bug 15 (v2)
   369   |/
   369   |/
   370   | x  2:f91e97234c2b  draft  fix bug 15 (v1)
   370   | x  2:f91e  draft  fix bug 15 (v1)
   371   |/
   371   |/
   372   o  1:de6151c48e1c  public  fix bug 37
   372   o  1:de61  public  fix bug 37
   373   |
   373   |
   374   ~
   374   ~
   375 
   375 
   376 Alice rebases her draft changeset on top of Bob's public changeset and
   376 Alice rebases her draft changeset on top of Bob's public changeset and
   377 publishes the result.
   377 publishes the result.
   396   obsoleted 1 changesets
   396   obsoleted 1 changesets
   397   updating bookmark bug15
   397   updating bookmark bug15
   398 
   398 
   399 Figure SG08: review and public changesets after Alice pushes.
   399 Figure SG08: review and public changesets after Alice pushes.
   400   $ hg --hidden -R ../review shortlog -G -r 1::
   400   $ hg --hidden -R ../review shortlog -G -r 1::
   401   o  7:a06ec1bf97bd  public  fix bug 15 (v2)
   401   o  7:a06e  public  fix bug 15 (v2)
   402   |
   402   |
   403   o  6:540ba8f317e6  public  implement feature X (v3)
   403   o  6:540b  public  implement feature X (v3)
   404   |
   404   |
   405   | x  5:0eb74a7b6698  draft  implement feature X (v2)
   405   | x  5:0eb7  draft  implement feature X (v2)
   406   |/
   406   |/
   407   | x  4:193657d1e852  draft  implement feature X (v1)
   407   | x  4:1936  draft  implement feature X (v1)
   408   |/
   408   |/
   409   | x  3:cbdfbd5a5db2  draft  fix bug 15 (v2)
   409   | x  3:cbdf  draft  fix bug 15 (v2)
   410   |/
   410   |/
   411   | x  2:f91e97234c2b  draft  fix bug 15 (v1)
   411   | x  2:f91e  draft  fix bug 15 (v1)
   412   |/
   412   |/
   413   @  1:de6151c48e1c  public  fix bug 37
   413   @  1:de61  public  fix bug 37
   414   |
   414   |
   415   ~
   415   ~
   416   $ hg --hidden -R ../public shortlog -G -r 1::
   416   $ hg --hidden -R ../public shortlog -G -r 1::
   417   o  3:a06ec1bf97bd  public  fix bug 15 (v2)
   417   o  3:a06e  public  fix bug 15 (v2)
   418   |
   418   |
   419   o  2:540ba8f317e6  public  implement feature X (v3)
   419   o  2:540b  public  implement feature X (v3)
   420   |
   420   |
   421   o  1:de6151c48e1c  public  fix bug 37
   421   o  1:de61  public  fix bug 37
   422   |
   422   |
   423   ~
   423   ~
   424   $ cd ..
   424   $ cd ..
   425 
   425 
   426 Setup for shared mutable history (to illustrate content-divergence and
   426 Setup for shared mutable history (to illustrate content-divergence and
   443 
   443 
   444   $ cd bob
   444   $ cd bob
   445   $ echo 'pretty good fix' >> file1
   445   $ echo 'pretty good fix' >> file1
   446   $ hg commit -u bob -m 'fix bug 24 (v1)'
   446   $ hg commit -u bob -m 'fix bug 24 (v1)'
   447   $ hg shortlog -r .
   447   $ hg shortlog -r .
   448   4:2fe6c4bd32d0  draft  fix bug 24 (v1)
   448   4:2fe6  draft  fix bug 24 (v1)
   449 
   449 
   450 Alice pulls Bob's draft changeset and amends it herself. ::
   450 Alice pulls Bob's draft changeset and amends it herself. ::
   451 
   451 
   452   $ cd ../alice
   452   $ cd ../alice
   453   $ hg pull -u ../bob
   453   $ hg pull -u ../bob
   466 
   466 
   467   $ cd ../bob
   467   $ cd ../bob
   468   $ echo 'better fix (bob)' >> file1
   468   $ echo 'better fix (bob)' >> file1
   469   $ hg amend -u bob -m 'fix bug 24 (v2 by bob)'
   469   $ hg amend -u bob -m 'fix bug 24 (v2 by bob)'
   470   $ hg --hidden shortlog -G -r 3::
   470   $ hg --hidden shortlog -G -r 3::
   471   @  5:a360947f6faf  draft  fix bug 24 (v2 by bob)
   471   @  5:a360  draft  fix bug 24 (v2 by bob)
   472   |
   472   |
   473   | x  4:2fe6c4bd32d0  draft  fix bug 24 (v1)
   473   | x  4:2fe6  draft  fix bug 24 (v1)
   474   |/
   474   |/
   475   o  3:a06ec1bf97bd  public  fix bug 15 (v2)
   475   o  3:a06e  public  fix bug 15 (v2)
   476   |
   476   |
   477   ~
   477   ~
   478 
   478 
   479 Bob discovers the divergence.
   479 Bob discovers the divergence.
   480   $ hg pull ../alice
   480   $ hg pull ../alice
   489   new changesets e3f99ce9d9cd (1 drafts)
   489   new changesets e3f99ce9d9cd (1 drafts)
   490   (run 'hg heads' to see heads, 'hg merge' to merge)
   490   (run 'hg heads' to see heads, 'hg merge' to merge)
   491 
   491 
   492 Figure SG09: multiple heads! divergence! oh my!
   492 Figure SG09: multiple heads! divergence! oh my!
   493   $ hg --hidden shortlog -G -r 3::
   493   $ hg --hidden shortlog -G -r 3::
   494   *  6:e3f99ce9d9cd  draft  fix bug 24 (v2 by alice)
   494   *  6:e3f9  draft  fix bug 24 (v2 by alice)
   495   |
   495   |
   496   | @  5:a360947f6faf  draft  fix bug 24 (v2 by bob)
   496   | @  5:a360  draft  fix bug 24 (v2 by bob)
   497   |/
   497   |/
   498   | x  4:2fe6c4bd32d0  draft  fix bug 24 (v1)
   498   | x  4:2fe6  draft  fix bug 24 (v1)
   499   |/
   499   |/
   500   o  3:a06ec1bf97bd  public  fix bug 15 (v2)
   500   o  3:a06e  public  fix bug 15 (v2)
   501   |
   501   |
   502   ~
   502   ~
   503   $ hg --hidden shortlog -r 'successors(2fe6)'
   503   $ hg --hidden shortlog -r 'successors(2fe6)'
   504   5:a360947f6faf  draft  fix bug 24 (v2 by bob)
   504   5:a360  draft  fix bug 24 (v2 by bob)
   505   6:e3f99ce9d9cd  draft  fix bug 24 (v2 by alice)
   505   6:e3f9  draft  fix bug 24 (v2 by alice)
   506 
   506 
   507 Use evolve to fix the divergence.
   507 Use evolve to fix the divergence.
   508   $ cat > editor.sh <<EOF
   508   $ cat > editor.sh <<EOF
   509   > #!/bin/sh
   509   > #!/bin/sh
   510   > cat > \$1 <<ENDOF
   510   > cat > \$1 <<ENDOF
   520   working directory is now at b1499b0f03ca
   520   working directory is now at b1499b0f03ca
   521   $ hg log -q -r 'contentdivergent()'
   521   $ hg log -q -r 'contentdivergent()'
   522 
   522 
   523 Figure SG10: Bob's repository after fixing divergence.
   523 Figure SG10: Bob's repository after fixing divergence.
   524   $ hg --hidden shortlog -G -r 3::
   524   $ hg --hidden shortlog -G -r 3::
   525   @  7:b1499b0f03ca  draft  fix bug 24 (v2 by bob)
   525   @  7:b149  draft  fix bug 24 (v2 by bob)
   526   |
   526   |
   527   | x  6:e3f99ce9d9cd  draft  fix bug 24 (v2 by alice)
   527   | x  6:e3f9  draft  fix bug 24 (v2 by alice)
   528   |/
   528   |/
   529   | x  5:a360947f6faf  draft  fix bug 24 (v2 by bob)
   529   | x  5:a360  draft  fix bug 24 (v2 by bob)
   530   |/
   530   |/
   531   | x  4:2fe6c4bd32d0  draft  fix bug 24 (v1)
   531   | x  4:2fe6  draft  fix bug 24 (v1)
   532   |/
   532   |/
   533   o  3:a06ec1bf97bd  public  fix bug 15 (v2)
   533   o  3:a06e  public  fix bug 15 (v2)
   534   |
   534   |
   535   ~
   535   ~
   536   $ hg --hidden shortlog -r 'predecessors(b1499b0f03ca)'
   536   $ hg --hidden shortlog -r 'predecessors(b1499b0f03ca)'
   537   5:a360947f6faf  draft  fix bug 24 (v2 by bob)
   537   5:a360  draft  fix bug 24 (v2 by bob)
   538   6:e3f99ce9d9cd  draft  fix bug 24 (v2 by alice)
   538   6:e3f9  draft  fix bug 24 (v2 by alice)
   539   $ cat file1
   539   $ cat file1
   540   Do stuff.
   540   Do stuff.
   541   pretty good fix
   541   pretty good fix
   542   better fix (alice)
   542   better fix (alice)