New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In git p4, git fast-import fails from die-now command and err (from Perforce) is not shown #1668
Conversation
Welcome to GitGitGadgetHi @alrashedf, and welcome to GitGitGadget, the GitHub App to send patch series to the Git mailing list from GitHub Pull Requests. Please make sure that your Pull Request has a good description, as it will be used as cover letter. You can CC potential reviewers by adding a footer to the PR description with the following syntax:
Also, it is a good idea to review the commit messages one last time, as the Git project expects them in a quite specific form:
It is in general a good idea to await the automated test ("Checks") in this Pull Request before contributing the patches, e.g. to avoid trivial issues such as unportable code. Contributing the patchesBefore you can contribute the patches, your GitHub username needs to be added to the list of permitted users. Any already-permitted user can do that, by adding a comment to your PR of the form Both the person who commented An alternative is the channel
Once on the list of permitted usernames, you can contribute the patches to the Git mailing list by adding a PR comment If you want to see what email(s) would be sent for a After you submit, GitGitGadget will respond with another comment that contains the link to the cover letter mail in the Git mailing list archive. Please make sure to monitor the discussion in that thread and to address comments and suggestions (while the comments and suggestions will be mirrored into the PR by GitGitGadget, you will still want to reply via mail). If you do not want to subscribe to the Git mailing list just to be able to respond to a mail, you can download the mbox from the Git mailing list archive (click the curl -g --user "<EMailAddress>:<Password>" \
--url "imaps://imap.gmail.com/INBOX" -T /path/to/raw.txt To iterate on your change, i.e. send a revised patch or patch series, you will first want to (force-)push to the same branch. You probably also want to modify your Pull Request description (or title). It is a good idea to summarize the revision by adding something like this to the cover letter (read: by editing the first comment on the PR, i.e. the PR description):
To send a new iteration, just add another PR comment with the contents: Need help?New contributors who want advice are encouraged to join [email protected], where volunteers who regularly contribute to Git are willing to answer newbie questions, give advice, or otherwise provide mentoring to interested contributors. You must join in order to post or view messages, but anyone can join. You may also be able to find help in real time in the developer IRC channel, |
There are issues in commit 4ae24ea: |
/allow |
@alrashedf please be inspired by https://github.blog/2022-06-30-write-better-commits-build-better-projects/ |
User alrashedf is now allowed to use GitGitGadget. |
I was inspired and rewrote the pull request message above. |
There are issues in commit 1665860: |
Excellent. Please amend the commit message now, that'll calm down GitGitGadget. |
There are issues in commit 064615e: |
There are issues in commit 23d3f8a: |
There are issues in commit fe69a4d: |
@dscho It's been a few months since the pull request has passed all tests. When will it be merged? |
@alrashedf as described in https://gitgitgadget.github.io/:
As per #1668 (comment), you can use this here PR to make such a contribution by calling the You will want to make sure that the initial comment, which is used as a "cover letter" between the commit message and the patch, does not repeat the commit message, but conveys any relevant context that the commit message cannot convey, e.g. motivating the inclusion of this patch by, say, stating that your work is blocked on the fixed bug. |
/submit |
Submitted as [email protected] To fetch this version into
To fetch this version to local tag
|
On the Git mailing list, Karthik Nayak wrote (reply to this): Hello Fahad,
"Fahad Alrashed via GitGitGadget" <[email protected]> writes:
> From: Fahad Alrashed <[email protected]>
>
> Bug fix: During "git p4 clone" if p4 process returns
Nit: I haven't seen us use a prefix for the commit message. Also we use
a max line length of 72 characters (see .editorconfig). The commit
message seems to be wrapped at a much lower threshold.
> an error from the server, it will store it in variable
perhaps `in the 'err' variable` or `in a variable 'err'`.
> "err". The it will send a text command "die-now" to
s/The/Then
> git-fast-import. However, git-fast-import raises an
> exception: "fatal: Unsupported command: die-now"
> and err is never displayed. This patch ensures that
> err is dispayed using "finally:"
>
> Signed-off-by: Fahad Alrashed <[email protected]>
> ---
> In git p4, git fast-import fails from die-now command and err (from
> Perforce) is not shown
>
> When importing from Perforce using git p4 clone <depot location>,
> cloning works fine until Perforce command p4 raises an error. This error
> message is stored in err variable then git-fast-import is sent a die-now
> command to kill it. An exception is raised fatal: Unsupported command:
> die-now.
>
> This patch forces python to call die() with the err message returned
> from Perforce.
>
> This commit fixes the root cause of a bug that took me hours to find.
> I'm sure many faced the cryptic error and declared that git-p4 is not
> working for them.
>
> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1668%2Falrashedf%2Fmaster-v1
> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1668/alrashedf/master-v1
> Pull-Request: https://github.com/git/git/pull/1668
>
> git-p4.py | 24 +++++++++++++-----------
> 1 file changed, 13 insertions(+), 11 deletions(-)
>
> diff --git a/git-p4.py b/git-p4.py
> index 28ab12c72b6..f1ab31d5403 100755
> --- a/git-p4.py
> +++ b/git-p4.py
> @@ -3253,17 +3253,19 @@ def streamP4FilesCb(self, marshalled):
> if self.stream_have_file_info:
> if "depotFile" in self.stream_file:
> f = self.stream_file["depotFile"]
> - # force a failure in fast-import, else an empty
> - # commit will be made
> - self.gitStream.write("\n")
> - self.gitStream.write("die-now\n")
> - self.gitStream.close()
> - # ignore errors, but make sure it exits first
> - self.importProcess.wait()
> - if f:
> - die("Error from p4 print for %s: %s" % (f, err))
> - else:
> - die("Error from p4 print: %s" % err)
> + try:
> + # force a failure in fast-import, else an empty
> + # commit will be made
> + self.gitStream.write("\n")
> + self.gitStream.write("die-now\n")
> + self.gitStream.close()
> + # ignore errors, but make sure it exits first
> + self.importProcess.wait()
> + finally:
> + if f:
> + die("Error from p4 print for %s: %s" % (f, err))
> + else:
> + die("Error from p4 print: %s" % err)
>
This part looks good.
> if 'depotFile' in marshalled and self.stream_have_file_info:
> # start of a new file - output the old one first
>
> base-commit: 235986be822c9f8689be2e9a0b7804d0b1b6d821
> --
> gitgitgadget
Thanks,
Karthik |
User |
35fff24
to
84d5121
Compare
I've corrected the commit message as pointed out by Karthik. /submit |
You have to put the |
@dscho The check titled "CI / osx-reftable (macos-13)" is failing after timing out after 6 hours. It didn't fail previously. What changed? |
@alrashedf unfortunately, the p4 tests became flaky on macOS. Don't worry about it. |
/submit |
Submitted as [email protected] To fetch this version into
To fetch this version to local tag
|
On the Git mailing list, Junio C Hamano wrote (reply to this): "Fahad Alrashed via GitGitGadget" <[email protected]> writes:
> From: Fahad Alrashed <[email protected]>
> Subject: Re: [PATCH v2] Bug fix: ensure P4 "err" is displayed when exception is raised.
Our convention is to use the name of the area as the prefix, e.g.,
git-p4: show Perforce error to the user
in the title. Documentation/SubmittingPatches has more guidance on
the title, like omitting the full-stop at the end, and on the
proposed log message in general.
> During "git p4 clone" if p4 process returns an error from the server,
> it will store the message in the 'err' variable. Then it will send a
> text command "die-now" to git-fast-import. However, git-fast-import
> raises an exception: "fatal: Unsupported command: die-now" and err is
> never displayed.
Nicely explained.
> This patch ensures that err is dispayed using
> "finally:".
Instead, we write it more like
Ensure that err is shown to the end user.
The implementation (i.e., catching an error with try/finally) can be
seen from the patch text. What is more important to capture in the
proposed log message is what _effect_ the commit wanted to make,
which is a good way to show _why_ we are making the change.
The intent of the original code being to always die at this point.
Even though it is necessary to enclose the earlier part up to
.wait() inside a try block to catch an exception, the two calls to
die() do not have to be inside finally block (in other words,
finally block could be just a no-op, and the die() calls can be done
after the whole try/finally block that kills the fast-import by
sending die-now and makes sure .wait() sees the process go), which
may have made the intent of the fix even more clear, which is "we
use the try/finally construct only to work around an exception
thrown by killing the fast-import process".
The patch posted as-is is not wrong per-se, though.
Thanks.
> diff --git a/git-p4.py b/git-p4.py
> index 28ab12c72b6..f1ab31d5403 100755
> --- a/git-p4.py
> +++ b/git-p4.py
> @@ -3253,17 +3253,19 @@ def streamP4FilesCb(self, marshalled):
> if self.stream_have_file_info:
> if "depotFile" in self.stream_file:
> f = self.stream_file["depotFile"]
> - # force a failure in fast-import, else an empty
> - # commit will be made
> - self.gitStream.write("\n")
> - self.gitStream.write("die-now\n")
> - self.gitStream.close()
> - # ignore errors, but make sure it exits first
> - self.importProcess.wait()
> - if f:
> - die("Error from p4 print for %s: %s" % (f, err))
> - else:
> - die("Error from p4 print: %s" % err)
> + try:
> + # force a failure in fast-import, else an empty
> + # commit will be made
> + self.gitStream.write("\n")
> + self.gitStream.write("die-now\n")
> + self.gitStream.close()
> + # ignore errors, but make sure it exits first
> + self.importProcess.wait()
> + finally:
> + if f:
> + die("Error from p4 print for %s: %s" % (f, err))
> + else:
> + die("Error from p4 print: %s" % err)
>
> if 'depotFile' in marshalled and self.stream_have_file_info:
> # start of a new file - output the old one first
>
> base-commit: 235986be822c9f8689be2e9a0b7804d0b1b6d821 |
During "git p4 clone" if p4 process returns an error from the server, it will store the message in the 'err' variable. Then it will send a text command "die-now" to git-fast-import. However, git-fast-import raises an exception: "fatal: Unsupported command: die-now" and err is never displayed. This patch ensures that err is shown to the end user. Signed-off-by: Fahad Alrashed <[email protected]>
/submit |
Submitted as [email protected] To fetch this version into
To fetch this version to local tag
|
This branch is now known as |
This patch series was integrated into seen via 3f7e03d. |
On the Git mailing list, Junio C Hamano wrote (reply to this): "Fahad Alrashed via GitGitGadget" <[email protected]> writes:
> From: Fahad Alrashed <[email protected]>
>
> During "git p4 clone" if p4 process returns an error from the server,
> it will store the message in the 'err' variable. Then it will send a
> text command "die-now" to git-fast-import. However, git-fast-import
> raises an exception: "fatal: Unsupported command: die-now" and err is
> never displayed. This patch ensures that err is shown to the end user.
>
> Signed-off-by: Fahad Alrashed <[email protected]>
> ---
Looking good. Queued. Thanks. |
This patch series was integrated into seen via 3367c07. |
This patch series was integrated into seen via 18078f4. |
There was a status update in the "New Topics" section about the branch P4 update. Will merge to 'next'. source: <[email protected]> |
This patch series was integrated into seen via 3367c07. |
This patch series was integrated into seen via e187166. |
This patch series was integrated into seen via 1c84a95. |
This patch series was integrated into next via 58fd3fb. |
There was a status update in the "Cooking" section about the branch P4 update. Will merge to 'master'. source: <[email protected]> |
This patch series was integrated into seen via bbffcd4. |
This patch series was integrated into master via bbffcd4. |
This patch series was integrated into next via bbffcd4. |
Closed via bbffcd4. |
When importing from Perforce using
git p4 clone <depot location>
, cloning works fine until Perforce commandp4
raises an error. This error message is stored inerr
variable thengit-fast-import
is sent adie-now
command to kill it. An exception is raisedfatal: Unsupported command: die-now.
This patch forces python to call
die()
with theerr
message returned from Perforce.This commit fixes the root cause of a bug that took me hours to find. I'm sure many faced the cryptic error and declared that git-p4 is not working for them.
cc: Karthik Nayak [email protected]