[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: gEDA-user: PCB GIT: tracking inter-file moves



On Mon, 2009-11-16 at 09:23 +0000, Ineiev wrote:
> Rebasing some of PCB branches (among them,
> the patchset about layer colours, recently suggested
> by Stefan Salewski) against master,
> I've noticed that some functions moved yesterday
> from src/hid/gtk/gtkhid-main.c to src/hid/gtkhid-gdk.c,
> and learnt that GIT does not track the changes
> when the content is moved between files (not by default).
> 
> Is there any means to automate such tracking?

Ah.. sorry - I didn't mean to break your patches!

This is what I would do - and how I re-shuffled my own patches to cope
with these changes. (One of what I assume will be many re-factoring
changes designed to eventually allow the OpenGL stuff as a build-time
option)...

First, make another branch ("stg branch --clone new-branch-name" if you
are using stgit, otherwise just "git branch new-branch-name".


I use "stgit", which allows me to push and pop patches. You can "stg
init" and "stg uncommit" from a branch which is not already an stgit
branch.

Pop all the patches

Create a reversed diff of the offending changes - limited in scope to
the file which had contents removed. IE. src/hid/gtkhid-main.c

Apply the patch (NB: This will break the build).

Push patches one by one - watching the "git diff HEAD^
src/hid/gtkhid-main.c" to see if it touched the relevant pieces of code.

If not, I "stg float temp-revert-gtkhid-main-changes" (Assuming that is
what my revert patch got called.

If it _did_ touch code that is moved, I do "git diff HEAD^
src/hid/gtkhid-main.c > tmp.diff" and "cp tmp.diff tmp2.diff"

I then cut out of those diff files - everything which doesn't relate to
the moved code. In the second, I fiddle "gtkhid-main.c" to
"gtkhid-gdk.c"

I apply the patches "patch -p1 -R < tmp.diff" to remove the changes from
gtkhid-main.c, and "patch -p1 < tmp.diff" to add the changes to
gtkhid-gdk.c. (Might want to use --dry-run to check the patch works
first).

Once this is done, "stg refresh" the patch and check the diff again with
"git diff HEAD^". It shouldn't touch the code which was removed.

Finally, "stg float temp-revert-gtkhid-main-changes". If that goes
smoothly, the patch was successfully altered.

Keep repeating this for all the patches in the stack then "stg delete
temp-revert-gtkhid-main-changes"


Since I caused it.. if you have difficulties, remind me where to fetch
your branch from (as it was), and I'll have a go at fixing it tonight or
tomorrow some time.

Best wishes,

Peter C.




_______________________________________________
geda-user mailing list
geda-user@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user