git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Romain Picard <romain.picard@oakbits.com>
To: Luke Diamand <luke@diamand.org>
Cc: Git Users <git@vger.kernel.org>,
	Lars Schneider <larsxschneider@gmail.com>,
	Eric Sunshine <sunshine@sunshineco.com>,
	git-owner@vger.kernel.org
Subject: Re: [PATCH] git-p4.py: add support for filetype change
Date: Tue, 29 Dec 2015 18:33:12 +0100	[thread overview]
Message-ID: <3d38fd830e58bef6cd50c41650268244@oakbits.com> (raw)
In-Reply-To: <CAE5ih7-3H=O8GqzGebzKTttwUs=HRA+B+pV85sfWoesAvKXKgg@mail.gmail.com>

Le 26.12.2015 11:26, Luke Diamand a écrit :
> On 21 December 2015 at 13:09, Romain Picard <romain.picard@oakbits.com> 
> wrote:
>> After changing the type of a file in the git repository, it is not 
>> possible to
>> "git p4 publish" the commit to perforce. This is due to the fact that 
>> the git
>> "T" status is not handled in git-p4.py. This can typically occur when 
>> replacing
>> an existing file with a symbolic link.
>> 
>> The "T" modifier is now supported in git-p4.py. When a file type has 
>> changed,
>> inform perforce with the "p4 edit -f auto" command.
> 
> Romain,
> 
> Thanks for looking at this. It looks like a reasonable change.
> 
> Do you think you could add a unit test as well?

Yes, I will look at the existing tests to see how to add some new ones.

> 
> Thanks
> Luke
> 
> 
>> 
>> Signed-off-by: Romain Picard <romain.picard@oakbits.com>
>> ---
>>  git-p4.py | 9 +++++++--
>>  1 file changed, 7 insertions(+), 2 deletions(-)
>> 
>> diff --git a/git-p4.py b/git-p4.py
>> index a7ec118..b7a3494 100755
>> --- a/git-p4.py
>> +++ b/git-p4.py
>> @@ -240,8 +240,8 @@ def p4_add(f):
>>  def p4_delete(f):
>>      p4_system(["delete", wildcard_encode(f)])
>> 
>> -def p4_edit(f):
>> -    p4_system(["edit", wildcard_encode(f)])
>> +def p4_edit(f, *options):
>> +    p4_system(["edit"] + list(options) + [wildcard_encode(f)])
>> 
>>  def p4_revert(f):
>>      p4_system(["revert", wildcard_encode(f)])
>> @@ -1344,6 +1344,7 @@ class P4Submit(Command, P4UserMap):
>> 
>>          diff = read_pipe_lines("git diff-tree -r %s \"%s^\" \"%s\"" % 
>> (self.diffOpts, id, id))
>>          filesToAdd = set()
>> +        filesToChangeType = set()
>>          filesToDelete = set()
>>          editedFiles = set()
>>          pureRenameCopy = set()
>> @@ -1404,6 +1405,8 @@ class P4Submit(Command, P4UserMap):
>>                      os.unlink(dest)
>>                      filesToDelete.add(src)
>>                  editedFiles.add(dest)
>> +            elif modifier == "T":
>> +                filesToChangeType.add(path)
>>              else:
>>                  die("unknown modifier %s for %s" % (modifier, path))
>> 
>> @@ -1463,6 +1466,8 @@ class P4Submit(Command, P4UserMap):
>>          #
>>          system(applyPatchCmd)
>> 
>> +        for f in filesToChangeType:
>> +            p4_edit(f, "-t", "auto")
>>          for f in filesToAdd:
>>              p4_add(f)
>>          for f in filesToDelete:
>> --
>> 2.6.4
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

      reply	other threads:[~2015-12-29 20:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-21 13:09 [PATCH] git-p4.py: add support for filetype change Romain Picard
2015-12-26 10:26 ` Luke Diamand
2015-12-29 17:33   ` Romain Picard [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3d38fd830e58bef6cd50c41650268244@oakbits.com \
    --to=romain.picard@oakbits.com \
    --cc=git-owner@vger.kernel.org \
    --cc=git@vger.kernel.org \
    --cc=larsxschneider@gmail.com \
    --cc=luke@diamand.org \
    --cc=sunshine@sunshineco.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).