bzr unshelve --dry-run should produce a diff

Bug #317896 reported by Barry Warsaw
36
This bug affects 5 people
Affects Status Importance Assigned to Milestone
Bazaar
Confirmed
Medium
Unassigned

Bug Description

I love that bzr 1.11 has shelf builtin, however unshelve is a bit less convenient that it could be.

My use case: I have a working tree with shelved changes and i want to delete the directory, but i don't yet know whether i want to save the shelved changes or not. I'd like to view the diff and then possibly save it off in a patch file somewhere else.

There appears to be no way to do this with bzr unshelve. abentley states in irc that he expected 'bzr unshelve --dry-run' to do this, and i do too, but it doesn't. --dry-run just shows you the list of files that would be touched in the merge operation, not the actual changes. Even adding -v doesn't help.

(The workaround of course is to do the unshelve, and then diff as normal, reverting if necessary, but that's suboptimal.)

Related branches

Revision history for this message
Aaron Bentley (abentley) wrote : Re: [Bug 317896] [NEW] bzr unshelve --dry-run should produce a diff

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Barry Warsaw wrote:
> Public bug reported:
> There appears to be no way to do this with bzr unshelve. abentley
> states in irc that he expected 'bzr unshelve --dry-run' to do this, and
> i do too, but it doesn't. --dry-run just shows you the list of files
> that would be touched in the merge operation, not the actual changes.
> Even adding -v doesn't help.

What would you think if the command was bzr diff -r shelved:1?

Doing it that way allows other diff options to be supplied.

Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkl1GA0ACgkQ0F+nu1YWqI1BTQCfVjn/oeJOT7E+FJ+fnxrq0LJL
6K4AnR26680dbww708xr8XbdbUgRtGD6
=mv6Q
-----END PGP SIGNATURE-----

Revision history for this message
Wesley J. Landaker (wjl) wrote :

I would love to see shelved changes be diffable as you suggest, but before you implement it that way, please think about the consequences to other commands that take revspecs. e.g. what does "bzr log -rshelved:1" do? You could just make that fail, but now this is confusing and inconsistent to the user.

It seems like the main issue is that shelved changes aren't "revisions" like everything else that a revspec defines.

Revision history for this message
Aaron Bentley (abentley) wrote :

I think erroring out for "log -r shelved:1" is pretty reasonable. There are many commands that use -r to specify one or more trees. Most of them could use shelved trees. Having to specify something other than -r would be hugely disruptive.

Revision history for this message
Alexander Belchenko (bialix) wrote :

Ping. Any chance this could be resolved anytime soon?

Shelve now working on windows, and I find this bug as major showstopper to use it.

Changed in bzr:
status: New → Confirmed
Martin Pool (mbp)
Changed in bzr:
importance: Undecided → Medium
Martin Pool (mbp)
tags: added: affects-emacs
Revision history for this message
Guilherme Salgado (salgado) wrote :

I'm willing to try and fix this myself, but I can't seem to find a way to produce a diff out of the shelf's contents. Is that at all possible or do I need to merge the shelf's contents and get a diff afterwards? Or is there a better way of doing it?

Revision history for this message
John A Meinel (jameinel) wrote : Re: [Bug 317896] Re: bzr unshelve --dry-run should produce a diff

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Guilherme Salgado wrote:
> I'm willing to try and fix this myself, but I can't seem to find a way
> to produce a diff out of the shelf's contents. Is that at all possible
> or do I need to merge the shelf's contents and get a diff afterwards?
> Or is there a better way of doing it?
>

I would assume that you can get access to a Tree like object from shelf
(PreviewTree perhaps?). And from there you would do something like
tree.changes_from(workingtree)

Which would let you find what files have changed.

Alternatively, I think there are some helpers in bzrlib.diff.* that
would generate a unidiff between 2 trees.

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAksqlRoACgkQJdeBCYSNAAODWgCgmj3UO90+K4CULcJRpprU0M81
b98An2Xk3wn4Pf+vaiL+ZBxo5qt0nKZ1
=5yLT
-----END PGP SIGNATURE-----

Revision history for this message
Guilherme Salgado (salgado) wrote :

My initial plan was to make 'unshelve --dry-run' print the diff to stdout but it was later agreed that a '--preview' action to unshelve would be a better idea, so this bug should probably be marked invalid as there's another one (bug 308122) that seems to be a better match for the new feature.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.