git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Elijah Newren" <newren@gmail.com>
To: "Steven Walter" <stevenrwalter@gmail.com>
Cc: "Govind Salinas" <govind@sophiasuchtig.com>,
	"Jakub Narebski" <jnareb@gmail.com>,
	git@vger.kernel.org
Subject: Re: Revert behavior [Was: Re: [ANNOUNCE] yap: Yet Another (Git) Porcelain]
Date: Tue, 9 Sep 2008 14:19:15 -0600	[thread overview]
Message-ID: <51419b2c0809091319j2f29b6e1n752cba305c7c1cf6@mail.gmail.com> (raw)
In-Reply-To: <e06498070809091029j1e450c43i276c5a69376da3ab@mail.gmail.com>

On Tue, Sep 9, 2008 at 11:29 AM, Steven Walter <stevenrwalter@gmail.com> wrote:
>> Of course, this is where I would use a DWIM-ism.
>> "pyt revert -r commitish" would generate a reverse patch but
>> "pyt revert <paths>..." would checkout from HEAD.  "pyt revert" would
>> just "git reset --hard".
>
> In yap, "revert" is used to discard working copy changes.  "revert -a"
> reverts all changes; just "revert" replies "nothing to do."  Having
> "pyt revert" = "git reset --hard" makes me queasy; especially in
> Dvorak it's all too easy to hit Enter when reaching for '/'; seems
> like a catastrophe waiting to happen.

I agree with that, and a plain "eg revert" does nothing other than
provide a suggestion for the user as well.

> I tend to dislike "DWIM" in interfaces, because the computer cannot
> read your mind, and can therefore never know with certainty what I
> mean.  Especially in cases where the computer thinks I intend to
> perform an irreversible operation, I want the computer to ask first.
> Not only that, but I think having one command that does 10 different
> things is as confusing as 10 commands that each do one thing.  My

How are these things really different, though?  People occasionally
want to "revert changes".  Now, this may be the changes between 32 and
29 revisions ago, it might be all changes since the last commit, it
could be the changes since 3 commits ago, or it could be just one
specific commit.  The user may want to subset such reversions to just
specific files, but it all boils down to "reverting changes" in the
end.  Now, eg can't yet handle a range like between 32 and 29
revisions ago (because I wasn't sure what syntax I'd want to use for
it), but it's fairly straightforward to say any of:

  eg revert --since HEAD~3  # Undo all changes since HEAD~3
  eg revert --in HEAD~8     # much like git revert HEAD~8, but no
commit by default
  eg revert --since HEAD foo.py  # Undo changes to foo.py since last commit
  eg revert foo.py               # Same as above
  eg revert --in trial~7 bar.c baz.  # Undo changes made in trial~7 to bar.[ch]

What doesn't work is

  eg revert trial~7

since I don't know whether the user wants to revert changes in that
commit, or since that commit (so this is a minor backward
compatibility break I made with core git).  But eg provides a simple
warning with suggestions, which teaches the user the correct command
as well as potentially showing them some new functionality.

Are these kinds of "reverting data" really so different that there
should need to be different commands, or that some of these operations
shouldn't be supported by the simple revert command?  Sure, most users
most of the time will probably use the "eg revert FILE1 FILE2..."
form, but I didn't see the harm in supporting the extra capabilities.

Also...is there anything fundamental that would keep core git from
adopting such behavior?  It'd solve lots of user questions[1], but
would also have some potential backward compatibility issues for
scripts[2] (which may be reason enough to not adopt it, I know).


Elijah

[1] For example, "how do I revert all changes since commit x?", "how
do I revert the recent modification to a certain file?", and "what's
the difference between checkout, reset, and revert?"

[2] commits by default don't make sense for the generalized revert
command, and "git revert REVISION" would error out with instructions
(telling the user to add the --in flag).

  reply	other threads:[~2008-09-09 20:20 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-09 13:26 Revert behavior [Was: Re: [ANNOUNCE] yap: Yet Another (Git) Porcelain] Elijah Newren
2008-09-09 13:38 ` Jakub Narebski
2008-09-09 16:37   ` Govind Salinas
2008-09-09 17:29     ` Steven Walter
2008-09-09 20:19       ` Elijah Newren [this message]
2008-09-09 21:50         ` Steven Walter
2008-09-09 23:02           ` Elijah Newren
2008-09-09 20:20   ` Elijah Newren
2008-09-09 21:28   ` Petr Baudis
2008-09-09 21:39     ` Steven Walter
2008-09-09 22:10       ` Revert behavior Junio C Hamano
2008-09-09 22:30         ` Steven Walter
2008-09-09 22:51         ` Elijah Newren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51419b2c0809091319j2f29b6e1n752cba305c7c1cf6@mail.gmail.com \
    --to=newren@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=govind@sophiasuchtig.com \
    --cc=jnareb@gmail.com \
    --cc=stevenrwalter@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).