lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Lucene-java Wiki] Update of "SvnMerge" by SteveRowe
Date Wed, 12 Jan 2011 05:57:47 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Lucene-java Wiki" for change notification.

The "SvnMerge" page has been changed by SteveRowe.
The comment on this change is: Reorganized with TOC and more sections; includes partial merge
instructions; properly contextualized svn:mergeinfo removal scenario.
http://wiki.apache.org/lucene-java/SvnMerge?action=diff&rev1=3&rev2=4

--------------------------------------------------

- = SVN Merge =
+ = Subversion Merge =
  
+ ||<#e8e8ff><<TableOfContents>>||
+ 
+ == Why merge? ==
+ 
+ Unlike a more simplistic approach of committing the same patch to both the trunk and the
branch, using `svn merge` helps preserve file history information (like renaming files, or
adding new files).
+ 
+ == svn:mergeinfo ==
+ 
+ Subversion tracks merges using a property called `svn:mergeinfo`.
+ 
+ __The problem__: On `branch_3x/`, paths that were merged from `trunk/` ''below the top level
directory'' began to accumulate revisions for every single commit that was the result of a
merge, even when the commits did not include any direct changes to these paths.  This is because
a path with an `svn:mergeinfo` value that differs from its parent's has to keep its own private
copy of ''everything'', including a full copy of its parent's merge information.  As a result,
every time any of such a path's ancestors is a merge target, the private `svn:mergeinfo` value
has to be updated and included in the `branch_3x/` commit.
+ 
+ __The fix__: '''Always run `svn merge` from the top level directory''' (i.e. the directory
containing `solr/` and `lucene/`).  There are two merge scenarios: a) fully merging all changes
from a `trunk/` commit into `branch_3x`; and b) performing a partial merge, where only some
of the changes from the `trunk/` commit will be merged into `branch_3x`.
+ 
+ == Full Merge ==
+ 
- To backport a change you have committed on `trunk/` to `branch_3x/`, go to the top level
directory in your `branch_3x/` working copy, and issue this command:
+ To merge '''all''' of the changes from a `trunk/` commit into `branch_3x/`, go to the top
level directory in your `branch_3x/` working copy, and issue this command:
  {{{
  svn merge -c XXXXXX https://svn.apache.org/repos/asf/lucene/dev/trunk
  }}}
  where {{{XXXXXX}}} is the revision of the source `trunk/` commit.
  
- == Conflicts ==
+ == Partial Merge ==
  
- If your `trunk\` commit contained changes to files and/or directories that are not in exactly
the same place on both `trunk\` and `branch_3x` (i.e. renames, moves, deletions, or additions),
Subversion will report a merge conflict.  You can fix this by running the same merge command
given above at each point in the tree that differs, and then telling Subversion that you have
resolved the conflict:
+ To merge a subset of changes from a `trunk/` commit into `branch_3x/`, go to the highest
level directory possible containing the changes you want to include, but not containing any
changes you want to exclude, and run ` svn merge -c XXXXXX ` with the corresponding repository
URL.  Repeat until you have merged all of the desired changes.
+ 
+ Finally, go to the top level directory and issue the following command:
+ {{{
+ svn merge --record-only -c XXXXXX https://svn.apache.org/repos/asf/lucene/dev/trunk
+ }}}
+ 
+ The `--record-only` parameter instructs Subversion to skip performing any actual merging,
but to instead modify the `svn:mergeinfo` property values to include the `XXXXXX` revision.
 Crucially, in addition to modifying the `svn:mergeinfo` property value for the top level
directory itself, all paths' `svn:mergeinfo` property values are also adjusted, so that merged
paths with the same merge information as their parents don't carry their own private `svn:mergeinfo`
copies.
+ 
+ == Merge Conflicts ==
+ 
+ If your `trunk/` commit contained changes to paths that are not in exactly the same place
on both `trunk/` and `branch_3x/` (e.g. moved paths), Subversion will report a merge conflict.
+ 
+ Once you have merged the desired changes from the `trunk/` commit -- see the instructions
at [[#Partial Merge|Partial Merge]] -- tell Subversion that you have resolved the conflict(s):
  {{{
  svn resolve --accept=working  your/conflicted/path
  }}}
  
+ == Handling Moved Paths ==
- == svn:mergeinfo ==
- 
- Subversion tracks merges using a property called `svn:mergeinfo`.  Detailed info on the
implementation here: http://www.collab.net/community/subversion/articles/merge-info.html
- 
- In the Lucene/Solr source tree, as a result of Subversion's `svn:mergeinfo` implementation,
paths that were conflicted and had to be merged below the top level directory began to accumulate
revisions for every single merged commit, even though the commit did not directly change these
paths.  This is because a path with a `svn:mergeinfo` value that differs from its parent has
to keep its own private copy of '''everything''', including merged revisions that don't directly
affect it.
  
  The Subversion book [[http://svnbook.red-bean.com/nightly/en/svn-book.html#svn.branchmerge.advanced.finalword|says]]:
- || For long-lived release branches (as described in [[http://svnbook.red-bean.com/nightly/en/svn-book.html#svn.branchmerge.commonpatterns|the
section called "Common Branching Patterns"]]), perform merges only on the root of the branch,
not on subdirectories. ||
+  || For long-lived release branches (as described in [[http://svnbook.red-bean.com/en/1.5/svn-book.html#svn.branchmerge.commonpatterns|the
section called "Common Branching Patterns"]]), perform merges only on the root of the branch,
not on subdirectories. ||
  
- Robert Muir came up with a solution to the `svn:mergeinfo` property value accumulation problem:
after running all of the `svn merge` commands necessary to handle conflicted paths, remove
`svn:mergeinfo` property values on all paths, except for ` / ` and the top-level directories
(`solr/` and `lucene/` under `branch_3x/`).  ` svn stat ` indicates the paths with modified
properties with an '''{{{ M }}}''' in the second status column from the left.  For each of
these paths (except for ` / ` and the top-level directories), run the following command:
+ When one or more of the changed paths in the `trunk/` commit has been moved from its location
under `branch_3x/`, e.g. `modules/analysis/*` and `modules/benchmark`, it is necessary to
merge below the top level directory; follow the instructions under [[#Partial Commit|Partial
Commit]].
+ 
+ Without taking further action, though, each merged moved path will carry its own private
`svn:mergeinfo` copy of all its ancestors' merge information (see [[#svn:mergeinfo|the svn:mergeinfo
section]] for an explanation of why this is a problem).
+ 
+ For the specific case of merged moved paths, to avoid the `svn:mergeinfo` property value
accumulation problem on `branch_3x/`, we remove the `svn:mergeinfo` property from all paths
except for the top level directory and its immediate children `solr/` and `lucene/`.
+ 
+ `svn stat` indicates the paths with modified properties via an {{{ "M" }}} in the second
status column from the left.  For each of these paths (except for the top level directory,
`solr/`, and `lucene/`), run the following command:
  {{{
- svn propdel svn:mergeinfo  path/to/remove/mergeinfo/from
+ svn propdel svn:mergeinfo  remove/mergeinfo/from/this/path
  }}}
  
+ == References ==
+ 
+  * From the Subversion book:
+    1. The ` svn merge ` command: http://svnbook.red-bean.com/en/1.5/svn.ref.svn.c.merge.html
+    1. Basic Merging: http://svnbook.red-bean.com/en/1.5/svn.branchmerge.basicmerging.html
+    1. The final word on advanced merging: http://svnbook.red-bean.com/en/1.5/svn.branchmerge.advanced.html#svn.branchmerge.advanced.finalword
+  * The gory details of Subversion's ` svn:mergeinfo ` property handling: http://www.collab.net/community/subversion/articles/merge-info.html
+ 

Mime
View raw message