Changes between Version 54 and Version 55 of CommittersTipsAndTricks


Ignore:
Timestamp:
Nov 3, 2016, 1:38:36 AM (8 years ago)
Author:
raimue (Rainer Müller)
Comment:

Remove svn properties and svn user directories

Legend:

Unmodified
Added
Removed
Modified
  • CommittersTipsAndTricks

    v54 v55  
    44
    55[[PageOutline(2,Contents,inline)]]
    6 
    7 == Set svn properties automatically on new Portfiles ==
    8 
    9 '''Note:''' If you are using Subversion >= 1.8 as client, you no longer need to make these settings manually as they are inherited from the properties set on the repository root.
    10 
    11 In the configuration for your Subversion client, enable automatic property setting and, for all files named Portfile, setting "svn:eol-style" to "native" and "svn:keywords" to "Id".  If you are not using Subversion's own svn command-line client, see its documentation.  For svn, you can make the appropriate changes by editing `~/.subversion/config` as follows:
    12 
    13 {{{
    14 #!ini
    15 ...
    16 
    17 [miscellany]
    18 enable-auto-props = yes
    19 
    20 ...
    21 
    22 [auto-props]
    23 Portfile = svn:eol-style=native;svn:keywords=Id
    24 }}}
    25 
    26 
    27 == Create an experimental users directory in the MacPorts Subversion repository ==
    28 
    29 Use the [/browser Trac Browser] to explore the MacPorts Subversion repository. The repository root is located at `https://svn.macports.org/repository/macports`.
    30 
    31 See also the explanation of [http://guide.macports.org/#development.local-repositories local development port trees] in the guide.
    32 
    33 To create a sandbox for experimental development, create a users directory:
    34 
    35 {{{
    36 svn mkdir https://svn.macports.org/repository/macports/users/<YourMacPortsUserName>
    37 }}}
    38 
    39 Then, checkout the user directory (suggested location is ~/myports):
    40 
    41 {{{
    42 $ svn co https://svn.macports.org/repository/macports/users/<YourMacPortsUserName> ~/myports
    43 }}}
    44 
    45 Then edit the MacPorts sources.conf file {{{/opt/local/etc/macports/sources.conf}}} to add ~/myports to the list before the main rsync source at rsync.macports.org, e.g.:
    46 
    47 {{{
    48 file:///Users/<YourSystemUserName>/myports [nosync]
    49 }}}
    50 
    51 To work on a copy of a port from the MacPorts trunk, use `svn copy`.  For example, to test changes on the cableswig port, copy the repository trunk (at the HEAD revision) into the user branch:
    52 
    53 {{{
    54 $ svn mkdir ~/myports/devel
    55 $ svn copy https://svn.macports.org/repository/macports/trunk/dports/devel/cableswig ~/myports/devel/
    56 }}}
    57 
    58 Another option for a large branch is to copy everything at the server side, where the copy is equivalent to a unix hard link in the file system; e.g.:
    59 {{{
    60 $ svn mkdir https://svn.macports.org/repository/macports/users/<YourMacPortsUserName>/devel
    61 $ svn copy \
    62       https://svn.macports.org/repository/macports/trunk/dports/devel/cableswig \
    63       https://svn.macports.org/repository/macports/users/<YourMacPortsUserName>/devel/cableswig \
    64       -m "experimental modifications to cableswig"
    65 $ cd ~/myports
    66 $ svn update
    67 }}}
    68 
    69 After the copy, run `portindex` in `~/myports` (do this anytime ports are added or removed from ~/myports), e.g.:
    70 
    71 {{{
    72 $ cd ~/myports
    73 $ svn update
    74 $ portindex
    75 $ port file cableswig
    76 }}}
    77 
    78 Now make experimental changes to the port in the sandbox.  Whenever a signficant change is made, note the change with a commit to the sandbox and when all the changes are complete commit the final change to the sandbox with a meaningful commit message.
    79 
    80 The main trunk Portfile and the sandbox Portfile are now out of sync.  Someone may make changes to the main trunk Portfile while changes are made to the sandbox Portfile.  Let's assume that all the experimental changes are successful, so the Portfile needs to be integrated back into the main trunk, where other changes may have occurred.  This merge process requires a few steps.  Let's assume there are checkouts for the sandbox in ~/myports and the trunk in ~/macports.
    81 
    82 First update the sandbox and the trunk checkouts, e.g.:
    83 
    84 {{{
    85 cd ~/myports
    86 svn update
    87 cd ~/macports
    88 svn update
    89 }}}
    90 
    91 Note that the revision numbers should be the same (because the sandbox and the main trunk belong to the same svn repository).
    92 
    93 Next, find out where the experimental changes left off from the trunk and create a bash variable (any shell variable) to store the value of the revision number where the branch copy occurred (the revision number will be the last one in the log):
    94 
    95 {{{
    96 cd ~/myports/devel/cableswig
    97 svn log --stop-on-copy Portfile
    98 EXP_BRANCH_REV=54362
    99 }}}
    100 
    101 For the curious, leave off the `--stop-on-copy` to see the entire commit log history (it should all be there if there is a continuous and reliable use of svn to manage the file from it's "birth" in the svn repository).
    102 
    103 Now take a look at the commit log for the main trunk, to get some hints about what has changed to the file since the experimental branch was forked off.
    104 
    105 {{{
    106 cd ~/macports/dports/devel/cableswig
    107 svn log Portfile | more
    108 }}}
    109 
    110 Look through the log to find the revision number where the experimental copy took place.  If that is the first revision number in the log, there have been no changes in the trunk.  Otherwise, changes have occurred in the trunk that are not in the experimental branch.  There could be trunk changes that complement the experimental branch, or they may be in conflict.  Try to merge all these changes using the revision number of the experimental copy:
    111 
    112 {{{
    113 cd ~/macports/dports/devel/cableswig
    114 svn merge  -r ${EXP_BRANCH_REV}:HEAD  https://svn.macports.org/repository/macports/users/<YourMacPortsUserName>/devel/cableswig/Portfile Portfile
    115 }}}
    116 
    117 Now resolve any conflicts, if any, in the trunk Portfile.  All work continues in the trunk (until the next time a sandbox is required).  Once the merge looks good, commit all the changes to the trunk with a meaningful commit message,
    118 
    119 {{{
    120 cd ~/macports/dports/devel/cableswig
    121 svn commit "merged sandbox changes from ${EXP_BRANCH_REV}:HEAD back into trunk" Portfile
    122 }}}
    123 
    124 Finally, to have the port system revert to using the rsync distribution, it's possible to remove the sandbox port.  No information is lost from the svn system, so removing the sandbox port is really harmless (in any case, all the changes are now back in the trunk).  For example,
    125 
    126 {{{
    127 sudo port clean --all cableswig
    128 cd ~/myports/devel
    129 svn remove cableswig
    130 svn commit -m "done with sandbox for cableswig"
    131 svn update
    132 cd ~/myports
    133 portindex
    134 }}}
    135 
    136 
    137 For more information about branches and merging, see
    138 http://svnbook.red-bean.com/en/1.7/svn.branchmerge.html
    139 
    1406
    1417== Apply patches directly from Trac URL ==