# Telling Gnu Arch the truth

Yet another problem (and solution) that I’ve stumbled across while using Gnu Arch. We have two branches in our archive: `program--vendor--0.1` and `program--local--0.1`. Vendor’s version has all the source files in `SomeDirectory`, while our local version has all source files in `somedir`. Except for the name and few local changes, these two directories are practically identical.

But when we were creating branches and importing code, we weren’t very careful and ended up with these directories and files having different arch IDs. This makes comparing two source trees close to impossible, as arch thinks that directory `SomeDirectory` was removed together with all its content and directory `somedir` was added together with a bunch of files.

Telling Arch the truth is very simple. Basically, all that needs to be done is `=id` and `*.id` files under all `.arch-ids/` directories in one source tree should be copied to the appropriate places in the other source tree. After that `tla commit` should be done.

In order to minimize the pain of manual labour, I wrote a tiny perl script to find all needed files and copy them appropriately. On the command line just specify two directories, which you know are the same, but which arch considers different. If any of the files weren’t copied, you’ll get their names in the warning. When script finishes, you’ll get the total count of copied files.

The script is here: fix_arch_ids.pl