Can git cherry-pick be done in accurev? - accurev

I'm looking to do something similiar in functionality as git cherry-pick. My situation is thus: I mistakenly promoted from from stream C to Stream B, realized it was an error and reverted the transaction, this succeeded. But unfortunately I now no longer have the code In stream C that I had before the promote. I've tried doing a send to workspace and merged the underlaps but this puts me in the same place I was in before, I no longer have my changes. if I keep the overlaps I get overlaps with almost all the files.
I'm really at wits end, I know if this was Git I would have reverted my bad commit, merged the reversion into my feature branch, then cherry-picked the original commit.
accurev has broken me, I'm ready to cry and need some help :,(

In the future, you could have done a demote (new feature in AccuRev 6.2.0) of your changes in streamB and put them back in streamC (very slick new feature IMO).
To resolve your situation, perform the following steps.
Hang a workspace off of streamC.
Update this workspace.
Right click on streamB -> Show History -> Select the promote transaction -> Right click -> Send to Workspace -> Choose workspace from step 1.
Depending on your version of AccuRev, click on the "Default Group" filter or "Outgoing" filter.
Select all of the files included from the send to operation -> Right click -> Merge. You will not want to automatically keep the merge, but need to manually select the version of the file in your workspace (lower right hand pane). This contains the changes from your initial promote. After you have done this, keep and exit.
Now promote your changes into streamC.
The demote feature basically does all these steps for you in one operation BTW.

Related

Accurev: Restore workspace to older version

I'm a brand new to Accurev and I'm having many troubles with it. One of the developers I'm working with has promoted bad code (things are now broken that weren't before) for 2 months on a stream, and I'm wanting to get a copy of the original code before any changes were made to it.
I currently have a workspace, and whenever the other developer creates code, I pull his changes into this workspace attempting to fix the bugs. These changes are promoted to an existing issue within Accurev.
Is there any way I can perhaps create a second workspace and obtain a copy of the original code (before any changes were made)? My target date is March 14th.
I would suggest you revert or demote the bad code that was promoted into the stream (Depending on what version of AccuRev you are using). This would put the stream back into the state it was before the promotion occurred.
Below are some suggested readings on the related topics.
Best way to "un-promote" files in Accurev?
https://community.microfocus.com/borland/managetrack/accurev/w/wiki/26745/purge-revert-and-demote
https://community.microfocus.com/borland/managetrack/accurev/w/accurev_knowledge_base/25951/how-to-revert-changes-in-a-stream
https://community.microfocus.com/borland/managetrack/accurev/w/accurev_knowledge_base/26079/what-is-the-proper-way-to-revert-by-change-package
As an alternative, you could create a time-based stream below the one with the bad code. Set a time basis that predates the bad promote.
To do this, I right-clicked the stream >> New Snapshot.
I select "Specified" and enter the date (with a relative time).
From the Snapshot, I created a New Workspace which was then populated with previous code.
Hope this helps!

Is there a way to recover my code in Microsoft Visual Studio Community?

Technology used:
Microsoft Visual Studio Community 2015
VB.NET
GitHub
When i was altering skin in my form to design it, i was having trouble undoing my design to return back to its normal design. And as i go to my Form in Solution Explorer and clicked Undo everything had vanished including my code. I'm having trouble on how to retrieve my code ? Is there a way to retrieve my codes and my design or a garbage collector where i can easily retrieve it?
I would be so happy for your suggestions.I really need your Help.
The only way that you will be able to retrieve your old code at this point is if you did a
git push origin master
(or other branch) to github before you made these changes.
If you haven't use Git Extensions - I would suggest downloading and linking it to your github repo for this project. Git Extensions will give you a nice quick view of all your branches and what is sitting in your local repo.
Provided that you did a
git commit
You will still have your changes saved locally and this can be easily identified using Git Extensions.
If you have made the changes after you did a commit, you will see the old code in Git Extensions. From here you will be able to revert selected lines or all of the files. This is provided, that you had at least one major commit in git before this happened.
Update 1:
Based on your comment on your OP you should still have the original files in git. You should then be able to find your code easily via Git Extensions. You should see a list of changed files and from here you can revert them easily.
Update 2: Based on your comments, it appears that you have completely lost your changes. Git is a change tracker - and based on what you have said you did an Undo Changes on git. This means, that git had reset all the changes that it was tracking and went back to the last commit that you made. There is no way to get your changes back unless you had the files stored on DropBox or something similar where files are tracked on each save of the file. With git, changes made are only stored once committed. If you do an undo changes on the git repo before committing what it actually does is a
git reset
This removes all the changes and reverts it to the last commit.
I've checked and found this. I expect this should deal with your problem. Afterall, as long as you didn't intentionally delete anything, they are still in your target folder where you saved it.
If you checked in your code BEFORE the error on GitHub you can try this:(although I am not certain of community edition as I know it works on Pro and Enterprise).
Go to class in question
Right Click to get context menu
Select Source Control>History
Select a prior version
Right Click Reset>Reset and Delete Changes
This will basically say: "I don't care what happened just take me back to my safe place at this point in time with all affected files!". When performing code I cannot stress the importance to having source control and committing often.

Get back lost shelf changes

I have shelved my 26 java files changes via Intellij Idea 2016.2.1 and I checkout to different branch.
When I came to old branch to check my shelved changes.
I gone a mad now, I lost all the files. I was worked nearly two months
Can somebody help to get it back?
You can restore the state of those files if they were edited in IntelliJ. Use local history to see all the changes made in IntelliJ (VCS -> Local History -> Show History).
Even there isn't Shelf tab in IDE you can find shelved changes as patch files at {ProjectName}/.idea/.idea.{ProjectName}/shelf/.idea/shelf.
Then your can apply any selected patch.
I was able to view lost changes and revert back to them by:
right click on project directory, select Local History > Show History
Find the entry in the history menu that you want to restore. You can examine the files by double clicking on the entry and the files to examine differences.
Right click on the entry you want to restore, and select Revert
Note in my case Git>VCS Operations>Show History showed nothing. Only through the Project Files menu.
Andrei's answer was helpful for my situation where I renamed my project and my previously shelved changes were no longer found under the shelf, but I did run into an issue when applying the patch file because I was prompted to "Select missing base" for various files in the patch. Similar to what is seen in the screenshot below:
https://youtrack.jetbrains.com/issue/IDEA-183910
I was able to avoid having to "Select missing base" for various files by first changing the default shelf location and then applying the patch.
https://www.jetbrains.com/help/idea/shelving-and-unshelving-changes.html#change-shelve-location
Also, I found my patch in this location:
{ProjectName}/.idea/shelf
instead of the aforementioned location:
{ProjectName}/.idea/.idea.{ProjectName}/shelf/.idea/shelf
Maybe this will help someone:
I lost part of my shelved changes in combination with an update of IntelliJ. I'm not sure if the update was the reason but eventually most of my most recent (and important) changes were gone.
I couldn't restore them from local history as this does not "survive" an update of IDEA. But in the files I saw that there still is some data:
C:\Users\myUser\AppData\Local\JetBrains\IntelliJIdea2021.2\LocalHistory had a changes.storageData with ~50MB.
Copying the files to the folder of the new version didn't help as the files got overwritten again.
Solution:
I was able to get the old version of IntelliJ (2021.2) here and installed it. This can be done in parallel, without removing the newer version.
Here I was able to retrieve my changes from the Local History and shelve or apply them again.
Hint: Backup the "Local History" folder (or the whole IntelliJIdea20xx.x folder) before you start. I don't remember if I had to copy it in there again or if it worked out of the box. (Just to be sure the local history doesn't get lost).
I've also experienced this bug repeatedly and hence no longer use shelved changes, but rather the Git CLI directly. As of 2022 Jetbrains IDE's still cannot be trusted with their "Smart Checkout" feature, which has a small probability of the total loss of your files (experienced personally in both IntelliJ & Rider).
Unlike another comment here regarding using the Local History, this did not work for me as the history showed nothing. I've also lost many hours of work due to this bug which remains unfixed.
The solution is to use "git stash -u" on the command line, then checkout the desired commit. Once youre done, type "git stash apply" to restore your files. Trusting the "smart checkout" feature is like playing Russian roullette. It's IDE magic that may just fail and you lose everything.

Move file in one AccuRev workspace that has been edited in another workspace

We have a need to refactor a code base. The thing is that this will be done by one person and it would be desirable to avoid having the rest of the development team sitting idle while this job takes place.
We therefore tried the following scenario to see if it is possible to work in parallel.
Created file test.txt in directory first in developer A's workspace.
Promoted this file.
Updated developer B's workspace, thereby getting file test.txt
In A's workspace moved file test.txt to directory second.
Promoted this move.
In B's workspace edited file test.txt while it still resides in directory first (no update is made thereby emulating that work is done while refactoring is taking place).
Tried to promote and got a message saying that file test.txt had been modified (correct, file has been moved).
Tried to merge but got an error message saying that AccuRev can't merge since the file is missing in directory second (where it has been moved).
Tried to update B's workspace but that is not allowed since there is a modified file that needs to be merged first.
We are now stuck in a catch 22 situation.
We did try to place a fake file in directory second but that is not being recognized since this file does not belong to the workspace.
Has anyone out there tried something like this and gotten it to work?
It is of course possible to copy files but if there is a better way we would be grateful to hear about this. Or if this is a known bug or limitation in the tool.
We will contact also contact AccuRev support but I thought that I might be able to get some useful tips from the community.
Currently we are using AccuRev client 5.5.0.
Thanks for any suggestions on how to make the tool support this operation.
Referring to your steps 6 & 7: In AccuRev 5.5 after a file is edited and has a (modified) status you first have to keep before you can promote.
At step 8 you could try doing the merge from the Browse Versions view of the file. That way you can select any node to merge with, including the one that has been moved.
Step 9. An AccuRev update will not run successfully if one of the files to be updated is (modified). This is by design. You can keep the file so it has (kept)(member) status then run the update.
David Howland
After contact with AccuRev support the answer is that the only option available is to copy the file to some temp directory, revert the changes, update the workspace and copy the file into the new location in the workspace.
AccuRev will at least tell you which files you have to copy since they will be marked as modified.
I could experimentally verify David's remark to step 9 using AccuRev 5.5.
Let's assume that in the workspace of user A the file was moved and the move was promoted, while in the workspace of user B the file was modified and user B is about to promote his/her change.
Before the file is kept, it will not be possible for user B neither to merge nor to update. But after keeping the modified file the update is possible. The file is first marked as overlap, then the merge succeeds in the new location. Basically, this avoids creating a copy of the file, reverting it and restoring it in the new location after an update, which can be quite cumbersome, as AccuRev does not reveal easily where the move goes.
If user B promotes the modification before user A promotes the move, all goes smoothly, i.e. on update the moved file appears as overlap, but easily merges into the moved file in the new location.
Similar results are obtained when the two users have workspaces connected to different streams and the overlap occurs on a common parent stream. Only if the file is unkept, an error can occur (i.e. only if the move is promoted before the change). Then a simple keep allows to proceed as usual (update, merge, then promote).

Accurev - why not Auto-Update?

Why isn't it standard behavior for Accurev to automatically run an "Update" upon opening the program? "Update" updates a user's local sandbox with the latest files from the building/promoted area.
It seems like expected functionality that the most recent files should be synchronized first.
I'm not claiming that it should always update, but curious as to why an auto-Update wouldn't be correct.
Auto-updating could produce some very unwanted results.
Take this scenario: you're in the middle of a development task, but you've made a mistake and need to revert a file that you just modified. So you open AccuRev, but before you have a chance to "revert to most recent version", you are bombarded with 100 files that have been changed upstream including the one you want to revert. You are now forced into the position of resolving all the merge conflicts before your solution will build, including the merge of your (possibly unstable) code in progress.
Requiring the user to manually update keeps a protective 'bubble' around the developer, allowing them to commit (keep) changes within their own workspace without bringing down code changes that could destabilise the work in their sandbox. When the developer gets to a point where his code is ready to share with others, that is the appropriate time to do an update and subsequently build/retest the merged codebase before promoting.
However there is one scenario that I do believe auto-updating could be useful: after a workspace is reparented. i.e. when a developer's workspace is moved from one part of the stream hierarchy to another. Every time we reparent we have to do a little dance:
Accept the confirmation dialog that reminds us (rather verbosely) that we need to update our workspace before we can promote any changes.
Double-click the workspace to view its files.
Wait for AccuRev to do a "Pending" search, to determine whether any file changes are waiting to be committed.
And finally, perform the Update.
Instead of just giving us a confirmation dialog, it would be nice if AccuRev could just ask us if we want to Update immediately.
I guess it depends on preference. I for one wouldn't like the auto-update feature.
Imagine you have a huge project and you don't want to build it every time you start Accurev. But you also can't debug because the source files and debugging info no longer correspond.