ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/svn2cvs/svn2cvs
(Generate patch)

Comparing svn2cvs (file contents):
Revision 1.1 by yakumo_izuru, Mon Sep 30 00:29:31 2024 UTC vs.
Revision 1.6 by nishi, Thu Oct 17 10:08:53 2024 UTC

# Line 11 | Line 11 | set rev "[lindex $argv 3]"
11   set old "[pwd]"
12   set log [exec svn log --incremental "$svn" -r "$rev" | tail -n1]
13  
14 + set added ""
15 + set removed ""
16 + set added_dir ""
17 +
18   exec -ignorestderr svn up "$svn" -r "$rev"
19   exec -ignorestderr cvs up -d "$cvs"
20  
21   proc rescan {path prefix} {
22 <        global svn cvs cache old
22 >        global svn cvs cache old added added_dir
23          foreach name [glob -tails -nocomplain -directory "$path" *] {
24                  if { [file type "$path/$name"] == "directory" } {
25                          if { ! [file exists "$cvs/$prefix/$name"] } {
26                                  file mkdir "$cvs/$prefix/$name"
27                                  file mkdir "$cache/$prefix/$name"
28                                  cd "$cvs"
29 <                                exec -ignorestderr cvs add "[string range "$prefix/$name" 1 [string length "$prefix/$name"]]"
29 >                                lappend added_dir "[string range "$prefix/$name" 1 [string length "$prefix/$name"]]"
30                                  cd "$old"
31                          }
32                          rescan "$path/$name" "$prefix/$name"
# Line 36 | Line 40 | proc rescan {path prefix} {
40                                  file copy -force "$path/$name" "$cvs/$prefix/$name"
41                                  file copy -force "$path/$name" "$cache/$prefix/$name"
42                                  cd "$cvs"
43 <                                exec -ignorestderr cvs add "[string range "$prefix/$name" 1 [string length "$prefix/$name"]]"
43 >                                lappend added "[string range "$prefix/$name" 1 [string length "$prefix/$name"]]"
44                                  cd "$old"
45                          } else {
46                                  set hash1 [::sha2::sha256 -hex -filename "$path/$name"]
# Line 54 | Line 58 | proc rescan {path prefix} {
58   }
59  
60   proc remove_left {path prefix} {
61 <        global svn cvs cache old
61 >        global svn cvs cache old removed
62          foreach name [glob -tails -nocomplain -directory "$path" *] {
63                  if { [file type "$path/$name"] == "directory" } {
64                          if { "$name" != "CVS" } {
# Line 64 | Line 68 | proc remove_left {path prefix} {
68                          if { [file exists "$cvs/$prefix/$name"] && ![file exists "$svn/$prefix/$name"] } {
69                                  cd "$cvs"
70                                  file delete "[string range "$prefix/$name" 1 [string length "$prefix/$name"]]"
71 <                                exec -ignorestderr cvs rm "[string range "$prefix/$name" 1 [string length "$prefix/$name"]]"
71 >                                lappend removed "[string range "$prefix/$name" 1 [string length "$prefix/$name"]]"
72                                  cd "$old"
73                                  file delete "$cache/$prefix/$name"
74  
# Line 77 | Line 81 | rescan "$svn" ""
81   remove_left "$cvs" ""
82  
83   cd "$cvs"
84 + if { "$added_dir" != "" } {
85 +        eval exec -ignorestderr cvs add \"[join $added_dir "\" \""]\" >/dev/stdout 2>@1
86 + }
87 + if { "$added" != "" } {
88 +        eval exec -ignorestderr cvs add \"[join $added "\" \""]\" >/dev/stdout 2>@1
89 + }
90 + if { "$removed" != "" } {
91 +        eval exec -ignorestderr cvs rm \"[join $removed "\" \""]\" >/dev/stdout 2>@1
92 + }
93   exec -ignorestderr cvs ci -m "$log"
94   cd "$old"
95  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines