Re: Something like "darcs record" / "hg record" == Select changes to commit.

Daniel Carrera dcarrera at hush.com
Thu Jun 7 01:53:51 UTC 2012


On Thursday, June 07, 2012 at 3:06 AM, Stephen J. Turnbull <stephen at xemacs.org> wrote:

>Daniel Carrera writes:
>
> > I would add that I have experimented with "shelve" and some times
> > it doesn't let me select individual hunks in a file if they are
> > very close.
>
> That sounds like a bug, unless by "very close" you mean "in the same
> line".  At that level, I think you just need to bite the bullet.

Oh, not at all. I meant a few lines apart. Here is a practical example:

-------------// Example Start //-------------------
daniel ~/Other/tmp % cat test.dat 
cat
mouse
hamster
rat
gebril
daniel ~/Other/tmp % pico test.dat 
daniel ~/Other/tmp % cat test.dat 
cat
koala
mouse
hamster
rat
wolf
gebril
daniel ~/Other/tmp % bzr diff
=== modified file 'test.dat'
--- test.dat	2012-06-02 12:40:19 +0000
+++ test.dat	2012-06-07 01:47:24 +0000
@@ -1,5 +1,7 @@
 cat
+koala
 mouse
 hamster
 rat
+wolf
 gebril

daniel ~/Other/tmp % bzr shelve
--- test.dat	2012-06-02 12:40:19 +0000
+++ test.dat	2012-06-07 01:47:24 +0000
@@ -1,5 +1,7 @@
 cat
+koala
 mouse
 hamster
 rat
+wolf
 gebril
Shelve? [yNfq?]
-------------// Example End //-------------------

You see... unless I'm just confused about how shelf works, "koala" and "wolf" are together even though they are three lines apart.

I certainly don't expect a VCS to select hunks smaller than a line. Even if the feature was available, I wouldn't use it.


> > So the only way to commit the change I want (e.g. fixing a typo in
> > a comment) is to undo some of the work I've done in nearby lines,
> > then commit, and then re-add my changes... That feels like
> > something my VCS would ideally take care of...
>
> I disagree.  I think your editor should take care of it.  The parts
> that need human judgment here are disentangling textual changes,
> that's what editors are good at.  So I think you want to stay in your
> editor at this point.  The editor's role would be to save the file, 
> ask the VCS to shelve the current changes, and refresh the buffer.
> You fix the typo, then the editor saves, asks the VCS to commit the
> small change and then unwind the shelf, and refreshes the buffer
> (which is probably in conflict now).

Out of curiosity, what editor do you use? Do you have an editor that can do this?

Cheers,
Daniel.




More information about the bazaar mailing list