git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH 0/1] git-p4: add unshelve command
@ 2018-02-22  9:50 Luke Diamand
  2018-02-22  9:50 ` [PATCH 1/1] " Luke Diamand
  0 siblings, 1 reply; 8+ messages in thread
From: Luke Diamand @ 2018-02-22  9:50 UTC (permalink / raw)
  To: git; +Cc: Lars Schneider, miguel.torroja, gvanburgh, Luke Diamand

This is an initial attempt at adding an unshelve command to
git-p4.

For those not familiar with it, p4 shelve creates a "pending"
changelist, which isn't committed into the central repo but is
nonetheless visible to other develoeprs. The "unshelve" command
takes one of these pending changelists and applies it to your repo.
It is used quite a lot for code review.

git-p4 learned about shelving changelists recently; this completes
the picture by letting you unshelve them as well.

This was inspired by the stackoverflow answer here:

    https://stackoverflow.com/questions/41841917/git-p4-how-to-fetch-a-changelist

The secret is to use the "p4 print file@=N" syntax to get the
contents of a shelved changelist, which has long perplexed me.

I haven't used this a great deal, so it may still have a few rough
edges.

In particular, it currently puts the unshelved commit into
    refs/remotes/p4/unshelved/<N>

where <N> is the changelist being unshelved. That might not be
the best way to do this.


Luke Diamand (1):
  git-p4: add unshelve command

 Documentation/git-p4.txt |  22 ++++++++
 git-p4.py                | 128 +++++++++++++++++++++++++++++++++++------------
 t/t9832-unshelve.sh      |  67 +++++++++++++++++++++++++
 3 files changed, 186 insertions(+), 31 deletions(-)
 create mode 100755 t/t9832-unshelve.sh

-- 
2.15.1.272.gc310869385


^ permalink raw reply	[flat|nested] 8+ messages in thread
* [PATCHv2 0/1] add git-p4 unshelve command
@ 2018-05-12 21:24 Luke Diamand
  2018-05-12 21:24 ` [PATCH 1/1] git-p4: add " Luke Diamand
  0 siblings, 1 reply; 8+ messages in thread
From: Luke Diamand @ 2018-05-12 21:24 UTC (permalink / raw)
  To: git
  Cc: Lars Schneider, Miguel Torroja, George Vanburgh, Junio C Hamano,
	Merland Romain, Luke Diamand

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


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-05-16 20:48 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-22  9:50 [PATCH 0/1] git-p4: add unshelve command Luke Diamand
2018-02-22  9:50 ` [PATCH 1/1] " Luke Diamand
2018-02-22 21:39   ` Miguel Torroja
2018-02-22 22:28     ` Luke Diamand
2018-02-23 17:22       ` Luke Diamand
2018-02-24 12:50         ` Miguel Torroja
  -- strict thread matches above, loose matches on Subject: below --
2018-05-12 21:24 [PATCHv2 0/1] add git-p4 " Luke Diamand
2018-05-12 21:24 ` [PATCH 1/1] git-p4: add " Luke Diamand
     [not found]   ` <1378098185.1161438.1526219571066@mail.yahoo.com>
2018-05-16 20:48     ` Luke Diamand

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).