Patch Updater

From DSpace Wiki

Jump to: navigation, search

This is a simple Python script that takes a patch intended for DSpace <=1.4.x, and updates it so it can be applied to DSpace post-code reorganisation.

If --multi is specified, the input patch is rewritten as several individual patches that can be applied to individual add-ons from within Eclipse.

e.g.:

update-patch.py my_old_patch --output=my_new_patch

might result in:

my_new_patch-dspace
my_new_patch-dspace-api
my_new_patch-dspace-jspui

Otherwise, the updated patch file should be applied to the parent of the add-ons (i.e. the directory containing dspace, dspace-api, dspace-jspui, etc.)

Use --trim parameter to specify the number of path segments in the original patch file to trim from the start of file locations. e.g. if your patch file patched dspace-1.4.2-source/bin/xxx you would specify --trim=1 to trim the dspace-1.4.2-source.

Note: Only works with unified format diffs

Download it here: Media:Update-patch.py

Usage: update-patch.py [options] patchfile

options:
  -h, --help            show this help message and exit
  -m, --multi           write multiple patch files (one per addon)
  -t TRIM, --trim=TRIM  number of path components to trim from input patch
  -o OUTPUT, --output=OUTPUT
                        output filename (or prefix for --multi)
Personal tools