svn:keywords expansion in "hg convert"

Giorgos Keramidas keramida at ceid.upatras.gr
Tue Aug 12 09:29:20 CDT 2008


Hi all,

Has anyone tried adding svn:keywords expansion to the svn source of the
convert extension?

I've been using `convert' to track changes in the main svn repository of
FreeBSD since svn-1.5.X support for "hg convert" was added, and we use
the `svn:keywords' to expand $FreeBSD$ in some of the sources, i.e.:

  % svn pget svn:keywords file:///home/svn/base/head/Makefile
  FreeBSD=%H

  % svn cat file:///home/svn/base/head/Makefile | fgrep '$FreeBSD:'
  # $FreeBSD: head/Makefile 179845 2008-06-17 11:08:49Z bz $

  %

Right now, a converted tree from svn->hg doesn't have any keyword
expansion.  This means that for all the files that have $FreeBSD$
keywords in the main svn repository I get diffs like this between a
version checked out from svn and one checked out from hg:

  % svn cat file:///home/svn/base/head/Makefile > /tmp/Makefile.orig
  % cp /hg/bsd/src/Makefile /tmp/Makefile
  % diff -u /tmp/Makefile.orig /tmp/Makefile
  --- /tmp/Makefile.orig  2008-08-12 17:19:40.000000000 +0300
  +++ /tmp/Makefile       2008-08-12 17:19:42.000000000 +0300
  @@ -1,5 +1,5 @@
   #
  -# $FreeBSD: head/Makefile 179845 2008-06-17 11:08:49Z bz $
  +# $FreeBSD$
   #
   # The user-driven targets are:
   #
  %

Mercurial doesn't really need the expanded form to work, but when the
source is compiled and installed, some of the tools of FreeBSD (most
notably `mergemaster'[1]) try to look for the svn revision in the
installed source to see if there are updates/diffs.

[1] http://www.freebsd.org/cgi/man.cgi?query=mergemaster

Another probably useful side effect of getting this sort of expansion
when pulling changes from FreeBSD's svn is that when there's a bug in
the FreeBSD source, looking at the sources imported into Hg would point
pretty easily to the svn revision where the bug started appearing.

It would probably be nice if there was some way to get the `expanded'
form of a file when "hg convert" runs.  The default behavior would
naturally be the same as now, but are there any objections to adding an
option like the following?

    --config convert.svn.keywords=False       (boolean)
        expand svn:keywords when they are set

Does this sound like the `right thing' to aim for?  Does anyone else
have a better idea about how this should fit into "hg convert"?

Giorgos



More information about the Mercurial-devel mailing list