[Insight-developers] Patching a patch : Multithreader / Tread ID Type
Luis Ibanez
luis.ibanez at kitware.com
Sun May 29 07:23:50 EDT 2011
Hi David,
Here is how your patch:
http://review.source.kitware.com/#change,1649
has been modified in order to replace "unsigned int"
with the typedefed "ThreadIdType".
----------------------------------------------------------------------
1) Recover your patch from Gerrit:
git fetch ssh://ibanez@review.source.kitware.com:29418/ITK
refs/changes/49/1649/2 && git checkout FETCH_HEAD -b Threads
2) Generate a patch file with respect to the previous commit:
git format-patch -1
This resulted in the file:
0001-ENH-Changed-number-of-threads-to-unsigned-int-throug.patch
3) Then we edit that file with sed:
sed 's/^+.*unsigned int/&ThreadIdType/g'
0001-ENH-Changed-number-of-threads-to-unsigned-int-throug.patch >
0001-ENH-Changed-number-of-threads-to-unsigned-int-throug2.patch
sed 's/unsigned intThreadIdType/ThreadIdType/g'
0001-ENH-Changed-number-of-threads-to-unsigned-int-throug2.patch >
0001-ENH-Changed-number-of-threads-to-unsigned-int-throug3.patch
4) Then go back to the previous commit
git checkout HEAD^
5) create a branch out of it:
git checkout -b Threads2
6) check the patch for potential issues:
git apply --check
0001-ENH-Changed-number-of-threads-to-unsigned-int-throug3.patch
7) then apply the patch:
git am < 0001-ENH-Changed-number-of-threads-to-unsigned-int-throug3.patch
8) Then modify the int types file:
gvim Modules/Core/Common/include/itkIntTypes.h
add the lines
@@ -153,6 +153,9 @@ typedef signed long OffsetValueType;
#endif
+/** Type to count and reference number of threads */
+typedef unsigned int ThreadIdType;
+
}
9) Start compiling....
Discover that now the itkMultiTheader.h file must include
the itkIntTypes.h.
index 34788ad..2be8251 100644
--- a/Modules/Core/Common/include/itkMultiThreader.h
+++ b/Modules/Core/Common/include/itkMultiThreader.h
@@ -30,6 +30,7 @@
#include "itkMutexLock.h"
#include "itkThreadSupport.h"
+#include "itkIntTypes.h"
namespace itk
{
10) Continue compiling...
11) added a couple more modifications (FFTW file...)
12) Send the modified patch back to Gerrit:
So, now we have Patch #3 in:
http://review.source.kitware.com/#change,1649
-------------------------
The patch is now missing the XML file that describes
the API change.
You can generate this file by running:
cd ~/src/ITK
./Documentation/Migration/InitializeXMLGuide.py
then enter a unique filename such as
ChangeMultiThreaderAPI-ThreadIdType.xml
The file will be put the directory:
./Documentation/Migration/
and then you can "git add" it and make it
part of the patch at the moment of doing
"git merge".
Thanks
Luis
More information about the Insight-developers
mailing list