What is the expected behavior for git-p4 submit, and how do I use this tool?

273 Views Asked by At

I am trying to migrate a Git repository into a subdirectory within a Perforce depot, where all history is maintained. I have been the only person working in this Git repository and haven't done anything non-trivial with the history.

After many hours of internet searches and trial and error, I think I've come close to getting this to work via the git-p4 tool.

When running the following command

git p4 submit -M -n

a list of every single commit description is printed (looks good!).

But when running the following command

git p4 submit -M

I see the following printed to the terminal

$ git p4 submit -M
... - file(s) up-to-date.
<stdin>:27: trailing whitespace.
# the diff markers are never inserted). Diff markers may cause the following
<stdin>:56: trailing whitespace.
#
<stdin>:58: trailing whitespace.
# is only available from the command line. Turn it on by uncommenting the
warning: 3 lines add whitespace errors.
<stdin>:27: trailing whitespace.
# the diff markers are never inserted). Diff markers may cause the following
<stdin>:56: trailing whitespace.
#
<stdin>:58: trailing whitespace.
# is only available from the command line. Turn it on by uncommenting the
warning: 3 lines add whitespace errors.
//p4depot/GitStuff/.gitattributes#1 - opened for add
//p4depot/GitStuff/.gitignore#1 - opened for add
//p4depot/GitStuff/.gitattributes#1 - nothing changed
//p4depot/GitStuff/.gitignore#1 - nothing changed

Shortly after, a temp text file is opened with the following content

# A Perforce Change Specification.
#
#  Change:      The change number. 'new' on a new changelist.
#  Date:        The date this specification was last modified.
#  Client:      The client on which the changelist was created.  Read-only.
#  User:        The user who created the changelist.
#  Status:      Either 'pending' or 'submitted'. Read-only.
#  Type:        Either 'public' or 'restricted'. Default is 'public'.
#  Description: Comments about the changelist.  Required.
#  Jobs:        What opened jobs are to be closed by this changelist.
#               You may delete jobs from this list.  (New changelists only.)
#  Files:       What opened files from the default changelist are to be added
#               to this changelist.  You may delete files from this list.
#               (New changelists only.)

Change: new

Client: aserio_p4

User:   aserio

Status: new

Description:
    admin

Files:
    //p4depot/GitStuff/.gitignore
    //p4depot/GitStuff/.gitattributes

######## git author [email protected] does not match your p4 account.
######## Use option --preserve-user to modify authorship.
######## Variable git-p4.skipUserNameCheck hides this message.
######## everything below this line is just the diff #######
...

At this point, I have .gitignore and .gitattributes added to my default change list, not a new one with the description set to 'admin'. The terminal is paused, but lets me input characters (though it doesn't seem to do anything other than print the characters I type).

Do I need to copy the description and manually submit each change list, or is it expected that p4-git would do this automatically? Is there something else I should do to unblock the tool at this point?

1

There are 1 best solutions below

1
On

This is not my proudest moment, but the solution appears to be: Close the temp text file.

For posterity: I am working in Windows, and have tried using git-p4 via the following:

  • Powershell
  • Git Bash
  • CMD
  • Git CMD (Deprecated)

I ran into issues with both Powershell and CMD. Git Bash appeared to be mostly working, but there seems to be a bug with it where it blocks before having printed any feedback.

Git CMD turned out to be the only working option. Unfortunately, it appears to be deprecated.

It's also worth noting that I am using Python 2.7.12.