Question about Source Control

Cameron Simpson cs at zip.com.au
Sun Mar 23 21:07:13 EDT 2014


On 24Mar2014 11:30, Chris Angelico <rosuav at gmail.com> wrote:
> On Mon, Mar 24, 2014 at 11:19 AM, Cameron Simpson <cs at zip.com.au> wrote:
> > I'm particularly fond of "hg record" (or the similar extension, "hg
> > crecord"), which lets you commit just parts of a modified file.
> >
> > When I'm in a debugging branch, it gradually turns into a huge diff.
> > [...] Every so often I spent a little while cleaning out related
> > changes that are going to stay so that the final diffness consists
> > of debug statements and hacks-in-progress; much smaller. [...]
> 
> Absolutely agree. With git, the same functionality can be done by
> making use of the staging area; you can either add an entire file (all
> its changes), or do a partial add with "git add -p" or (more
> conveniently, but requires a GUI) "git gui". [...]
> The only thing I would really like is a simple way to say
> "stage/commit the lines from here to there"; with git gui, I can
> either stage an entire hunk (everything until the next point where
> there's enough unchanged lines that the context breaks) or a single
> line (either an insertion or a removal). Gets tedious when you want to
> stage half of a large hunk. [...]

"hg record" has the same issue; you get to approve or ignore single
diff chunks.

However, there's no fundamental technical reason you can't pick and
choose arbitrary lines.

Based on things I've experienced use "hg record", it pretty clearly
walks the user through the diff picking/rejecting chunks, and then
temporarily replaces the target file(s) with versions containing
only the selected diff chunks, and commits the files. Then it
restores the original modified file, whose diff from the "tip" is
now reduced.

With some work, that could be done on a line-by-line basis.

Cheers,
-- 
Cameron Simpson <cs at zip.com.au>

I've always been a big Greenaway fan - I've seen and enjoyed "The Falls" for
crying out loud.        - Peter Alexander Merel <pete at extro.ucc.su.OZ.AU>



More information about the Python-list mailing list