LoginSignup
2
1

More than 5 years have passed since last update.

Subversion ファイルの最初のコミットの日時をまとめて調べる

Last updated at Posted at 2015-12-04

需要はさておき・・・

既存システムの追加改修をリリースするにあたって、

改修のあったファイルが既存への影響がある元からのファイルか、今回開発のために新規で追加されたファイルかをザックリ調べたかった。

svn logをしつつ、リビジョンを昇順にソートして、一番古いリビジョンを取り出し、そのレコードの日付部分とファイル名をechoするだけのスクリプト。

シェルスクリプトでも良かったのだが、例はPHPでのサンプル。

sample.php
<?php

$files = array(
// 調べたいファイル ,
);

foreach ($files as $k => $v)
{
    $log = shell_exec("svn log ". $v ." | egrep '^r[1-9]' | uniq | sort | awk 'NR==1' | egrep -o '[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}'");
    echo $v . "\t" .  $log;
}

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1