Recovering deleted files from an svn repository

To recover a file from svn that you deleted from your local repository, it’s first necessary to get the proper name of the file, and the revision of the repository it last existed in.  To do that (assuming you don’t know, because if you do you have bigger issues), you go to the directory it was in (or as close as you can get to the directory it was in) and run:

> svn log -v --xml > svn-log.xml

You should be able to find the file you’re looking for and the revision you need in the output log file. Assuming your file’s name is ‘myfile.txt’ and it was in revision 1000, you run the following to recover it:

> svn up -r 1000 myfile.txt

 

Advertisements

C# 6 null check

Like nullable types, null-conditional operators can be used now. Just put a ‘?’ (question mark) after the instance before calling the property on top of it. You don’t have to write additional if statements to check for null now. For example, let’s see a simple if condition which we will then see with the null-conditional operator in C# 6.0:

C# 6.0 - Simple Condition (www.kunal-chowdhury.com)[3].png

C# 6.0 - Nested Conditions (www.kunal-chowdhury.com)[3].png

Now let’s see, how it can be used to return a default value if the condition does not satisfy at all. In the below code snippet, you can see that “??” conditional operator can be used along with the null-conditional operator to return a value. In this case, if either of emp (employee object) or MemberOfGroups value is null, it will return –1:

C# 6.0 - Default Values in Conditions (www.kunal-chowdhury.com)[3].png