git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCHv2 0/1] add git-p4 unshelve command

From
Luke Diamand <luke@diamand.org>
Date
May 12, 2018, 21:24 UTC
Message-ID
<20180512212434.28012-1-luke@diamand.org>
This is another attempt to make a "git p4 unshelve" command.

Unshelving in p4 is a bit like a cross between cherry-pick and "am", and is very commonly used for review.

This command helps git users who want to try out a shelved p4 change from some other repo:

e.g.
   $ git p4 unshelve 12345
   unshelved CL12345 into refs/remotes/p4/unshelved/12345
   $ git show refs/remotes/p4/unshelved/12345

I abandoned an earlier attempt because it seemed like there is no way to get around a rather nasty problem: git-p4 just constructs the commit and passes the file contents to git-fastimport. But there's no easy way to construct the *prior* commit, because Perforce doesn't record this information, and so you can end up with other changes mixed into the unshelved commit - these are the differences between your tree and the other tree, for each file that has been modified.

However, I think the command is sufficiently useful that it's worth supporting anyway, even with that caveat.

I also tried to use "p4 describe" to get the deltas, but that's very unsatisfactory: I found myself writing a second-rate version of git's diff tool to try to make up for the deficiencies in Perforce's diff tool.

It might be possible to reconstruct the missing base commit information, but that's a reasonably tricky task.

I have incorporated some of the comments from the earlier review rounds, in particular:

- no longer adds the [git-p4...] annotation in unshelve
- try to use .format() in place of %
- rename the target branch if it already exists
Luke Diamand (1):
  git-p4: add unshelve command
 Documentation/git-p4.txt |  26 ++++++
 git-p4.py                | 171 ++++++++++++++++++++++++++++++---------
 t/t9832-unshelve.sh      |  99 +++++++++++++++++++++++
 3 files changed, 260 insertions(+), 36 deletions(-)
 create mode 100755 t/t9832-unshelve.sh
-- 
2.17.0.392.gdeb1a6e9b7
Next: Luke Diamand
Message 1 of 3 in “[PATCHv2 0/1] add git-p4 unshelve command”
  1. Luke DiamandMay 12, 2018
  2. 1/1 git-p4: add unshelve commandLuke Diamand, May 12, 2018
  3. Luke DiamandMay 16, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.