rakelib/scm.rb
changeset 102 fc572bd895f2
parent 88 112075e99cef
child 117 f163911eb7bc
--- a/rakelib/scm.rb	Mon Dec 12 22:43:48 2016 +0000
+++ b/rakelib/scm.rb	Tue Dec 13 13:33:24 2016 +0000
@@ -158,10 +158,7 @@
         paths['canonical'] = "#{repository.canonical}/#{directory.gsub('/', separator)}"
         hg.paths = paths
       end
-      hg.pull('default')
-      if paths['default'] != paths['canonical'] then
-        hg.pull('canonical')
-      end
+      hg.pull('canonical')
       # If revision is not specified, then look for an active bookmark
       # and update to it. If no bookmark is active, then look for bookmark
       # `master`. If it exist, then update to `master`. If it 
@@ -258,7 +255,12 @@
     separator = kwargs[:separator] || '.'
     revision =  kwargs[:revision] 
     
-    paths = { 'canonical' => "#{repository.canonical}/#{directory.gsub('/', separator)}" }            
+    paths = {}
+    if repository.canonical then
+      paths['canonical'] = "#{repository.canonical}/#{directory.gsub('/', separator)}"
+    else
+      raise Exception.new("Repository named #{repository.name} does not define mandatory canonical repository URL")
+    end
     if repository.upstream then
       paths['upstream'] = "#{repository.upstream}/#{directory.gsub('/', separator)}"
     end
@@ -266,7 +268,6 @@
       paths['staging'] = "#{repository.staging}/#{directory.gsub('/', separator)}"
     end
 
-    
     begin
       if repository.staging then
         paths['default'] = paths['staging']
@@ -280,6 +281,7 @@
         hg.paths = paths
         hg.pull('canonical')
       else
+        paths['default'] = paths['canonical']
         hg = HG::Repository.clone(paths['canonical'], root / directory, noupdate: true)
         hg.paths = paths
       end