Monday, 24 October 2011

Migrating from Subversion to Mercurial

This is an alternative way of migrating from SVN to Mercurial using HgSubversion as oppose to using convert extension. It allows you to push changes from local Mercurial repository to both Subversion and Mercurial during the transition period.

  • Install HgSubversion

hg clone <local-path>\hgsubversion

  • Add HgSubversion extension to your main hgrc file

hgsubversion = <local-path>\hgsubversion\hgsubversion

  • Clone existing subversion repository

hg clone http://<username>@<svn-project-path> <local-project-folder>

  • Edit project .hgrc file (/hg/.hgrc)

default = http://<username>@<hg-remote-project-path>
svn = http://<username>@<svn-project-path>

  • Create new mercurial project in your remote Hg repository (see Rhodecode)
  • Pushing the project to remote mercurial repository

hg push

  • Pushing to subversion

hg push svn

If you’re using mercurial_keyring extension to store Hg passwords and your Svn username is the same as Hg one you need to have the same password for both.

Tuesday, 18 October 2011

Save window size & position in WPF

* Right Click on Settings.settings and Open With XML (Text) Editor

* Add Top, Left, Height, Width & WindowState settings

  <Setting Name="Top" Type="System.Double" Scope="User">
    <Value Profile="(Default)">50</Value>
  <Setting Name="Left" Type="System.Double" Scope="User">
    <Value Profile="(Default)">50</Value>
  <Setting Name="Height" Type="System.Double" Scope="User">
    <Value Profile="(Default)">800</Value>
  <Setting Name="Width" Type="System.Double" Scope="User">
    <Value Profile="(Default)">1200</Value>
  <Setting Name="WindowState" Type="System.Windows.WindowState" Scope="User">
    <Value Profile="(Default)">Normal</Value>
* Add Settings property to App.xml
    <properties:Settings x:Key="Settings" />
* Add OnExit override to persist the settings when exiting application
protected override void OnExit(ExitEventArgs e)
* Add Top, Left, Height, Width & WindowState bindings to your MainWindow
<Window x:Class="TestApp.MainWindow"
  Top="{Binding Source={StaticResource Settings}, Path=Default.Top, Mode=TwoWay}"
  Left="{Binding Source={StaticResource Settings}, Path=Default.Left, Mode=TwoWay}"
  Width="{Binding Source={StaticResource Settings}, Path=Default.Width, Mode=TwoWay}"
  Height="{Binding Source={StaticResource Settings}, Path=Default.Height, Mode=TwoWay}"
  WindowState="{Binding Source={StaticResource Settings}, Path=Default.WindowState}">