Welcome to palaso.org
Website of the Payap Language Software Development Group
Git notes
Author admin | 23.06.2008 | Category Developers, WeSay
Now that I’ve used git for a couple weeks, I thought I’d make a few notes of commands I’ve found helpful.
To make a local branch for development
git checkout -b name_of_new_branch
To commit changes to the local repository (although I usually use the visual gittk for this)
git commit -a
To commit changes back to subversion
git svn dcommit
To uncommit
git reset HEAD~1
To keep a local branch up to date with subversion (use git stash to hide away local uncommitted changes for later)
git svn rebase
To move the master branch up to trunk
git checkout master
git svn rebase
to handle conflicts with merge
git mergetool path_to_file_needing_merge
or
git mergetool -t toolname path_to_file_needing_merge
To remove untracked files (like the temps that get created during a merge resolve)
git clean -n to see what it would do
git clean -f -d (-d if you want to remove untracked directories as well)
Git, Subversion and a CRLF mess
Author admin | 23.06.2008 | Category Developers, WeSay
When initializing from WeSay’s Subversion repository, (git svn init -t tags -b branches -T trunk http://www.wesay.org/code/WeSay) I found that I was then told that I had a ton of files that had changed. Turns out on Windows, git has core.autocrlf = true by default — a good thing. But git-svn apparently doesn’t take this into account and if you have crlf’s stored in the svn repository, they will be pushed into the git repository as well. So for now we have a repository that has crlf’s in it instead of just lf’s which get translated depending on the platform. Setting core.autocrlf to false and then doing a hard reset will make this work for now, although not as nicely as we would like. (git config core.autocrlf=false; git reset –hard)
Merging with git
Author admin | 12.06.2008 | Category Developers, WeSay
Git still doesn’t have good unicode support so to merge unicode files that git has labeled binary, I wanted to use a visual merger. Finally figured out how to do it — add the following lines to config:
[merge] tool = tortoise [mergetool "tortoise"] cmd = \"TortoiseMerge.exe\" /base:\"$BASE\" /theirs:\"$REMOTE\" /mine:\"$LOCAL\" /merged:\"$MERGED\" [mergetool "p4"] cmd = \"p4merge.exe\" \"$BASE\" \"$REMOTE\" \"$LOCAL\" \"$MERGED\"
If you don’t have TortoiseMerge.exe in your path then you can replace that with the full path (c:/Program Files/TortoiseSVN/bin/TortoiseMerge.exe).
Upgrading user settings in C#
Author Tim | 10.06.2008 | Category Developers, WeSay
In the course of development we found it necessary to migrate an old user setting into a new one and to then remove it. This brought with it a few problems which I hope to shed some light on below.
In order to get the value of the old setting we used the Property.Settings.GetPreviousVersion() method. Initially we were getting a SettingsPropertyNotFoundException() although the setting was verifiably present in the user.config file. As it turns out we had removed the Property from the Settings designer which removed the Property in the Property.Settings class. In order for Settings to be found, they have to have a property that is tagged with the [UserScopedSettingAttribute] attribute. This tells the GetPreviousVersion() method to look for the setting in user.config. So far so good…
At this point however, the base.Upgrade() method is called to move old settings into the new file. This causes the old, unwanted setting to be moved in right along with all the old settings that we want to keep around. In order to avoid this behavior the [NoSettingsVersionUpgrade] attribute must also be used for the unwanted Property.
public override void Upgrade()
{
string lastConfigFilePath = (string) GetPreviousVersion(”LastConfigFilePath”);
base.Upgrade(); // bring forward our properties that are the
// same (but also will bring forward LastConfigFilePath)
}
[UserScopedSettingAttribute]
[DebuggerNonUserCode]
[DefaultSettingValueAttribute(”")]
[Obsolete(”Please use MruConfigFilePaths instead”)]
[NoSettingsVersionUpgrade]
public string LastConfigFilePath
{
get
{
throw new NotSupportedException(”LastConfigFilePath is obsolete”);
}
set
{
throw new NotSupportedException(”LastConfigFilePath is obsolete”);
}
}
Categories
- Blogroll (2)
- Chorus (3)
- Developers (19)
- Dictionary (4)
- FLEx (4)
- Linux (4)
- OurWord (3)
- Palaso Library (3)
- Solid (13)
- Spelling (5)
- Typesetting (3)
- Uncategorized (4)
- WeSay (40)
Archives
- May 2013
- January 2013
- March 2011
- January 2011
- June 2010
- February 2010
- January 2010
- August 2009
- June 2009
- May 2009
- April 2009
- January 2009
- August 2008
- June 2008
- May 2008
- April 2008
- March 2008
- February 2008
- January 2008
- December 2007
- November 2007
- October 2007
- September 2007
- August 2007
- July 2007
- June 2007
- May 2007
- April 2007