On Sun, Feb 20, 2011 at 2:18 AM, Vitor Antunes <vitor.hda@xxxxxxxxx> wrote: > Only open files for edit after integrating if the SHA1 of source and destination > differ from each other. > Add git config option detectRenames to allow permanent rename detection. This > options should be set to a true/false value. > Rename "detectRename" variable to "detectRenames" to make it more coherent with > the description in git man pages, which always use plural. > > Signed-off-by: Vitor Antunes <vitor.hda@xxxxxxxxx> > Acked-by: Pete Wyckoff <pw@xxxxxxxx> Acked-by: Tor Arvid Lund <torarvid@xxxxxxxxx> > --- > Âcontrib/fast-import/git-p4 | Â 19 +++++++++++++++---- > Â1 files changed, 15 insertions(+), 4 deletions(-) > > diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4 > index a92beb6..b0da28a 100755 > --- a/contrib/fast-import/git-p4 > +++ b/contrib/fast-import/git-p4 > @@ -543,13 +543,13 @@ class P4Submit(Command): > Â Â Â Â self.options = [ > Â Â Â Â Â Â Â Â optparse.make_option("--verbose", dest="verbose", action="store_true"), > Â Â Â Â Â Â Â Â optparse.make_option("--origin", dest="origin"), > - Â Â Â Â Â Â Â Âoptparse.make_option("-M", dest="detectRename", action="store_true"), > + Â Â Â Â Â Â Â Âoptparse.make_option("-M", dest="detectRenames", action="store_true"), > Â Â Â Â ] > Â Â Â Â self.description = "Submit changes from git to the perforce depot." > Â Â Â Â self.usage += " [name of git branch to submit into perforce depot]" > Â Â Â Â self.interactive = True > Â Â Â Â self.origin = "" > - Â Â Â Âself.detectRename = False > + Â Â Â Âself.detectRenames = False > Â Â Â Â self.verbose = False > Â Â Â Â self.isWindows = (platform.system() == "Windows") > > @@ -613,7 +613,16 @@ class P4Submit(Command): > > Â Â def applyCommit(self, id): > Â Â Â Â print "Applying %s" % (read_pipe("git log --max-count=1 --pretty=oneline %s" % id)) > - Â Â Â ÂdiffOpts = ("", "-M")[self.detectRename] > + > + Â Â Â Âif not self.detectRenames: > + Â Â Â Â Â Â# If not explicitly set check the config variable > + Â Â Â Â Â Âself.detectRenames = gitConfig("git-p4.detectRenames").lower() == "true" > + > + Â Â Â Âif self.detectRenames: > + Â Â Â Â Â ÂdiffOpts = "-M" > + Â Â Â Âelse: > + Â Â Â Â Â ÂdiffOpts = "" > + > Â Â Â Â diff = read_pipe_lines("git diff-tree -r %s \"%s^\" \"%s\"" % (diffOpts, id, id)) > Â Â Â Â filesToAdd = set() > Â Â Â Â filesToDelete = set() > @@ -640,8 +649,10 @@ class P4Submit(Command): > Â Â Â Â Â Â elif modifier == "R": > Â Â Â Â Â Â Â Â src, dest = diff['src'], diff['dst'] > Â Â Â Â Â Â Â Â p4_system("integrate -Dt \"%s\" \"%s\"" % (src, dest)) > - Â Â Â Â Â Â Â Âp4_system("edit \"%s\"" % (dest)) > + Â Â Â Â Â Â Â Âif diff['src_sha1'] != diff['dst_sha1']: > + Â Â Â Â Â Â Â Â Â Âp4_system("edit \"%s\"" % (dest)) > Â Â Â Â Â Â Â Â if isModeExecChanged(diff['src_mode'], diff['dst_mode']): > + Â Â Â Â Â Â Â Â Â Âp4_system("edit \"%s\"" % (dest)) > Â Â Â Â Â Â Â Â Â Â filesToChangeExecBit[dest] = diff['dst_mode'] > Â Â Â Â Â Â Â Â os.unlink(dest) > Â Â Â Â Â Â Â Â editedFiles.add(dest) > -- > 1.7.4.1 > > -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html