From: Luke Diamand <luke@diamand.org>
To: git@vger.kernel.org
Cc: Lars Schneider <larsxschneider@gmail.com>,
Miguel Torroja <miguel.torroja@gmail.com>,
George Vanburgh <gvanburgh@bloomberg.net>,
Luke Diamand <luke@diamand.org>
Subject: [PATCH 0/1] git-p4: add format-patch subcommand
Date: Mon, 26 Feb 2018 11:48:21 +0000 [thread overview]
Message-ID: <20180226114822.1617-1-luke@diamand.org> (raw)
This is an initial attempt to add a "format-patch" command
to git-p4, following on from the earlier discussion about
shelving.
It uses the "p4 describe" command to generate the diff content and
post-processes it enough to generate git-style patches. These
can be fed to tools such as patch, or "git am".
This is useful for "unshelving" a P4 changelist into your git tree,
since the usual git subcommands (sync, clone) cannot easily read
a shelved changelist: there is no good way to get from Perforce
a consistent single revision against which to generate a diff
using git fast-import, since Perforce doesn't have the concept of
a repo revision.
By default, it leaves the depot prefix in the patch, but using
the option "--strip-depot-prefix" makes it suitable for "git am".
Use it like this:
$ git p4 format-patch 12345 >out.patch
or
$ mkdir patches
$ git p4 format-patch --output patches 12345 12346
or
$ git p4 format-patch --strip-depot-prefix 12347 >out.patch
$ git am out.patch
Limitations of "p4 describe" mean that this will not work reliably
with binary files. There's no easy way around this. The change makes
a small attempt to at least stop on binary files, but in the case
of a file marked in P4 as "text", which contains binary deltas, the
file will unavoidably come out corrupted.
Luke Diamand (1):
git-p4: add format-patch subcommand
Documentation/git-p4.txt | 33 +++++
git-p4.py | 304 +++++++++++++++++++++++++++++++++++++++++++++--
t/t9832-make-patch.sh | 135 +++++++++++++++++++++
3 files changed, 462 insertions(+), 10 deletions(-)
create mode 100755 t/t9832-make-patch.sh
--
2.15.1.272.gc310869385
next reply other threads:[~2018-02-26 11:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-26 11:48 Luke Diamand [this message]
2018-02-26 11:48 ` [PATCH 1/1] git-p4: add format-patch subcommand Luke Diamand
2018-02-26 23:29 ` Miguel Torroja
2018-02-26 23:48 ` Eric Sunshine
2018-03-12 9:40 ` Luke Diamand
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180226114822.1617-1-luke@diamand.org \
--to=luke@diamand.org \
--cc=git@vger.kernel.org \
--cc=gvanburgh@bloomberg.net \
--cc=larsxschneider@gmail.com \
--cc=miguel.torroja@gmail.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.
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 NNTP newsgroup(s).