Altium Version Control With Mercurial

Overview

Although Altium Designer 10 (AD10) incorporates it’s own proprietary collaborate, compare and merge feature, you may still want another version control system to manage your entire project (since your project is not likely just going to consist of Altium files. I recommend using Mercurial (see the Version Control Systems page). Below is a recommended Mercurial ignore file for any project containing Altium files to exclude all the junk that Altium creates.

This code prevents the following files and folders from being version controlled:

  • /*.SchDocPreview – A recent image of the schematic document, used to display a preview of the file at times such as when you hover the mouse over the project in the project window
  • /*.PcbDocPreview – Same as SchDocPreview, except for the PCB file
  • /*.TxtPreview – Ditto, except for a txt files
  • /*.errPreview – Ditto, except for simulation error files
  • /*.nsxPreview – Ditto, except for simulation netlist files
  • <AltiumProjectRoot>/*.LOG – Log files are pretty pointless, you don’t want to commit these! I made sure that
  • /History – This folder contains zip files of previous versions of the SchDoc and PcbDoc files. These could potentially be helpful id you ever wanted to revert back to an old state, but since your now using Mercurial for version control, these shouldn’t be needed if you remember to commit regularly!
  • /ProjectOutputs – ‘Output’ files that Altium creates when you do something like create a BOM

As you may of noticed, I make sure that the files are inside the Altium project root directory before excluding them. This is a safety feature incase you have files in the same repository of the same extension that aren’t Altium’s. I know that the chances of finding a SchDocPreview out side of Altium is next to none, but you might have log or html files that you want in the repository, and without this safety catch they will get excluded also. This however makes the ignore file less generic, as you have to make sure thatcorresponds to the project directory for each repository you use it for. One way to get around this is to standardize your Altium project folder name (e.g. PCB). In this case,will become PCB. Note that every excluded file type has to have two entries, one to exclude any files in the root directory and one to exclude the file if it exists in any sub-directories. I haven’t been able to work out how to condense this into one line with glob syntax. However, I still highly recommend using the glob syntax, it is conceptually simpler to understand and this glob code is tested and completed to a higher degree the RegExp syntax that is below it.

Using Glob Syntax

Using RegExp Syntax

# Mercurial ignore file for Altium using RegExp syntax.
# Note: I currently use glob syntax since it makes more common sense than the regexp syntax and is powerful enough for what I need.
# Note: therefore this RegExp code is not complete nor fully tested. Only use it as a guide to how the code is written.

# Note: Replace with the name of the folder all your Altium files are stored in,
# relative to the repository root directory (e.g. PCB)

# switch to regexp syntax.
syntax: regexp

xworking/(?!.*\.bit$).+
temp/.*$

/.*\.HarnessPreview
/.*\.PcbDocPreview
/.*\.SchDocPreview
/.*\.nsxPreview
/.*\.errPreview
<AltiumProjectRoot>/.*\.LOG
<AltiumProjectRoot>/.*\.pcblib_viewstate
<AltiumProjectRoot>/.*\.pcbdoc_viewstate
/.*\.PrjPcbStructure
/.*\.drc
<AltiumProjectRoot>/.*\.html
<AltiumProjectRoot>/.*History/.*\.Zip$

Posted: September 15th, 2011 at 7:35 pm
Last Updated on: January 16th, 2012 at 9:40 am

  • Evgeniy.V Veselov

    Думал, что это статья про эмуляцию SVN на Mercurial сервере под Altium Designer :(((
    Ну, а если через hg commit, то мне больше нравится так:

    syntax: glob
    *.bak
    *.tmp
    *.SchDoc.Zip
    *.pcbdoc.Zip
    *.PrjPcb.Zip
    *.Zip
    *.err
    *.lnk
    *.log
    *.htm
    *.html

    syntax: regexp
    ^.{0,355}Gerber.{0,355}/
    ^.{0,355}History/
    ^.{0,355}__Previews/
    ^.{0,355}Project Outputs.{0,355}/
    ^.{0,355}Project Logs.{0,355}/
    ^.{0,355}__Previews/