[p4] How to handle refactoring ?

Tal Dayan tal at zapta.com
Sun Oct 21 19:45:33 PDT 2001


Thanks, I will give it a try. It would be nice if Perforce would support a
non overwriting
add+branch.

We may also need to do a 'revert' class1' before syncing it since it may
be open for editing.

For the long range, I hope is that IDEA will add support for Perforce (it
already supports VSS and CVS
and there are several Perforce users in the IDEA support list).

Tal

> -----Original Message-----
> From: jon at floorboard.com [mailto:jon at floorboard.com]
> Sent: Sunday, October 21, 2001 7:23 PM
> To: Tal Dayan
> Cc: perforce-user at perforce.com
> Subject: Re: [p4] How to handle refactoring ?
>
>
> Tal Dayan wrote:
> >
> > Hello,
> >
> > We are using IDEA as a Java IDE and as a refactoring tool
> > (www.refactoring.com)
> > and are not sure how to use Perforce for best results.
> >
> > Here is an example, we have a class /a/b/class1.java checked in
> Perforce.
> > Now we use the Refactoring tool to rename the class from 'class1' to
> > 'class2. IDEA
> > deletes class1.java, creates class2.java and changes the source code of
> > class2.java
> > to reflect the name change (e.g. it renames the constructors).
> >
> > At this point, the file class1.java is gone and the file class2.java
> > contains the
> > modified code.
> >
> > Now we want to check this change back into Perforce such that
> we don't loose
> > the history relation between class1 and class2 (that is, 'p4
> integrate').
> >
> > Any idea how to handle this ?
>
> Off the top of my head for UNIX:
>
> mv class2.java class2.java.save		# save the modified code
> p4 sync -f class1.java			# fetch back the old code
> p4 integrate class1.java class2.java	# integrate old file to new file
> p4 delete class1.java			# remove old file
> p4 edit class2.java			# reopen new file for edit
> mv class2.java.save class2.java		# restore modified code
> p4 submit				# submit to p4
>
> There might be something a bit simpler, and this is obvious fodder for a
> script, probably without the submit so you can do multiple changes like
> this.
>
> --
> Jon Biggar
> Floorboard Software
> jon at floorboard.com
> jon at biggar.org




More information about the perforce-user mailing list