[Documentation] [TitleIndex] [WordIndex

Patching

Use Case

Suppose we are working on ros_comm and want to port rosbag (currently a headache because of termios).

Creating a Patch

We need to create two directories, one containing a pristine version of ros_comm at trunk (we always work on trunk for patching). The second containing our modified version of ros_comm.

> svn co https://code.ros.org/svn/ros/stacks/ros_comm/trunk ./ros_comm
> cp -r C:\work\src\ros_comm ros_comm_rosbag

We then take a diff of the two directories to create a patch. Take special care not to include temporaries or version control directories.

> diff -NBaur -x ".svn" -x ".hg" -x ".git" -x "*.pyc" ros_comm ros_comm_rosbag > ros_comm_rosbag.patch

View your patch file with an editor to verify that your fixes are in and to also check that nothing else snuck in (e.g. version control directories).

Note that the above commands will work on windows (if you have msysgit installed) as well as linux.

Applying a Patch

For win_ros, this patch will get dropped into win_ros/win_patches/patches and automatically get applied via the build environment scripts or the apply_xxx_patches scripts in win_patches`.

If for some reason you want to apply your patch manually, then the simple set of instructions below should be a useful demo of how to do this:

> svn co https://code.ros.org/svn/ros/stacks/ros_comm/trunk ./ros_comm
> ls
ros_comm ros_comm_rosbag.patch
> patch -p0 < ros_comm_rosbag.patch

Note that the -p0 says to apply it exactly here (without truncating any leading directories).


2024-12-28 18:44