0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

SVNで差分をパスと値の2つが一覧で確認するためのコード

Last updated at Posted at 2025-06-09

✅ 前提条件
TortoiseSVN ではなく、コマンドライン SVN が使用できる環境(例: svn コマンドが PowerShell で動く)

PowerShell が使える Windows 環境

🔧 手順概要
PowerShell を起動

スクリプトを貼り付けて実行

svn diff の結果を処理して、CSV ファイル svn_diff_output.csv に出力

🪟 手順詳細
✅ ステップ1:PowerShell の起動
Windows + R キー を押して powershell と入力し Enter

または「スタート」→「Windows PowerShell」を右クリック →「管理者として実行」

✅ ステップ2:対象の作業コピーディレクトリに移動

cd "C:\path\to\your\svn\working_copy"

C:\path\to\your\svn\working_copy は、SVN 管理下のローカルフォルダ(例: C:\projects\myrepo)に置き換えてください。

✅ ステップ3:以下の PowerShell スクリプトをコピペして実行

Copy code
$diff = svn diff
$results = @()
$currentFile = ""

foreach ($line in $diff) {
    if ($line -match '^Index: (.+)$') {
        $currentFile = $Matches[1].Trim()
    } elseif ($line -match '^[-+](?![-+])(.+)$') {
        $change = $Matches[1].Trim()
        $prefix = $line.Substring(0,1)
        $results += [PSCustomObject]@{
            Path = $currentFile
            Value = "$prefix $change"
        }
    }
}

# CSV出力(デスクトップ上に出力される例)
$csvPath = "$env:USERPROFILE\Desktop\svn_diff_output.csv"
$results | Export-Csv -Path $csvPath -NoTypeInformation
Write-Host "CSVが出力されました: $csvPath"

✅ ステップ4:出力確認
デスクトップに svn_diff_output.csv が作成されており、Excel などで開くと以下のような形で表示されます:

image.png

0
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
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?