Changes between Initial Version and Version 1 of NewLibByRefactor


Ignore:
Timestamp:
Jan 4, 2014, 2:10:58 PM (9 years ago)
Author:
Beman Dawes
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • NewLibByRefactor

    v1 v1  
     1= Creating a new library by refactoring existing Boost repositories =
     2[[PageOutline]]
     3
     4This page documents the procedure Peter Dimov used to refactor Boost's assert facilities out of Boost.Utility into a separate Boost.Assert library. This was done to reduce dependencies.
     5
     6Thanks to Peter for supplying this procedure!
     7
     8== Procedure ==
     9
     10Since I already have created the new submodule from the existing components, I may as well document the procedure I used here...
     11
     12The usual way to extract a portion of a Git repository, along with its history, is by using "git filter-branch". filter-branch, however, is reasonably easy to apply if what one needs to extract is contained in a subdirectory, which was not the case with Assert, where one needs to extract individual files. So I used "git log" instead to prepare a patch, as suggested in
     13
     14[http://stackoverflow.com/questions/1365541/how-to-move-files-from-one-git-repo-to-another-not-a-clone-preserving-history?rq=1 How to move files from one git repo to another (not a clone), preserving history] on stackoverflow.
     15
     16Specifically - and step by step - what I did in the original repository (libs/utility) was:
     17
     18{{{
     19git checkout master
     20git log --pretty=email --patch-with-stat --reverse -- assert.html assert_test.cpp current_function.html current_function_test.cpp verify_test.cpp include/boost/assert.hpp include/boost/current_function.hpp > assert_master_patch.txt
     21
     22git checkout develop
     23git log --pretty=email --patch-with-stat --reverse -- assert.html assert_test.cpp current_function.html current_function_test.cpp verify_test.cpp include/boost/assert.hpp include/boost/current_function.hpp > assert_develop_patch.txt
     24}}}
     25
     26Then, in the new (empty) repository:
     27
     28{{{
     29git checkout master
     30git am < ../utility/assert_master_patch.txt
     31
     32git checkout develop
     33git am < ../utility/assert_develop_patch.txt
     34
     35git checkout master
     36git merge --no-ff develop
     37
     38git checkout develop
     39git merge --no-ff master
     40}}}
     41
     42(For the merges, I take advantage of the fact that the files are identical in {{{master}}} and {{{develop}}} because I've ensured so while preparing the initial Boost.Utility merge point. For a repository in which {{{master}}} and {{{develop}}} have diverged and need to stay diverged in the new repository, the final two merges may need to be replaced by something else.)
     43
     44I then added test/Jamfile.v2 as a new file, as I decided that most of the history of the original Boost.Utility would not be relevant. (I could, alternatively, have imported it along with the other files and then deleted the references to everything but Assert as required.)
     45
     46(I prepared the initial empty repository by creating one via Github, cloning it, removing the README.md file, git push-ing the changes, then creating a "develop" branch via Github. There are other ways to do it. This one seemed easiest.)