libgit2sharp get next version changes - c#

Using the code from this answer I can checkout a specific version of the codebase just fine.
How do I get a previous version of a file with libgit2sharp
I then further want to get the next version after that. I get an error when getting the next version.
19691 conflicts prevent checkout
What is the best way to get the changes from the next version into the same directory ? Perhaps do a get first to a temp directory and then copy replace over the first, is there a better way ?

What I ended up doing is to get code using the answer from this question.
How do I get a previous version of a file with libgit2sharp
Then do a diff in the main repository to figure out the changed files for the next commit. With that list I can get only the changed or added files and remove deleted files from the first get. This works pretty fast when dealing with repositories with a lot of files in them.

Related

Subversion to Update the ver in a text file

I am in a circular trap here...
We are building on a dedicated server, so when we do a pull and build I want to update the version information in the projects to show a version such that the last digit is the "revision" number at that current pull for subversion.
But if the script updates that file, then it is not current. So I need to re-commit that file, or merge it in the next pull, or ...? Then the revision number is incremented.
I solved it in a C++ program by placing the actual revision numbers in a file that was NOT under the control of SVN. Now the script can "svn update", capture the revision number, change the local file, and built. However that creates a dependency on a file that is not under SVN control.
Furthermore, there are projects where it appears I cannot externalize the version number into a dedicated file, and leave that file out of SVN control.
What I really would like to see is a "eyecatcher" tag that SVN would update upon an svn commit (or svn update). Something arbitrary like: {!SVN_REV}
So, my C# assembly file might look like this:
[assembly: AssemblyFileVersion("1.1.0.{!SVN_REV}")]
Other version control systems support this kind of ability. Is there anyway in Subversion to do it?
Thanks for any advice.
Scotty
if the script updates that file, then it is not current
No, it's current (it terms of information), you can just not save this minor change in repository (best and easiest way)
From other side, you can
Store template-file in repository (read about SubWCRev and it's keyword)
At build stage create additional not versioned file at first stage with keywords, substituted with real (actual data) and use this file, not template

What happens the Files when i update the app?

I'm developing a simple Windows Phone 8 game and suddenly a question popped up in my mind? What happens to files (ex: Score.xml) when i update the app. Update overwrites all the files or keeps them or what?
Say you have an xml (Score.xml) file which keeps the scores. This is the orginal file:
<Score>
<LevelOne Score="0"/>
<LevelTwo Score="0"/>
</Score>
User keeps playing the game, as you guess those Score attributes increases. After few months later, think you will gone update your game with new xml file (Score.xml):
<Score>
<LevelOne Score="0" HowManyTimesPlayed="0"/>
<LevelTwo Score="0" HowManyTimesPlayed="0"/>
</Score>
What happens in this situation? Now we have old Score.xml that keeps users current score information and we have new Score.xml in the update that starts from scratch with new attributes? I made my apps with database before but in this game i don't need it. I need simple xml files. Very confused right now and don't know how to search even this situation in holly google. Did i misundestood something? Guys i really need your help :/
Your data will be preserved during the update procedure - MSDN:
When you update your app, any data in the isolated storage is preserved. However, data in the isolated storage is deleted if the user uninstalls and then reinstalls your app. For more information, see Data for Windows Phone 8.
It's your responsibility to correctly handle all old files.
I would advise you to publish (after succefull testing with deployment via VS) a beta version (for example limited only to you) and test updating procedures. From my experince it is very important thing to do - there may be many pitfalls and there is nothing worse than the app that fails after the update - so check as many times as possible.
As Romasz said, you have to handle all old files in IsolatedStorage yourself. I just wanted to add a few suggestions/hints about how to do it:
Know when the version has changed.
Keep the app's previous run version in a file. When you run the app, check if the new version is higher than the one from the file and if so - update what you need and then update the version stored in the file.
In some cases it's good to know by which version of the app was a file last modified. You can store the app version in that file and add some logic when the file is deserialized and the version in it is old.
In some cases you may need to make changes that will make the new class incompatible with the old file. Of course, you will still want the data from the old file, so here are two ways (I can think of at the moment) that you can handle this:
On update, open the file as XmlDocument/XDocument and modify it accordingly to make it compatible with the new class.
If there are a lot of changes, create a completely new class with the new data that you want to serialize, and leave the old one untouched. Then, on update, convert the old files to the new files. (You'll be deserializing the old file as the old class and then saving a new file with the new class.)
Triple check everything in the update. Deploy the old version, use it for a little and then deploy the new version to see if the update is handled correctly. (Okay that's not about handling but it's very very important.)
I hope this helps someone. :)
Update //Thanks to Romasz
You should keep update code for previous versions. Someone may for example update from version 1.3 to version 1.6, without going through versions 1.4 and 1.5. In this case, you may have several things to do on update.
Basically the code for update ends up being something like:
if (oldVersion < new Version(1, 4)) {
//update what changed from version 1.3 to version 1.4
}
//no need to update anything from version 1.4 to 1.5
if (oldVersion < new Version(1, 6)) {
//update what changed from version 1.5 to version 1.6
}
So, when someone updates from 1.3 to 1.6, both update procedures will be executed, with the older one being first, as it should be.
It really depends on where and how you are storing the XML file. But because you are modifying the file at runtime I am assuming you are storing it in the isolated storage. In that case the file will not get overwritten when you update the app.
If you want to be 100% sure,
- deploy the debug version of the app, using Application Deployment tool, to your test mobile/emulator
- use the app for a while so that the xml file gets updated
- recompile (not Rebuild) and redeploy.
If the changes remains intact after redeploy, you are good!

How to download a file from ClearCase?

Hi ClearCase Experts,
I just want to download a the latest version of a file from Clear Case for which I have the complete path & Clear Case View Name. Also we can safely assume that there is only one branch.
I looked for Clear Tool Commands HERE but, non of them seems useful,for my purpose.
I don't want to do a checkout/check-in etc. I just want the latest version of file. Though, the requirement is fairly simple. I am not able to get this done because I don't see any direct way to do this.
Please Help.
Additional Info:
I am using Visual studio 2012(C#,ASP.NET) with Clear Case Addons.
Any help appreciated!!.
On way is to use cleartool get.
Use the get command to copy a specified version of a file element into your snapshot view.
You must issue the get command from the root directory of a snapshot view or any directory below it.
Example:
On a Windows system, copy \dev\hello_world\foo.c##\main\2 into the C:\build directory.
cleartool get -to C:\build\foo.c.temp \dev\hello_world\foo.c##\main\2
This is using the ClearCase extended path for accessing a given version, as illustrated in "In ClearCase, how can I view old version of a file in a static view, from the command line?".
That other answer points to a way to access the content of a file with:
cleartool find yourFile -ver 'brtype(aBranch) && version(.../aBranch/LATEST) && ! version(.../aBranch/0)' -exec 'cleartool diff -ser empty "$CLEARCASE_XPN"'
That would look specifically for the LATEST version of a file on a given branch.

What is R60, R72, and MINE file?

I was building a DataAccessLayer using C# in VS 2012, and in my project, there are three files which I don't know how to deal with.
DataAccessLayer.csproj.mine
DataAccessLayer.csproj.r60
DataAccessLayer.csproj.r72
What are they? How should I deal with them?
They are files created from your repository that the code is saved in. You did an update and when you try to commit your files you will get a commit failed probably. When you diff the files, it will use the .mine .r60 .r72 files to bring up the differences between each revision (.r60, r72) and your file (.mine) and allow you to do something like Keep all changes in mine.
In order to get rid of the commit failed error messages, find the original file, update it with the correct changes, and when finished right click it and Mark as resolved and commit. This will get rid of those files.
Those files are related to version control (.mine is your file, .rX come from revision number X). You should try to merge them using your version controlling tool if you have one. If you don't have one and got those files by copying a project, you can possibly delete the .r files and rename DataAccessLayer.csproj.mine in DataAccessLayer.csproj (unless you already have DataAccessLayer.csproj - just keep it and delete the other then). Edit: And if it causes problems, try merging them manually (using a text editor for example) before keeping the final file.

anksvn checkin file

I am using the most recent version of anksvn for a visual studio 2008 project file. I now
want to check this code into anksvn, but I am having a problem.
The situtation is, I checked in the most current version of code into anksvn. That is fine.
However I have another version of this code that I did not check out from subversion initially. This other copy of the code was for a 'demo' only. However now this code needs to become the production code. Thus I am trying to determine how to check this code into anksvn.
What I know I can do is to 'remove' the most curent code folder that is in anksvn. I could then place this project folder into that location. since the origianl 'demo' code also includes the current production code.
However I am trying to see if there is a better method to accomplish this goal. Could I possibly use the branch/switch option?
Is the demo code checked out of Subversion at all? I know you didn't check it out, but was it checked out? If it was, you could commit this code back into Subversion, then update your working directory.
It his code has nothing to do with Subversion, you will have to take a more complex route: You will have to copy the changes manually to your code.
Since you're using Windows, you should take a look at Beyond Compare, This is commercial code, but you can download a limited time demo for free -- more than enough time to handle your situation. I use Beyond Compare all the time to compare two different directories or Java jar files or zip archives, etc. It not only can quickly show you the differences, but makes it each to copy those differences from one to the other.
I have no relationship with Scooter software, the makers of Beyond Compare except as a customer.

Categories