Fossil

View Ticket
Login

View Ticket

Ticket Hash: 83af1f5401a4cb9ba9943d0ec122ce721693bd9e
Title: fossil rollback
Status: Closed Type: Feature_Request
Severity: Important Priority: Immediate
Subsystem: one Resolution: Overcome_By_Events
Last Modified: 2015-02-17 00:55:53
Version Found In:
Description:
`fossil rollback` - undo the commit but leave files modication

<hr><i>drh added on 2008-10-18 13:34:09:</i><br>
A "fossil rollback" command is problematic, for two reasons.

The first and less serious reason is that removing information from a
fossil repository goes against the fossil philosophy of preserving all
changes.  There are other mechanisms in place to remove content from
a fossil repository (ex: the "shun" mechanism) but these things are 
intended to combat spam.  We have concerns about users routinely 
backing out their changes.

The second problem is that the rollback can only occur on the local
repository.  If a sync has occurred since the commit, then the commit
has already been replicated onto other repositories.  The next time
the local repository syncs, the commit will reappear from the remote
repository and the rollback will be undone.  Note also that the default
behavior is for the local repository to sync automatically after each
commit, so there is a strong change that a sync will have occurred in
between the commit and the rollback.

What exactly is the OP hoping to accomplish with a "rollback" command
in fossil?  There are two opportunities during the commit process to
abandon the commit - while editing the check-in command and while
entering the GPG password - so it seems unlikely that a commit might
occur by accident.  What problem would the "rollback" command solve?


<hr><i>anonymous claiming to be lRem added on 2009-04-08 15:45:30:</i><br>
I second this feature request. It happens from time to time that a bad commit happens. The line
<verbatim>
# EDITED   some_file
</verbatim>
does not prevent you from revealing your CC number you put there as a test string ;)

Now if I want to rollback a bad commit the only way to do it is to remove the local repository, pull and apply my changes once again. This is a lot of work that could be avoided. As you wrote nothing can be done about changes that were pushed somewhere. But that is acceptable - one has to look out for his own autosync...

<hr><i>drh added on 2009-04-08 16:22:34:</i><br>
If, as you say, you accidently check in a file that contains your CC numbers,
you can use the "Shun" mechanism to remove that file from the repository, and
to prevent it from being added again in the future (for example due to a
sync.)

The Shun mechanism was created for this and related purposes:  to remove
wiki-spam or inappropriate or obscene comments or remarks or to remove
copyrighted material or material that contains trade secrets.

Shunning can be done from the web UI.  For some screens that show a single
artifact, there is a "Shun" submenu option.  (You have to have Admin privilege
to see it, I think.)  Or you can type in the SHA1 id of an artifact in the
Shun screen which is found off of the main Admin page.  Shunning takes effect
the next time the repository is rebuilt.



<hr><i>bharder added on 2009-04-08 17:19:16:</i><br>
Perhaps call it "fossil rewind" to "unplay" the commits, up to a certain point? I.e. if "<b>fossil timeline</b>" initially displays something like this:

  *  <nowiki>[beddable]</nowiki> checkin of big fix
  *  <nowiki>[deadbeef]</nowiki> code change xyz...
  *  <nowiki>[cafebabe]</nowiki> update code for new password changes...
  *  <nowiki>[debac1e5]</nowiki> Closed ticket xyz...
  *  <nowiki>[f005ba11]</nowiki> correct feature A as per ticket debac1e5...
  *  <nowiki>[decaf000]</nowiki> update supporting libabc to version 2...

"<b>fossil rewind debac1e5 -m 'password accidentally checked-in with code'</b>" would leave the repository in a state where <nowiki>ticket [debac1e5]</nowiki> is the last entry. The manifest would be rebuilt to reflect repo state. I'd hope that syncing the checked-out files would not be done automatically. From there, a user could "<b>fossil commit</b>" to commit current diffs again, or re-checkout whatever baseline they want reflected on disk...

As I think of it, perhaps a "rewind" entry could be installed as an artifact, too. So, after the above operation the "<b>fossil timeline</b>" might read:

  *  <nowiki>[c0ffee55]</nowiki> Rewind: (to <nowiki>[debac1e5]</nowiki>) password accidentally checked-in with code
  *  <nowiki>[debac1e5]</nowiki> Closed ticket xyz...
  *  <nowiki>[f005ba11]</nowiki> correct feature A as per ticket debac1e5...
  *  <nowiki>[decaf000]</nowiki> update supporting libabc to version 2...

I'm guessing, too, that the "rewind" entries would *absolutely* need to be immutable (ie: non-rewindable themselves).


...as I think about this more, it could also be nice to rewind artifacts to a temp storage, fix the point-in-time error (ie: take out the CC#, or password), then replay the temp storage <i>back</i> to the main repo... correctly only the mistake of entering a CC# or password, etc., but allowing the repo to otherwise easily be brought back to initial (pre-rewind) state. That's <b>really</b> breaking the "must not be mutable" philosophy of drh's though.

<b>fossil rewind debac1e5</b> ;# rewinds main repo to "debac1e5", storing unwound items on temporary stack

<nowiki>[do local edits]</nowiki> ;# i.e.: remove the CC#

<b>fossil commit</b> ;# now there is no embedded CC#, or secret password

<b>fossil replay deadbeef</b> ;# replays stack taken with "fossil rewind", starting with deadbeef, to end (beddable)

<b>fossil timeline</b> ;# new state after rewind/edit/replay
  *  <nowiki>[be55077d]</nowiki> Replay: end of replay <nowiki>[ca5caded]</nowiki>
  *  <nowiki>[ace55ab1]</nowiki> checkin of big fix
  *  <nowiki>[defaced1]</nowiki> code change xyz
  *  <nowiki>[ca5caded]</nowiki> Replay: start
  *  <nowiki>[1dec0ded]</nowiki> password changes in code, but didn't commit actual password this time
  *  <nowiki>[c0ffee55]</nowiki> Rewind: (to <nowiki>[debac1e5]</nowiki>) password accidentally checked-in with code
  *  <nowiki>[debac1e5]</nowiki> Closed ticket xyz...
  *  <nowiki>[f005ba11]</nowiki> correct feature A as per ticket debac1e5...
  *  <nowiki>[decaf000]</nowiki> update supporting libabc to version 2...

I'm sure there are corner cases, and details to be worked-out, but it sounds interesting...

<hr><i>bharder added on 2009-04-08 17:24:24:</i><br>
If this discussion continues, it should be moved to a [rewinding] wiki page...

<hr><i>anonymous claiming to be lRem added on 2009-04-08 19:37:56:</i><br>
Ok, I've missed the <em>shun</em> feature. It's all that <em>I</em> need in this matter.