Blog of Leonid Mamchenkov

You just stepped in a pile of posts.

Entries Tagged as 'Version_Control'

Finding the tree version in the working directory

Posted in All on June 16th, 2005 · 2 Comments

When using Gnu Arch, once in a while I need to verify that I am in the correct working directory. With long names, patches, and all those branches it is not always that obvious. The shortest way to find the version of the tree in the current working directory is:

tla logs -rf | head -1

→ 2 CommentsTags: , ,

Telling Gnu Arch the truth

Posted in All on June 15th, 2005 · 2 Comments

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

→ 2 CommentsTags: , , , ,

The magic of tla cacherev

Posted in All on June 15th, 2005 · No Comments

I’ve stumbled upon an annoying problem while use Gnu Arch. During the development process, one of the directories in the source tree was given bad permissions (r-xr-x-rx). With the next patch, this directory was removed altogether. That introduced a problem for tla get as it was dying with permission denied error. That happens because when tla get is executed, it gets the base-0 tree version and then applies patch-1, patch-2, … patch-N in order. Obviously, when it gets to the patch which tries to remove the directory, it fails with “permission denied” error.

The fix for this problem turned out to be very simple. tla get can be executed with user root. It won’t fail as root has enough permissions to remove the directory. But what root can also do is tla cacherev project--branch--version--patch-X. This will force arch to pack the whole tree at patch-X into the archive and use it as a unit. So, next time when someone will tla get the tree version greater or equal to patch-X, he will get it straight ahead, without all the pacthing (except for the those paches that follow patch-X).

After tla cacherev all users can execute tla get without any problems.

This technique can also be used to save some time on the tla get operation in those cases where lots of patching needs to be done.

→ No CommentsTags: , ,

Recursively adding files and directories in Gnu Arch

Posted in All on June 3rd, 2005 · 1 Comment

One of the little annoyances of Gnu Arch is that it does not add files and directories recursively. Not to worry, though. Here is a little shell script that can assist with that task:

#!/bin/bash

# Find all files and directories, skipping ./{arch}
for FILE in `find . -path './{arch}' -prune -o -print`
do
        # Get rid of the leading ./
        FILE=`echo $FILE | sed -e 's/\.\///'`
        tla add "$FILE"
done

Skipping the script itself is left as an exercise to the reader.

Update: Simplier method indeed is

tla inventory --source --names | xargs tla add

→ 1 CommentTags: , , ,

Subversion vs. Gnu Arch

Posted in All on June 1st, 2005 · 4 Comments

I’ve spent some time today fighting with both Subversion and Gnu Arch. After the first few battles, it was decided that Subversion is not going to be used for the project, and that we’d go with Gnu Arch instead. There were three reasons for that.

  • Subversion is a pain to install. Especially on older machines. It requires a whole bunch of libraries and static compilation is not that easy. Gnu Arch is a charm to install.
  • Subversion does not keep owners/permissions information about files and directories. Gnu Arch does so.
  • Subversion does not support distributed development, which is practically a must in our case. Gnu Arch does so easily.

If you are confused about distributed development term above, here’s what I mean. We have bought a piece of software. We want to do some customizations and additional functionality development internally. Meanwhile, we also bought an upgrade plan, and it turned out that the vendor is releasing patches pretty often. Merging our internal development with vendor patches on a regular basis can be a real pain in the bottom, unless software version control system supports it natively. Gnu Arch does so and hence we’ll use it for the project.

But Gnu Arch is not perfect aswell. One of the things that we want to keep in the repository is the complete source package from the vendor. The source package consists of a couple of thousand files in few hundred directories. Files come in all variety - ZIP archives, GIF and PNG images, MS Word, PDF, RTF, and plain text documentation, PHP source code files, HTML pages, and so on, and so forth. Importing all these stuff into Gnu Arch repository turned out to be, well, slightly more difficult than it should have been.

For now, I’ll leave you on your own and give you some time to write a bash script for importing of such a source tree. You can post it in the comments. You have time until I will finish with my script some time tomorrow. I will post it here than.

Update: I decided to create a new post with the script.

→ 4 CommentsTags: , ,