How to apply a patch to Trac

33 views
Skip to first unread message

Jared Bownds

unread,
Aug 8, 2014, 2:27:34 PM8/8/14
to trac-...@googlegroups.com, jared. bownds
URL:  http://trac.edgewall.org/ticket/7339#comment:79

What are the practical steps necessary to apply a patch?  Example patch can be found in the URL above.

Jared Bownds

unread,
Aug 8, 2014, 2:36:47 PM8/8/14
to trac-...@googlegroups.com, jared....@bayer.com
For example, would these be an expected output?

(jared)-(11:33:30)-(/usr/lib/python2.6/site-packages/Trac-1.0-py2.6.egg/trac)

-> patch -p1 < Trac-show_full_names-sorted-r4-0.12.2.patch
patching file test.py
Hunk #1 FAILED at 283.
1 out of 1 hunk FAILED -- saving rejects to file test.py.rej
patching file ticket/default_workflow.py
Hunk #1 succeeded at 226 (offset 12 lines).
Hunk #2 succeeded at 277 (offset 12 lines).
patching file ticket/templates/query.html
Hunk #1 FAILED at 83.
1 out of 1 hunk FAILED -- saving rejects to file ticket/templates/query.html.rej
patching file ticket/templates/ticket.html
Hunk #1 succeeded at 260 (offset -22 lines).
patching file ticket/web_ui.py
Hunk #1 succeeded at 18 (offset 2 lines).
Hunk #2 FAILED at 48.
Hunk #3 FAILED at 441.
Hunk #4 succeeded at 1249 (offset 98 lines).
Hunk #5 succeeded at 1567 (offset 114 lines).
Hunk #6 FAILED at 1551.
Hunk #7 succeeded at 1714 (offset 122 lines).
Hunk #8 FAILED at 1617.
Hunk #9 succeeded at 1758 with fuzz 1 (offset 121 lines).
4 out of 9 hunks FAILED -- saving rejects to file ticket/web_ui.py.rej
patching file web/chrome.py
Hunk #1 succeeded at 43 (offset 10 lines).
Hunk #2 succeeded at 451 (offset 121 lines).
Hunk #3 succeeded at 1045 (offset 133 lines).
Hunk #4 succeeded at 1058 (offset 133 lines).
Hunk #5 succeeded at 1077 (offset 133 lines).
patching file web/session.py
Hunk #1 succeeded at 31 (offset 3 lines).
Hunk #2 succeeded at 143 with fuzz 1 (offset 7 lines).
Hunk #3 FAILED at 240.
Hunk #4 succeeded at 426 with fuzz 2.
Hunk #5 succeeded at 443 with fuzz 1 (offset -4 lines).
1 out of 5 hunks FAILED -- saving rejects to file web/session.py.rej

Steffen Hoffmann

unread,
Aug 9, 2014, 9:14:16 AM8/9/14
to trac-...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 08.08.2014 20:36, Jared Bownds wrote:
> For example, would these be an expected output?
>
> (jared)-(11:33:30)-(/usr/lib/python2.6/site-packages/Trac-1.0-py2.6.egg/trac)
>
> -> *patch -p1 < Trac-show_full_names-sorted-r4-0.12.2.patch*

Yes.

As you see at least some changes apply. Otherwise it could be just on
the wrong level, but obviously you adjusted it correctly with -p option.

Offset is a hint on code changes between the version the patch has been
created an the version you're trying to apply the patch. With only
offset it might, but is not guaranteed to work.

Anyway the presented case includes failing lines too, so you're required
to rework the changes collected in the corresponding *.rej files to fit
into the current version.

Depending on the intermediately introduced changes adjusting a patch is
anything between trivial and almost impossible. Recent commit messages
could help to reveal potentially complicated changes. No one could tell
without seeing the code in detail. And certainly it is no longer "just
patching" but will require some Python knowledge to do the work.

Steffen Hoffmann
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Icedove - http://www.enigmail.net/

iEYEARECAAYFAlPmHpgACgkQ31DJeiZFuHcB/QCeITZc6kpdzv6+SfVkhR3P8Poe
yFoAoKP+raVrTZPdotcXzuUMkyHSyHPe
=0vbt
-----END PGP SIGNATURE-----

Jared Bownds

unread,
Aug 9, 2014, 11:54:45 AM8/9/14
to trac-...@googlegroups.com
Well put, thanks Steffens.  You did a great job of dispelling the mystery of patching, and the potential subsequent steps involved.
--
You received this message because you are subscribed to a topic in the Google Groups "Trac Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/trac-users/vLI_nV6v7NU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to trac-users+...@googlegroups.com.
To post to this group, send email to trac-...@googlegroups.com.
Visit this group at http://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/d/optout.


--

Jared Bownds
m. 916.224.2324
e. Jared....@gmail.com
Reply all
Reply to author
Forward
0 new messages