public
Description: Piston is a utility that eases vendor branch management. This repository is a complete reimplementation of Piston to provide different backends, depending on the repositories and working copies you pistonize from.
Homepage: http://piston.rubyforge.org/
Clone URL: git://github.com/francois/piston.git
Search Repo:
Updated logging, and made the --verbose flag really mean something.
francois (author)
Mon Mar 24 21:13:11 -0700 2008
commit  f072ac8ebaaff7803e10c7b0d77475cd1fd5875a
tree    39bb112382f104ba658fdfe6af0f850a4c86ecd1
parent  02a591a67bc50e748ef1dad08674f579b75c2565
...
94
95
96
97
 
98
99
100
101
 
 
 
102
103
104
 
 
105
106
107
 
 
108
109
...
94
95
96
 
97
98
 
 
 
99
100
101
102
 
 
103
104
105
 
 
106
107
108
109
0
@@ -94,17 +94,17 @@
0
   end
0
 
0
   def configure_logging!
0
- Log4r::Logger.root.level = Log4r::DEBUG
0
+ Log4r::Logger.root.level = Log4r::ALL
0
 
0
- Log4r::Logger.new("main", Log4r::DEBUG)
0
- Log4r::Logger.new("handler", Log4r::DEBUG)
0
- Log4r::Logger.new("handler::client", Log4r::DEBUG)
0
+ Log4r::Logger.new("main")
0
+ Log4r::Logger.new("handler")
0
+ Log4r::Logger.new("handler::client")
0
 
0
- Log4r::StderrOutputter.new("console", :level => Log4r::WARN)
0
- Log4r::StdoutOutputter.new("main", :level => params["verbose"].value ? Log4r::DEBUG : Log4r::INFO)
0
+ Log4r::StderrOutputter.new("stderr", :level => Log4r::WARN)
0
+ Log4r::StdoutOutputter.new("stdout", :level => params["verbose"].value ? Log4r::DEBUG : Log4r::INFO)
0
 
0
- Log4r::Logger["main"].add "console", "main"
0
- Log4r::Logger["handler"].add "console", "main"
0
+ Log4r::Logger["main"].add "stdout", "stderr"
0
+ Log4r::Logger["handler"].add "stdout", "stderr"
0
   end
0
 }
...
11
12
13
14
 
15
16
17
...
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
...
11
12
13
 
14
15
16
17
...
28
29
30
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
32
33
0
@@ -11,7 +11,7 @@
0
 
0
       def initialize(options={})
0
         @options = options
0
- debug {"#{self.class.name} with options #{options.inspect}"}
0
+ logger.debug {"#{self.class.name} with options #{options.inspect}"}
0
       end
0
 
0
       def verbose
0
@@ -28,26 +28,6 @@
0
 
0
       def logger
0
         self.class.logger
0
- end
0
-
0
- def debug(msg=nil)
0
- logger.debug { msg || yield }
0
- end
0
-
0
- def info(msg=nil)
0
- logger.info { msg || yield }
0
- end
0
-
0
- def warn(msg=nil)
0
- logger.warn { msg || yield }
0
- end
0
-
0
- def error(msg=nil)
0
- logger.error { msg || yield }
0
- end
0
-
0
- def fatal(msg=nil)
0
- logger.fatal { msg || yield }
0
       end
0
     end
0
   end
...
10
11
12
 
13
14
15
16
17
 
 
18
19
20
21
22
23
24
25
26
...
22
23
24
 
25
 
 
26
 
 
27
 
 
28
 
 
29
 
 
30
31
 
32
33
34
...
10
11
12
13
14
15
16
17
 
18
19
20
21
22
23
24
25
26
27
28
...
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
 
44
45
46
47
0
@@ -10,11 +10,13 @@
0
       end
0
 
0
       def run(repository_url, target_revision, wcdir)
0
+ logger.info {"Guessing the repository type"}
0
         repository = Piston::Repository.guess(repository_url)
0
         revision = repository.at(target_revision)
0
 
0
         wcdir = wcdir.nil? ? repository.basename : wcdir
0
- debug {"repository_url: #{repository_url.inspect}, target_revision: #{target_revision.inspect}, wcdir: #{wcdir.inspect}"}
0
+ logger.info {"Guessing the working copy type"}
0
+ logger.debug {"repository_url: #{repository_url.inspect}, target_revision: #{target_revision.inspect}, wcdir: #{wcdir.inspect}"}
0
         working_copy = Piston::WorkingCopy.guess(wcdir)
0
 
0
         tmpdir = temp_dir_name(working_copy)
0
0
0
0
0
0
0
@@ -22,13 +24,24 @@
0
         abort("Path #{working_copy} already exists and --force not given. Aborting...") if working_copy.exist? && !force
0
 
0
         begin
0
+ logger.info {"Checking out the repository"}
0
           revision.checkout_to(tmpdir)
0
+
0
+ logger.debug {"Creating the local working copy"}
0
           working_copy.create
0
+
0
+ logger.info {"Copying from #{revision}"}
0
           working_copy.copy_from(revision)
0
+
0
+ logger.debug {"Remembering values"}
0
           working_copy.remember({:lock => options[:lock]}, revision.remember_values)
0
+
0
+ logger.debug {"Finalizing working copy"}
0
           working_copy.finalize
0
+
0
+ logger.info {"Checked out #{repository_url.inspect} #{revision.name} to #{wcdir.inspect}"}
0
         ensure
0
- debug {"Removing temporary directory: #{tmpdir}"}
0
+ logger.debug {"Removing temporary directory: #{tmpdir}"}
0
           tmpdir.rmtree rescue nil
0
         end
0
       end
...
15
16
17
 
 
 
 
18
19
20
...
15
16
17
18
19
20
21
22
23
24
0
@@ -15,6 +15,10 @@
0
         client.git(*args)
0
       end
0
 
0
+ def name
0
+ commit[0,7]
0
+ end
0
+
0
       def checkout_to(dir)
0
         @dir = dir
0
         git(:clone, repository.url, @dir)
...
14
15
16
 
 
 
 
17
18
19
...
14
15
16
17
18
19
20
21
22
23
0
@@ -14,6 +14,10 @@
0
       @repository, @revision = repository, revision
0
     end
0
 
0
+ def name
0
+ @revision
0
+ end
0
+
0
     def logger
0
       self.class.logger
0
     end
...
12
13
14
 
 
 
 
15
16
17
...
12
13
14
15
16
17
18
19
20
21
0
@@ -12,6 +12,10 @@
0
         client.svn(*args)
0
       end
0
 
0
+ def name
0
+ "r#{revision}"
0
+ end
0
+
0
       def checkout_to(path)
0
         @wcpath = path.kind_of?(Pathname) ? path : Pathname.new(path)
0
         answer = svn(:checkout, "--revision", revision, repository.url, path)
...
4
5
6
7
8
9
10
11
12
13
14
...
4
5
6
 
 
 
 
 
7
8
9
0
@@ -4,11 +4,6 @@
0
   def setup
0
     @wc = stub_everything("working_copy")
0
     @cmd = Piston::Commands::Import.new
0
- @cmd.stubs(:debug)
0
- @cmd.stubs(:info)
0
- @cmd.stubs(:warn)
0
- @cmd.stubs(:error)
0
- @cmd.stubs(:fatal)
0
   end
0
 
0
   def test_temp_dir_name_hides_tmpdir_as_a_dotfile_and_suffixes_with_tmp

Comments

    No one has commented yet.