docs/evolve-collaboration.rst
changeset 167 64c886d26aab
child 181 35baa2a80073
equal deleted inserted replaced
166:8f8a52cd0b9f 167:64c886d26aab
       
     1 
       
     2 ------------------------------------------------
       
     3 Collaboration Using Evolve: A user story
       
     4 ------------------------------------------------
       
     5 
       
     6 
       
     7 After having written some code for ticket #42, M W. start a patch (this
       
     8 will be kind of like a 'work-in-progress' checkpoint initially)::
       
     9 
       
    10     $ ci -m '[entities] remove magic'
       
    11 
       
    12 Instant patch ! Note how the default phase of this changeset is (still)
       
    13 in "draft" state.
       
    14 
       
    15 This is easily checkable::
       
    16 
       
    17     $ hg phase tip
       
    18     827: draft
       
    19 
       
    20 See ? Until the day it becomes a "public" changeset, this can be altered
       
    21 to no end. How ? It happens with an explicit::
       
    22 
       
    23     $ hg phase -p
       
    24 
       
    25 In practice, pushing to a "publishing" repository can also turn draft
       
    26 changesets into public ones. Older mercurial releases are automatically
       
    27 "publishing" since they do not have the notion of non-public changesets
       
    28 (or mutable history).
       
    29 
       
    30 In the transition ... phase from older mercurial servers, this will
       
    31 happen often, so be careful.
       
    32 
       
    33 Now let's come back to our patch. Next hour sees good progress and W.
       
    34 wants to complete the patch with the recent stuff (all that's shown by
       
    35 an "hg diff") to share with a co-worker (let's call him C.W.)::
       
    36 
       
    37     $ hg amend -m '[entities] fix frobulator (closes #42)'
       
    38 
       
    39 Note that we also fix the commit message. (For recovering mq users: this
       
    40 is just like "hg qrefresh -m").
       
    41 
       
    42 Before leaving, let's push to the central shared repository. That will
       
    43 give C.W. the signal that something is ripe for review / further amendments::
       
    44 
       
    45     $ hg push # was done with a modern mercurial, draft phase is preserved
       
    46 
       
    47 The next day, Mr C.W, which arrives very very early, can immediately
       
    48 work out some glitches in the patch.
       
    49 
       
    50 He then starts another one, for ticket #43 and finally commits it.
       
    51 Then, as original worker arrives, he pushes his stuff.
       
    52 
       
    53 M W., now equipped with enough properly sugared coffee to survive the
       
    54 next two hours::
       
    55 
       
    56     $ hg pull
       
    57 
       
    58 Then::
       
    59 
       
    60     $ hg up "tip ~ 1"
       
    61 
       
    62 brings him to yesterday's patch. Indeed the patch serial number has
       
    63 increased (827 still exists but has been obsoleted).
       
    64 
       
    65 He understands that his original patch has been altered. But how did it
       
    66 evolve ?
       
    67 
       
    68 The enhanced hgview shows the two patches. By default only the most
       
    69 recent version of a patch is shown.
       
    70 
       
    71 Now, when W. installed the mutable-history extensions, he got an alias
       
    72 that allows him to see the diff between two amendments, defined like this::
       
    73 
       
    74     odiff=diff --rev 'limit(obsparents(.),1)' --rev .
       
    75 
       
    76 He can see exactly how C.W. amended his work.
       
    77 
       
    78 * odiff
       
    79 
       
    80 
       
    81