Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best way to "un-promote" files in Accurev?

Tags:

accurev

My company uses Accurev for source control, and for all its benefits, there's one simple action that I just can't figure out how to accomplish.

Often we have someone accidentally push a file up too far in our stream structure -- from the "Development" stream to the "Release" stream, for example. What is the best way to "un-promote" this file? That is to say, to get the old version of the file back into the "Release" stream, and keep the new version of the file in the "Development" stream, where it belongs?

Just doing a "Revert to Backed" or other Revert action on the file in the Release stream will either cause an old version of the file to propagate down into Development, or will make the file disappear entirely.

In the above case, the developer will have to jump through hoops with setting basis times on streams, or use the command line tool to do a checkout of an old transaction, to get the file back. Sometimes the people in question are non-technical, so this is not a good solution.

I have also considered moving the files to a "higher ground" stream, reverting, and then cross-promoting them to the lower stream again. This seems really kludgy.

It seems like Accurev is obscure enough that Google is no help, so I turn to the good folks of StackOverflow for help -- has anybody figured out the "Accurevy" way to accomplish this?

like image 898
Luke Rinard Avatar asked Mar 09 '10 02:03

Luke Rinard


4 Answers

  1. Go to main stream browser

  2. Right click on stream you accidentally promoted to and choose 'Show History'

  3. In History browser, right click on the promote you wish to revert and choose 'Revert'

  4. It'll prompt you which workspace you want to put the result of the revert into, you can choose the workspace you made the accidental promote from if you like.

  5. In your workspace, the files should now be back to the state before the accidental promote. You can now promote that back up into the stream above. The stream will now contain versions of the files that have your accidental promote removed.

  6. You can note your workspace no longer contains any of the files in question, but presumably you want to get the files you accidentally promoted back into your workspace? If so go back to the history browser for the stream, right click on the promote on there you just made (the promote with the reverted edits in), and choose 'Revert'. You can then choose the same workspace as the destination.

  7. The files will probably appear in the default group for your workspace now, and be conflicted, so just select the lot, and do a merge. You will likely want to accept trivial merges here.

Once you have merged the files, they should appear in your pending filter. You should now have the same files in pending as you have before you accidentally promoted, and the stream above should have the same contents in the file as before you promoted.

Simple as that (irony intended).

Steve

like image 64
Steven Craft Avatar answered Oct 09 '22 15:10

Steven Craft


The audit-friendly, append-only nature of accurev really means that reverting a change means re-applying the version that you want. Intuitively, you want to go backwards "1-step." But in an append-only system, this really means going-forward and re-applying an old version. Thus, reverting is naturally a "2-steps forward" process instead of "1-step back."

In most situations, reverting doesn't happen as often so the global value of 'append only' outweighs the revert recipe (IMO).

As a one-stop-shop consistent solution, the most accurate approach (as you mention) is t revert the promote transaction. View the stream history, find the unwanted promote, RClick > Revert. You'll need a child workspace.. why? because doing a revert may require an un-merge. Think about reverting an interstitial promote... it's like taking the lettuce out of a sandwich and needing to merge the top- and bottom- buns together. Only in a txn-based system, that revert may also include the tomato, mustard, and celery salt and as a single "undo." So you'll need to save the changes of the merge if one exists. In any case, and even if you're just undo'ing the most recent promote, just revert the change to the workspace, do the [occasional] merge, and promote everything up.

Long story short. Reverting in any CM system is a bit like doing surgery so you likely want relevant people involved.

Taking a step back. I tend to take advantage of accurev streams to validate code earlier-than-often and promoting up the chain only when validated. so the chance of reverting is less as you promote higher.

like image 22
user129236 Avatar answered Oct 09 '22 16:10

user129236


AccuRev version 5.2 introduces the ability to revert a transaction or issue directly in a stream, without involving a workspace. This is useful for reverting a change in the "release" stream, but does not solve the second part of your question (to put the new version back in the "development" stream. The full "unpromote/demote" feature is scheduled for a future release.

For more info on version 5.2, visit the release notes at -

http://www.accurev.com/download/docs/5.2.0_books/AccuRev_5_2_0_Install_Release_Notes.pdf

like image 5
adam Avatar answered Oct 09 '22 14:10

adam


I say this not entirely tongue-in-cheek, but you can run Mercurial locally and then when you run into this situation roll back your Mercurial, re-promote to Accurev, and then roll Mercurial forward again. Several developers at my workplace find Accurev so burdensome to use that this pattern is gaining some traction.

like image 2
Tim Avatar answered Oct 09 '22 15:10

Tim