tests/test-sharing.t
branchmercurial-4.3
changeset 4174 e07e764c0f48
parent 3936 537fd9a86c06
parent 4173 e268f7fd7839
child 4207 3d917da5bd95
equal deleted inserted replaced
4173:e268f7fd7839 4174:e07e764c0f48
    44   requesting all changes
    44   requesting all changes
    45   adding changesets
    45   adding changesets
    46   adding manifests
    46   adding manifests
    47   adding file changes
    47   adding file changes
    48   added 1 changesets with 1 changes to 1 files
    48   added 1 changesets with 1 changes to 1 files
    49   new changesets 0dc9c9f6ab91
       
    50   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
    49   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
    51 
    50 
    52 Let's commit a preliminary change and push it to ``test-repo`` for
    51 Let's commit a preliminary change and push it to ``test-repo`` for
    53 testing. ::
    52 testing. ::
    54 
    53 
    68   $ echo 'Fix fix fix.' > file1
    67   $ echo 'Fix fix fix.' > file1
    69   $ hg amend -m'fix bug 37'
    68   $ hg amend -m'fix bug 37'
    70 
    69 
    71 Figure SG02
    70 Figure SG02
    72   $ hg shortlog --hidden -G
    71   $ hg shortlog --hidden -G
    73   @  2:60ffde5765c5  draft  fix bug 37
    72   @  3:60ffde5765c5  draft  fix bug 37
    74   |
    73   |
       
    74   | x  2:2a039763c0f4  draft  temporary amend commit for f6490818a721
       
    75   | |
    75   | x  1:f6490818a721  draft  prelim change
    76   | x  1:f6490818a721  draft  prelim change
    76   |/
    77   |/
    77   o  0:0dc9c9f6ab91  public  create new project
    78   o  0:0dc9c9f6ab91  public  create new project
    78   
    79   
    79 Pull into dev-repo: obsolescence markers are transferred, but not
    80 Pull into dev-repo: obsolescence markers are transferred, but not
    84   searching for changes
    85   searching for changes
    85   adding changesets
    86   adding changesets
    86   adding manifests
    87   adding manifests
    87   adding file changes
    88   adding file changes
    88   added 1 changesets with 1 changes to 1 files (+1 heads)
    89   added 1 changesets with 1 changes to 1 files (+1 heads)
    89   1 new obsolescence markers
    90   2 new obsolescence markers
    90   obsoleted 1 changesets
    91   obsoleted 1 changesets
    91   new changesets 60ffde5765c5
       
    92   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
    92   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
    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
   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   @  4:de6151c48e1c  draft  fix bug 37
   112   |
   112   |
       
   113   | x  3:ad19d3570adb  draft  temporary amend commit for 60ffde5765c5
       
   114   | |
   113   | x  2:60ffde5765c5  draft  fix bug 37
   115   | x  2:60ffde5765c5  draft  fix bug 37
   114   |/
   116   |/
   115   | x  1:f6490818a721  draft  prelim change
   117   | x  1:f6490818a721  draft  prelim change
   116   |/
   118   |/
   117   o  0:0dc9c9f6ab91  public  create new project
   119   o  0:0dc9c9f6ab91  public  create new project
   121   $ hg update
   123   $ hg update
   122   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   124   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   123   updated to "de6151c48e1c: fix bug 37"
   125   updated to "de6151c48e1c: fix bug 37"
   124   1 other heads for branch "default"
   126   1 other heads for branch "default"
   125   $ hg shortlog --hidden -G
   127   $ hg shortlog --hidden -G
   126   @  3:de6151c48e1c  draft  fix bug 37
   128   @  4:de6151c48e1c  draft  fix bug 37
   127   |
   129   |
   128   | x  2:60ffde5765c5  draft  fix bug 37
   130   | x  3:60ffde5765c5  draft  fix bug 37
   129   |/
   131   |/
       
   132   | x  2:2a039763c0f4  draft  temporary amend commit for f6490818a721
       
   133   | |
   130   | x  1:f6490818a721  draft  prelim change
   134   | x  1:f6490818a721  draft  prelim change
   131   |/
   135   |/
   132   o  0:0dc9c9f6ab91  public  create new project
   136   o  0:0dc9c9f6ab91  public  create new project
   133   
   137   
   134 This bug fix is finished. We can push it to the public repository.
   138 This bug fix is finished. We can push it to the public repository.
   137   searching for changes
   141   searching for changes
   138   adding changesets
   142   adding changesets
   139   adding manifests
   143   adding manifests
   140   adding file changes
   144   adding file changes
   141   added 1 changesets with 1 changes to 1 files
   145   added 1 changesets with 1 changes to 1 files
   142   2 new obsolescence markers
   146   4 new obsolescence markers
   143 
   147 
   144 Now that the fix is public, we cannot amend it any more.
   148 Now that the fix is public, we cannot amend it any more.
   145   $ hg amend -m 'fix bug 37'
   149   $ hg amend -m 'fix bug 37'
   146   abort: cannot amend public changesets: de6151c48e1c
   150   abort: cannot amend public changesets: de6151c48e1c
   147   (see 'hg help phases' for details)
   151   (see 'hg help phases' for details)
   153   |
   157   |
   154   o  0:0dc9c9f6ab91  public  create new project
   158   o  0:0dc9c9f6ab91  public  create new project
   155   
   159   
   156 Oops, still have draft changesets in dev-repo: push the phase change there.
   160 Oops, still have draft changesets in dev-repo: push the phase change there.
   157   $ hg -R ../dev-repo shortlog -r 'draft()'
   161   $ hg -R ../dev-repo shortlog -r 'draft()'
   158   3:de6151c48e1c  draft  fix bug 37
   162   4:de6151c48e1c  draft  fix bug 37
   159   $ hg push ../dev-repo
   163   $ hg push ../dev-repo
   160   pushing to ../dev-repo
   164   pushing to ../dev-repo
   161   searching for changes
   165   searching for changes
   162   no changes found
   166   no changes found
   163   [1]
   167   [1]
   206   searching for changes
   210   searching for changes
   207   adding changesets
   211   adding changesets
   208   adding manifests
   212   adding manifests
   209   adding file changes
   213   adding file changes
   210   added 1 changesets with 1 changes to 1 files (+1 heads)
   214   added 1 changesets with 1 changes to 1 files (+1 heads)
   211   1 new obsolescence markers
   215   2 new obsolescence markers
   212   obsoleted 1 changesets
   216   obsoleted 1 changesets
   213   updating bookmark bug15
   217   updating bookmark bug15
   214   $ hg -R ../review bookmarks
   218   $ hg -R ../review bookmarks
   215      bug15                     3:cbdfbd5a5db2
   219      bug15                     3:cbdfbd5a5db2
   216 
   220 
   251   remote has heads on branch 'default' that are not known locally: cbdfbd5a5db2
   255   remote has heads on branch 'default' that are not known locally: cbdfbd5a5db2
   252   adding changesets
   256   adding changesets
   253   adding manifests
   257   adding manifests
   254   adding file changes
   258   adding file changes
   255   added 1 changesets with 1 changes to 1 files (+1 heads)
   259   added 1 changesets with 1 changes to 1 files (+1 heads)
   256   1 new obsolescence markers
   260   2 new obsolescence markers
   257   obsoleted 1 changesets
   261   obsoleted 1 changesets
   258   updating bookmark featureX
   262   updating bookmark featureX
   259 
   263 
   260 Bob receives second review, amends, and pushes to public:
   264 Bob receives second review, amends, and pushes to public:
   261 this time, he's sure he got it right!
   265 this time, he's sure he got it right!
   266   searching for changes
   270   searching for changes
   267   adding changesets
   271   adding changesets
   268   adding manifests
   272   adding manifests
   269   adding file changes
   273   adding file changes
   270   added 1 changesets with 1 changes to 1 files
   274   added 1 changesets with 1 changes to 1 files
   271   2 new obsolescence markers
   275   4 new obsolescence markers
   272   $ hg -R ../public bookmarks
   276   $ hg -R ../public bookmarks
   273   no bookmarks set
   277   no bookmarks set
   274   $ hg push ../review
   278   $ hg push ../review
   275   pushing to ../review
   279   pushing to ../review
   276   searching for changes
   280   searching for changes
   277   remote has heads on branch 'default' that are not known locally: cbdfbd5a5db2
   281   remote has heads on branch 'default' that are not known locally: cbdfbd5a5db2
   278   adding changesets
   282   adding changesets
   279   adding manifests
   283   adding manifests
   280   adding file changes
   284   adding file changes
   281   added 1 changesets with 1 changes to 1 files (+1 heads)
   285   added 1 changesets with 1 changes to 1 files (+1 heads)
   282   1 new obsolescence markers
   286   2 new obsolescence markers
   283   obsoleted 1 changesets
   287   obsoleted 1 changesets
   284   updating bookmark featureX
   288   updating bookmark featureX
   285   $ hg -R ../review bookmarks
   289   $ hg -R ../review bookmarks
   286      bug15                     3:cbdfbd5a5db2
   290      bug15                     3:cbdfbd5a5db2
   287      featureX                  6:540ba8f317e6
   291      featureX                  6:540ba8f317e6
   327 
   331 
   328 Meantime, Alice is back from lunch. While she was away, Bob approved
   332 Meantime, Alice is back from lunch. While she was away, Bob approved
   329 her change, so now she can publish it.
   333 her change, so now she can publish it.
   330   $ cd ../alice
   334   $ cd ../alice
   331   $ hg --hidden shortlog -G -r 1::
   335   $ hg --hidden shortlog -G -r 1::
   332   @  3:cbdfbd5a5db2  draft  fix bug 15 (v2)
   336   @  4:cbdfbd5a5db2  draft  fix bug 15 (v2)
   333   |
   337   |
       
   338   | x  3:55dd95168a35  draft  temporary amend commit for f91e97234c2b
       
   339   | |
   334   | x  2:f91e97234c2b  draft  fix bug 15 (v1)
   340   | x  2:f91e97234c2b  draft  fix bug 15 (v1)
   335   |/
   341   |/
   336   o  1:de6151c48e1c  public  fix bug 37
   342   o  1:de6151c48e1c  public  fix bug 37
   337   |
   343   |
   338   ~
   344   ~
   339   $ hg outgoing -q ../public
   345   $ hg outgoing -q ../public
   340   3:cbdfbd5a5db2
   346   4:cbdfbd5a5db2
   341   $ hg push ../public
   347   $ hg push ../public
   342   pushing to ../public
   348   pushing to ../public
   343   searching for changes
   349   searching for changes
   344   remote has heads on branch 'default' that are not known locally: 540ba8f317e6
   350   remote has heads on branch 'default' that are not known locally: 540ba8f317e6
   345   abort: push creates new remote head cbdfbd5a5db2 with bookmark 'bug15'!
   351   abort: push creates new remote head cbdfbd5a5db2 with bookmark 'bug15'!
   350   searching for changes
   356   searching for changes
   351   adding changesets
   357   adding changesets
   352   adding manifests
   358   adding manifests
   353   adding file changes
   359   adding file changes
   354   added 1 changesets with 1 changes to 1 files (+1 heads)
   360   added 1 changesets with 1 changes to 1 files (+1 heads)
   355   2 new obsolescence markers
   361   4 new obsolescence markers
   356   new changesets 540ba8f317e6
       
   357   (run 'hg heads' to see heads, 'hg merge' to merge)
   362   (run 'hg heads' to see heads, 'hg merge' to merge)
   358   $ hg log -G -q -r 'head()'
   363   $ hg log -G -q -r 'head()'
   359   o  4:540ba8f317e6
   364   o  5:540ba8f317e6
   360   |
   365   |
   361   ~
   366   ~
   362   @  3:cbdfbd5a5db2
   367   @  4:cbdfbd5a5db2
   363   |
   368   |
   364   ~
   369   ~
   365   $ hg --hidden shortlog -G -r 1::
   370   $ hg --hidden shortlog -G -r 1::
   366   o  4:540ba8f317e6  public  implement feature X (v3)
   371   o  5:540ba8f317e6  public  implement feature X (v3)
   367   |
   372   |
   368   | @  3:cbdfbd5a5db2  draft  fix bug 15 (v2)
   373   | @  4:cbdfbd5a5db2  draft  fix bug 15 (v2)
   369   |/
   374   |/
       
   375   | x  3:55dd95168a35  draft  temporary amend commit for f91e97234c2b
       
   376   | |
   370   | x  2:f91e97234c2b  draft  fix bug 15 (v1)
   377   | x  2:f91e97234c2b  draft  fix bug 15 (v1)
   371   |/
   378   |/
   372   o  1:de6151c48e1c  public  fix bug 37
   379   o  1:de6151c48e1c  public  fix bug 37
   373   |
   380   |
   374   ~
   381   ~
   375 
   382 
   376 Alice rebases her draft changeset on top of Bob's public changeset and
   383 Alice rebases her draft changeset on top of Bob's public changeset and
   377 publishes the result.
   384 publishes the result.
   378   $ hg rebase -d 5
   385   $ hg rebase -d 5
   379   rebasing 3:cbdfbd5a5db2 "fix bug 15 (v2)" (bug15)
   386   rebasing 4:cbdfbd5a5db2 "fix bug 15 (v2)" (bug15)
   380   $ hg push ../public
   387   $ hg push ../public
   381   pushing to ../public
   388   pushing to ../public
   382   searching for changes
   389   searching for changes
   383   adding changesets
   390   adding changesets
   384   adding manifests
   391   adding manifests
   385   adding file changes
   392   adding file changes
   386   added 1 changesets with 1 changes to 1 files
   393   added 1 changesets with 1 changes to 1 files
   387   2 new obsolescence markers
   394   3 new obsolescence markers
   388   $ hg push ../review
   395   $ hg push ../review
   389   pushing to ../review
   396   pushing to ../review
   390   searching for changes
   397   searching for changes
   391   adding changesets
   398   adding changesets
   392   adding manifests
   399   adding manifests
   455   searching for changes
   462   searching for changes
   456   adding changesets
   463   adding changesets
   457   adding manifests
   464   adding manifests
   458   adding file changes
   465   adding file changes
   459   added 1 changesets with 1 changes to 1 files
   466   added 1 changesets with 1 changes to 1 files
   460   new changesets 2fe6c4bd32d0
       
   461   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   467   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   462   $ echo 'better fix (alice)' >> file1
   468   $ echo 'better fix (alice)' >> file1
   463   $ hg amend -u alice -m 'fix bug 24 (v2 by alice)'
   469   $ hg amend -u alice -m 'fix bug 24 (v2 by alice)'
   464 
   470 
   465 Bob implements a better fix of his own::
   471 Bob implements a better fix of his own::
   466 
   472 
   467   $ cd ../bob
   473   $ cd ../bob
   468   $ echo 'better fix (bob)' >> file1
   474   $ echo 'better fix (bob)' >> file1
   469   $ hg amend -u bob -m 'fix bug 24 (v2 by bob)'
   475   $ hg amend -u bob -m 'fix bug 24 (v2 by bob)'
   470   $ hg --hidden shortlog -G -r 3::
   476   $ hg --hidden shortlog -G -r 3::
   471   @  5:a360947f6faf  draft  fix bug 24 (v2 by bob)
   477   @  6:a360947f6faf  draft  fix bug 24 (v2 by bob)
   472   |
   478   |
       
   479   | x  5:3466c7f5a149  draft  temporary amend commit for 2fe6c4bd32d0
       
   480   | |
   473   | x  4:2fe6c4bd32d0  draft  fix bug 24 (v1)
   481   | x  4:2fe6c4bd32d0  draft  fix bug 24 (v1)
   474   |/
   482   |/
   475   o  3:a06ec1bf97bd  public  fix bug 15 (v2)
   483   o  3:a06ec1bf97bd  public  fix bug 15 (v2)
   476   |
   484   |
   477   ~
   485   ~
   482   searching for changes
   490   searching for changes
   483   adding changesets
   491   adding changesets
   484   adding manifests
   492   adding manifests
   485   adding file changes
   493   adding file changes
   486   added 1 changesets with 1 changes to 1 files (+1 heads)
   494   added 1 changesets with 1 changes to 1 files (+1 heads)
   487   1 new obsolescence markers
   495   2 new obsolescence markers
   488   new changesets e3f99ce9d9cd
       
   489   (run 'hg heads' to see heads, 'hg merge' to merge)
   496   (run 'hg heads' to see heads, 'hg merge' to merge)
   490   2 new content-divergent changesets
   497   2 new divergent changesets
   491 
   498 
   492 Figure SG09: multiple heads! divergence! oh my!
   499 Figure SG09: multiple heads! divergence! oh my!
   493   $ hg --hidden shortlog -G -r 3::
   500   $ hg --hidden shortlog -G -r 3::
   494   o  6:e3f99ce9d9cd  draft  fix bug 24 (v2 by alice)
   501   o  7:e3f99ce9d9cd  draft  fix bug 24 (v2 by alice)
   495   |
   502   |
   496   | @  5:a360947f6faf  draft  fix bug 24 (v2 by bob)
   503   | @  6:a360947f6faf  draft  fix bug 24 (v2 by bob)
   497   |/
   504   |/
       
   505   | x  5:3466c7f5a149  draft  temporary amend commit for 2fe6c4bd32d0
       
   506   | |
   498   | x  4:2fe6c4bd32d0  draft  fix bug 24 (v1)
   507   | x  4:2fe6c4bd32d0  draft  fix bug 24 (v1)
   499   |/
   508   |/
   500   o  3:a06ec1bf97bd  public  fix bug 15 (v2)
   509   o  3:a06ec1bf97bd  public  fix bug 15 (v2)
   501   |
   510   |
   502   ~
   511   ~
   503   $ hg --hidden shortlog -r 'successors(2fe6)'
   512   $ hg --hidden shortlog -r 'successors(2fe6)'
   504   5:a360947f6faf  draft  fix bug 24 (v2 by bob)
   513   6:a360947f6faf  draft  fix bug 24 (v2 by bob)
   505   6:e3f99ce9d9cd  draft  fix bug 24 (v2 by alice)
   514   7:e3f99ce9d9cd  draft  fix bug 24 (v2 by alice)
   506 
   515 
   507 Use evolve to fix the divergence.
   516 Use evolve to fix the divergence.
   508   $ cat > editor.sh <<EOF
   517   $ cat > editor.sh <<EOF
   509   > #!/bin/sh
   518   > #!/bin/sh
   510   > cat > \$1 <<ENDOF
   519   > cat > \$1 <<ENDOF
   511   > fix bug 24 (v2 by bob)
   520   > fix bug 24 (v2 by bob)
   512   > ENDOF
   521   > ENDOF
   513   > EOF
   522   > EOF
   514 
   523 
   515   $ HGEDITOR='sh ./editor.sh' HGMERGE=internal:other hg evolve --content-divergent
   524   $ HGEDITOR='sh ./editor.sh' HGMERGE=internal:other hg evolve --content-divergent
   516   merge:[5] fix bug 24 (v2 by bob)
   525   merge:[6] fix bug 24 (v2 by bob)
   517   with: [6] fix bug 24 (v2 by alice)
   526   with: [7] fix bug 24 (v2 by alice)
   518   base: [4] fix bug 24 (v1)
   527   base: [4] fix bug 24 (v1)
   519   merging "other" content-divergent changeset 'e3f99ce9d9cd'
   528   merging "other" divergent changeset 'e3f99ce9d9cd'
   520   0 files updated, 1 files merged, 0 files removed, 0 files unresolved
   529   0 files updated, 1 files merged, 0 files removed, 0 files unresolved
   521   working directory is now at 711ede2d7a26
   530   working directory is now at 711ede2d7a26
   522   $ hg log -q -r 'contentdivergent()'
   531   $ hg log -q -r 'contentdivergent()'
   523 
   532 
   524 Figure SG10: Bob's repository after fixing divergence.
   533 Figure SG10: Bob's repository after fixing divergence.
   525   $ hg --hidden shortlog -G -r 3::
   534   $ hg --hidden shortlog -G -r 3::
   526   @  7:711ede2d7a26  draft  fix bug 24 (v2 by bob)
   535   @  8:711ede2d7a26  draft  fix bug 24 (v2 by bob)
   527   |
   536   |
   528   | x  6:e3f99ce9d9cd  draft  fix bug 24 (v2 by alice)
   537   | x  7:e3f99ce9d9cd  draft  fix bug 24 (v2 by alice)
   529   |/
   538   |/
   530   | x  5:a360947f6faf  draft  fix bug 24 (v2 by bob)
   539   | x  6:a360947f6faf  draft  fix bug 24 (v2 by bob)
   531   |/
   540   |/
       
   541   | x  5:3466c7f5a149  draft  temporary amend commit for 2fe6c4bd32d0
       
   542   | |
   532   | x  4:2fe6c4bd32d0  draft  fix bug 24 (v1)
   543   | x  4:2fe6c4bd32d0  draft  fix bug 24 (v1)
   533   |/
   544   |/
   534   o  3:a06ec1bf97bd  public  fix bug 15 (v2)
   545   o  3:a06ec1bf97bd  public  fix bug 15 (v2)
   535   |
   546   |
   536   ~
   547   ~
   537   $ hg --hidden shortlog -r 'precursors(711ede2d7a26)'
   548   $ hg --hidden shortlog -r 'precursors(711ede2d7a26)'
   538   5:a360947f6faf  draft  fix bug 24 (v2 by bob)
   549   6:a360947f6faf  draft  fix bug 24 (v2 by bob)
   539   6:e3f99ce9d9cd  draft  fix bug 24 (v2 by alice)
   550   7:e3f99ce9d9cd  draft  fix bug 24 (v2 by alice)
   540   $ cat file1
   551   $ cat file1
   541   Do stuff.
   552   Do stuff.
   542   pretty good fix
   553   pretty good fix
   543   better fix (alice)
   554   better fix (alice)