66 "os"
77 "os/exec"
88 "path/filepath"
9+ "runtime"
910 "strings"
1011 "time"
1112)
@@ -76,9 +77,13 @@ func (s *SvnRepo) Get() error {
7677 remote := s .Remote ()
7778 if strings .HasPrefix (remote , "/" ) {
7879 remote = "file://" + remote
80+ } else if runtime .GOOS == "windows" && filepath .VolumeName (remote ) != "" {
81+ remote = "file:///" + remote
7982 }
8083 out , err := s .run ("svn" , "checkout" , remote , s .LocalPath ())
8184 if err != nil {
85+ fmt .Println (string (out ))
86+ fmt .Println (err .Error ())
8287 return NewRemoteError ("Unable to get repository" , err , string (out ))
8388 }
8489 return nil
@@ -183,8 +188,8 @@ func (s *SvnRepo) Date() (time.Time, error) {
183188 if err != nil {
184189 return time.Time {}, NewLocalError ("Unable to retrieve revision date" , err , string (out ))
185190 }
186- const longForm = "2006-01-02T15:04:05.000000Z\n "
187- t , err := time .Parse (longForm , string (out ))
191+ const longForm = "2006-01-02T15:04:05.000000Z"
192+ t , err := time .Parse (longForm , strings . TrimSpace ( string (out ) ))
188193 if err != nil {
189194 return time.Time {}, NewLocalError ("Unable to retrieve revision date" , err , string (out ))
190195 }
@@ -193,14 +198,24 @@ func (s *SvnRepo) Date() (time.Time, error) {
193198
194199// CheckLocal verifies the local location is an SVN repo.
195200func (s * SvnRepo ) CheckLocal () bool {
196- sep := fmt .Sprintf ("%c" , os .PathSeparator )
197- psplit := strings .Split (s .LocalPath (), sep )
198- for i := 0 ; i < len (psplit ); i ++ {
199- path := fmt .Sprintf ("%s%s" , sep , filepath .Join (psplit [0 :(len (psplit )- (i ))]... ))
200- if _ , err := os .Stat (filepath .Join (path , ".svn" )); err == nil {
201+ pth , err := filepath .Abs (s .LocalPath ())
202+ if err != nil {
203+ s .log (err .Error ())
204+ return false
205+ }
206+
207+ if _ , err := os .Stat (filepath .Join (pth , ".svn" )); err == nil {
208+ return true
209+ }
210+
211+ oldpth := pth
212+ for oldpth != pth {
213+ pth = filepath .Dir (pth )
214+ if _ , err := os .Stat (filepath .Join (pth , ".svn" )); err == nil {
201215 return true
202216 }
203217 }
218+
204219 return false
205220}
206221
0 commit comments