Bug #919

tool/file2lastrev.rbでエラー

Added by tad (Tadashi Saito) over 3 years ago. Updated about 1 year ago.

[ruby-dev:37555]
Status:Closed Start date:12/23/2008
Priority:Normal Due date:
Assignee:yugui (Yuki Sonoda) % Done:

100%

Category:-
Target version:2.0.0
ruby -v:

Description

ソースと違うディレクトリでtrunkをmakeしようとすると、
tool/file2lastrev.rbでエラーが出てmakeできません。

$ make
ruby ../tool/file2lastrev.rb --revision.h ".." > "../revision.h.tmp"
svn: '.' is not a working copy
../tool/file2lastrev.rb:34:in `get_revisions': last revision not found (RuntimeError)
	from ../tool/file2lastrev.rb:70
make: *** [../revision.h] エラー 1

一応下ので直りましたが、汎用性があるのか正直自信がありません。

Index: tool/file2lastrev.rb
===================================================================
--- tool/file2lastrev.rb        (revision 20922)
+++ tool/file2lastrev.rb        (working copy)
@@ -10,8 +10,8 @@

   path = target_path.directory? ? target_path : target_path.parent  
   begin
-    return :svn, target_path.relative_path_from(path) if File.directory?("#{path}/.svn")
-    return :git, target_path.relative_path_from(path) if File.directory?("#{path}/.git")
+    return :svn, target_path.relative_path_from(Pathname.pwd) if File.directory?("#{path}/.svn")
+    return :git, target_path.relative_path_from(Pathname.pwd) if File.directory?("#{path}/.git")
     path, orig = path.parent, path
   end until path == orig
   raise VCSNotFoundError, "does not seem to be under a vcs"

Associated revisions

Revision 20936
Added by yugui (Yuki Sonoda) over 3 years ago

* tool/file2lastrev.rb: detects vcs directory properly on building outside of srcdir. [ruby-dev:37555] [ruby-dev:37561]

History

Updated by ko1 (Koichi Sasada) over 3 years ago

 ささだです.

Tadashi Saito wrote::
> 一応下ので直りましたが、汎用性があるのか正直自信がありません。

 私はよくわかんなかったので,簡単にしてみました.でも,なんでフルパスに
するんだろう.

Index: tool/file2lastrev.rb
===================================================================
--- tool/file2lastrev.rb        (リビジョン 20922)
+++ tool/file2lastrev.rb        (作業コピー)
@@ -6,12 +6,15 @@
 class VCSNotFoundError < RuntimeError; end

 def detect_vcs(path)
-  target_path = Pathname(File.expand_path(path))
+  # target_path = Pathname(File.expand_path(path))
+  #
+  # path = target_path.directory? ? target_path : target_path.parent
+  #
+  path = Pathname(File.dirname($0)).parent

-  path = target_path.directory? ? target_path : target_path.parent
   begin
-    return :svn, target_path.relative_path_from(path) if
File.directory?("#{pat
          h}/.svn")
-    return :git, target_path.relative_path_from(path) if
File.directory?("#{pat
          h}/.git")
+    return :svn, path if File.directory?("#{path}/.svn")
+    return :git, path if File.directory?("#{path}/.git")
     path, orig = path.parent, path
   end until path == orig
   raise VCSNotFoundError, "does not seem to be under a vcs"

-- 
// SASADA Koichi at atdot dot net

Updated by yugui (Yuki Sonoda) over 3 years ago

Yuguiです。

すみません。私のバグです。

On 12/23/08 7:12 AM, SASADA Koichi wrote:
> Pathname(File.dirname($0)).parent

あ、そうか。これで行けそうです。ありがとうございます。

-- 
Yugui <yugui@yugui.jp>
http://yugui.jp
私は私をDumpする

Updated by yugui (Yuki Sonoda) over 3 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100
Applied in changeset r20936.

Also available in: Atom PDF