Updating an Orchard clone from 1.5 to 1.x and later.

Tags: orchard, mercurial, subrepository, english

As you may or may not yet know, Orchard source code repository has recently undergone slight refactoring. Namely - subrepositories for core modules are no more!UĊ›miech It’s really happy news for all of us working with Orchard source on daily basis - it means saving a lot of time when doing source code pulls and pushes.

If you’ve ever tried working with couple of Orchard forks sitting as subrepos in some bigger repository you should know what I mean. And if you haven’t – believe me – waiting tens of minutes for your push to go through (if everything goes well, of course) can drive you nuts! Especially when e.g. your colleague did a push at the same time and you end up having to merge his changes and… losing another 15 minutes for pushing your merge in. Aaaargh!

That being said – it’s awesome we don’t have those nasty subrepos now and everything sits in a single repo. But unfortunately, Mercurial does not like it as much as we do... Removing a subrepository in one changeset and then re-adding files in exactly the same path, but committed to the main repo instead, will prevent you from performing update between changesets from before and after subrepo removal. You should then see error message like this:

abort: path 'src\Orchard.Web\Modules\Orchard.Alias\AdminMenu.cs' is inside nested repo 'src\\Orchard.Web\\Modules\\Orchard.Alias'

There are two solutions depending on whether you are doing a fresh clone or have some existing repository you need to update.

Fresh clone

This is the simpler scenario. You just need to specify the revision to clone to (id of one of the changesets after subrepo removal):



Updating existing repository

This is a bit more complex, as it involves two updates plus manually removing some of the folders. Make sure you have a clean working directory, so please commit all uncommitted code before moving forward.

  1. Update to revision 7022b5c4b309. This is when the subrepos were removed. Open up command-line in your repository folder and type:
    hg pull --force https://hg.codeplex.com/orchard
    hg update --rev 7022b5c4b309
  2. Remove all subrepo leftovers. Once again, command-line will become handy:
    rd /S /Q ".\src\Orchard.Web\Modules\Orchard.Alias"
    rd /S /Q ".\src\Orchard.Web\Modules\Orchard.AntiSpam"
    rd /S /Q ".\src\Orchard.Web\Modules\Orchard.Autoroute"
    rd /S /Q ".\src\Orchard.Web\Modules\Orchard.ContentPicker"
    rd /S /Q ".\src\Orchard.Web\Modules\Orchard.CustomForms"
    rd /S /Q ".\src\Orchard.Web\Modules\Orchard.ContentPermissions"
    rd /S /Q ".\src\Orchard.Web\Modules\Orchard.Forms"
    rd /S /Q ".\src\Orchard.Web\Modules\Orchard.Fields"
    rd /S /Q ".\src\Orchard.Web\Modules\Orchard.Projections"
    rd /S /Q ".\src\Orchard.Web\Modules\Orchard.Rules"
    rd /S /Q ".\src\Orchard.Web\Modules\Orchard.TaskLease"
    rd /S /Q ".\src\Orchard.Web\Modules\Orchard.Tokens"
  3. Update to head of the 1.x branch. We’re good now, so just do an update to the most recent code from 1.x branch. Simple as calling:
    hg update 1.x

Note: If you are working on your custom branch and instead of updating to 1.x you need to pull changes from 1.x to your branch (merge), the steps are similar. You need to merge with changeset 7022b5c4b309, remove all leftovers and then merge with the initial target changeset.

blog comments powered by Disqus