tests/test-sharing.t
branchstable
changeset 1259 0daf56a2032d
parent 1130 be31c34bb341
child 1261 56cc2eb5995a
equal deleted inserted replaced
1258:8873aedbd83d 1259:0daf56a2032d
     9   > [extensions]
     9   > [extensions]
    10   > rebase =
    10   > rebase =
    11   > EOF
    11   > EOF
    12   $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext/evolve.py" >> $HGRCPATH
    12   $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext/evolve.py" >> $HGRCPATH
    13   $ hg init public
    13   $ hg init public
    14   $ hg clone -q public test-repo
    14   $ hg clone public test-repo
    15   $ hg clone -q test-repo dev-repo
    15   updating to branch default
       
    16   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
    17   $ hg clone test-repo dev-repo
       
    18   updating to branch default
       
    19   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
    16   $ cat >> test-repo/.hg/hgrc <<EOF
    20   $ cat >> test-repo/.hg/hgrc <<EOF
    17   > [phases]
    21   > [phases]
    18   > publish = false
    22   > publish = false
    19   > EOF
    23   > EOF
    20 
    24 
    22 
    26 
    23   $ cd test-repo
    27   $ cd test-repo
    24   $ echo 'my new project' > file1
    28   $ echo 'my new project' > file1
    25   $ hg add file1
    29   $ hg add file1
    26   $ hg commit -m'create new project'
    30   $ hg commit -m'create new project'
    27   $ hg push -q
    31   $ hg push
       
    32   pushing to $TESTTMP/public
       
    33   searching for changes
       
    34   adding changesets
       
    35   adding manifests
       
    36   adding file changes
       
    37   added 1 changesets with 1 changes to 1 files
    28 
    38 
    29 and pull that into the development repository::
    39 and pull that into the development repository::
    30 
    40 
    31   $ cd ../dev-repo
    41   $ cd ../dev-repo
    32   $ hg pull -q -u
    42   $ hg pull -u
       
    43   pulling from $TESTTMP/test-repo
       
    44   requesting all changes
       
    45   adding changesets
       
    46   adding manifests
       
    47   adding file changes
       
    48   added 1 changesets with 1 changes to 1 files
       
    49   pull obsolescence markers
       
    50   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
    33 
    51 
    34 Let's commit a preliminary change and push it to ``test-repo`` for
    52 Let's commit a preliminary change and push it to ``test-repo`` for
    35 testing. ::
    53 testing. ::
    36 
    54 
    37   $ echo 'fix fix fix' > file1
    55   $ echo 'fix fix fix' > file1
    90   |/
   108   |/
    91   o  0:0dc9c9f6ab91  public  create new project
   109   o  0:0dc9c9f6ab91  public  create new project
    92   
   110   
    93 Figure SG04 (test-repo)
   111 Figure SG04 (test-repo)
    94   $ cd ../test-repo
   112   $ cd ../test-repo
    95   $ hg update -q
   113   $ hg update
       
   114   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
    96   $ hg shortlog --hidden -G
   115   $ hg shortlog --hidden -G
    97   @  4:de6151c48e1c  draft  fix bug 37
   116   @  4:de6151c48e1c  draft  fix bug 37
    98   |
   117   |
    99   | x  3:60ffde5765c5  draft  fix bug 37
   118   | x  3:60ffde5765c5  draft  fix bug 37
   100   |/
   119   |/
   130 
   149 
   131 Sharing by Alice and Bob to demonstrate bumped and divergent changesets.
   150 Sharing by Alice and Bob to demonstrate bumped and divergent changesets.
   132 First, setup repos for them.
   151 First, setup repos for them.
   133 
   152 
   134   $ cd ..
   153   $ cd ..
   135   $ hg clone -q public alice
   154   $ hg clone public alice
   136   $ hg clone -q public bob
   155   updating to branch default
       
   156   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   157   $ hg clone public bob
       
   158   updating to branch default
       
   159   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   137   $ cat >> alice/.hg/hgrc <<EOF
   160   $ cat >> alice/.hg/hgrc <<EOF
   138   > [phases]
   161   > [phases]
   139   > publish = false
   162   > publish = false
   140   > EOF
   163   > EOF
   141   $ cp alice/.hg/hgrc bob/.hg/hgrc
   164   $ cp alice/.hg/hgrc bob/.hg/hgrc
   142 
   165 
   143 Alice commits a bug fix.
   166 Alice commits a bug fix.
   144   $ cd alice
   167   $ cd alice
   145   $ echo 'fix' > file2
   168   $ echo 'fix' > file2
   146   $ hg commit -q -A -u alice -m 'fix bug 15'
   169   $ hg commit -A -u alice -m 'fix bug 15'
       
   170   adding file2
   147 
   171 
   148 Bob pulls and amends Alice's fix.
   172 Bob pulls and amends Alice's fix.
   149   $ cd ../bob
   173   $ cd ../bob
   150   $ hg pull -q -u ../alice
   174   $ hg pull -u ../alice
       
   175   pulling from ../alice
       
   176   searching for changes
       
   177   adding changesets
       
   178   adding manifests
       
   179   adding file changes
       
   180   added 1 changesets with 1 changes to 1 files
       
   181   pull obsolescence markers
       
   182   0 obsolescence markers added
       
   183   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   151   $ echo 'Fix.' > file2
   184   $ echo 'Fix.' > file2
   152   $ hg amend -q -A -u bob -m 'fix bug 15 (amended)'
   185   $ hg amend -A -u bob -m 'fix bug 15 (amended)'
   153 
   186 
   154 Figure SG06: Bob's repository after amending Alice's fix.
   187 Figure SG06: Bob's repository after amending Alice's fix.
   155 (Nothing new here; we could have seen this in the user guide.
   188 (Nothing new here; we could have seen this in the user guide.
   156   $ hg --hidden shortlog -G
   189   $ hg --hidden shortlog -G
   157   @  4:fe884dfac355  draft  fix bug 15 (amended)
   190   @  4:fe884dfac355  draft  fix bug 15 (amended)
   165   o  0:0dc9c9f6ab91  public  create new project
   198   o  0:0dc9c9f6ab91  public  create new project
   166   
   199   
   167 
   200 
   168 But in the meantime, Alice decides the fix is just fine and publishes it.
   201 But in the meantime, Alice decides the fix is just fine and publishes it.
   169   $ cd ../alice
   202   $ cd ../alice
   170   $ hg push -q
   203   $ hg push
       
   204   pushing to $TESTTMP/public
       
   205   searching for changes
       
   206   adding changesets
       
   207   adding manifests
       
   208   adding file changes
       
   209   added 1 changesets with 1 changes to 1 files
       
   210   pushing 4 obsolescence markers (369 bytes)
       
   211   0 obsolescence markers added
   171 
   212 
   172 Which means that Bob now has an formerly obsolete changeset that is
   213 Which means that Bob now has an formerly obsolete changeset that is
   173 also public (2:6e83). As soon as he pulls its phase change, he's got
   214 also public (2:6e83). As soon as he pulls its phase change, he's got
   174 trouble: the successors of that formerly obsolete changeset are
   215 trouble: the successors of that formerly obsolete changeset are
   175 bumped.
   216 bumped.
   232   $ echo 'pretty good fix' >> file1
   273   $ echo 'pretty good fix' >> file1
   233   $ hg commit -u bob -m 'fix bug 24 (v1)'
   274   $ hg commit -u bob -m 'fix bug 24 (v1)'
   234 
   275 
   235 Alice pulls Bob's fix and improves it.
   276 Alice pulls Bob's fix and improves it.
   236   $ cd ../alice
   277   $ cd ../alice
   237   $ hg pull -q -u ../bob
   278   $ hg pull -u ../bob
       
   279   pulling from ../bob
       
   280   searching for changes
       
   281   adding changesets
       
   282   adding manifests
       
   283   adding file changes
       
   284   added 1 changesets with 1 changes to 1 files
       
   285   pull obsolescence markers
       
   286   0 obsolescence markers added
       
   287   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   238   $ echo 'better (alice)' >> file1
   288   $ echo 'better (alice)' >> file1
   239   $ hg amend -u alice -m 'fix bug 24 (v2 by alice)'
   289   $ hg amend -u alice -m 'fix bug 24 (v2 by alice)'
   240 
   290 
   241 Likewise, Bob amends his own fix. Now we have an obsolete changeset
   291 Likewise, Bob amends his own fix. Now we have an obsolete changeset
   242 with two successors, although the successors are in different repos.
   292 with two successors, although the successors are in different repos.