Re: Report: removing the inconsistencies in our CVS->git conversion - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Report: removing the inconsistencies in our CVS->git conversion
Date
Msg-id 4791.1284913556@sss.pgh.pa.us
Whole thread Raw
In response to Re: Report: removing the inconsistencies in our CVS->git conversion  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Report: removing the inconsistencies in our CVS->git conversion
List pgsql-hackers
I wrote:
> I looked a bit more at your pggit_migrate stuff.  I'm not terribly happy
> with the proposed clean_keywords.pl script.  I'd like it to reduce the
> $PostgreSQL$ thingies to the full pathname of the file, rather than
> try to remove all trace of them, eg
>  *      $PostgreSQL: pgsql/src/port/unsetenv.c,v 1.12 2010/09/07 14:10:30 momjian Exp $
> becomes
>  *      src/port/unsetenv.c

> This would then be followed up by moving those pathname comments to
> somewhere more sensible.  I don't think that part can be managed with
> a script like this, but leaving the data in place will make it easier
> to do the moving.  Some places, like the .sgml files, won't need any
> additional changing to get to where I would like to be.

> Also, I'd be inclined to make these changes only in master, not in the
> back branches.  We don't for example run pg_indent against back branches.

Pursuant to that, attached are proposed modified versions of the two
scripts involved.

            regards, tom lane

#!/usr/bin/perl -w

#
# Attempt to remove all cvs keywords in the given directory tree
# (with "all keywords" meaning $PostgreSQL$ keyword)
#
# We don't want to change line numbers, so we simply reduce the keyword
# string to the file pathname part.  For example,
# $PostgreSQL: pgsql/src/port/unsetenv.c,v 1.12 2010/09/07 14:10:30 momjian Exp $
# becomes
# $PostgreSQL: pgsql/src/port/unsetenv.c,v 1.12 2010/09/07 14:10:30 momjian Exp $
#


$REPODIR=$ARGV[0] || die "No repository specified\n";

chdir($REPODIR) || die "Could not chdir to $REPODIR\n";
open(L,"git grep -l \\\$PostgreSQL |") || die "Could not git-grep\n";
while (<L>) {
   chomp;
   my $fn = $_;
   my $txt;
   open(F,"<$fn") || die "Could not read $_\n";
   while (<F>) {
      s|\$PostgreSQL: pgsql/(\S+),v [^\$]+\$|$1|;
      $txt .= $_;
   }
   close(F);
   open(F,">$fn") || die "Could not write $_\n";
   print F $txt;
   close(F);
   $txt = '';
}
#!/bin/bash

set -e
REPO=/opt/gitrepo_cvs2git
HERE=$(pwd)

# clean master only
BRANCHES="master"

cd $REPO

for B in $BRANCHES ; do
   if [ "$B" != "master" ]; then
      echo Creating branch $B
      git branch -f $B --track origin/$B
   fi
   echo Switching to $B
   git checkout $B
   echo Cleaning $B
   perl $HERE/clean_keywords.pl $REPO
   echo Committing cleanup
   git commit -a -F - <<EOF
Remove cvs keywords from all files.
EOF
done

echo "All branches updated, don't forget to push!"


pgsql-hackers by date:

Previous
From: Kevin Grittner
Date:
Subject: Re: Serializable Snapshot Isolation
Next
From: Tom Lane
Date:
Subject: So where did that $Id$ come from?