<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -45,8 +45,12 @@ module SourceControl
       Git::LogParser.new.parse(git_output).first
     end
 
-    def update(revision)
-      git(&quot;reset&quot;, [&quot;--hard&quot;, revision.number])
+    def update(revision = nil)
+      if revision
+        git(&quot;reset&quot;, [&quot;--hard&quot;, revision.number])
+      else
+        git(&quot;reset&quot;, [&quot;--hard&quot;])
+      end
     end
 
     def up_to_date?(reasons = [])</diff>
      <filename>lib/source_control/git.rb</filename>
    </modified>
    <modified>
      <diff>@@ -35,9 +35,13 @@ module SourceControl
       Mercurial::LogParser.new.parse(hg_output).first 
     end
 
-    def update(revision)
+    def update(revision = nil)
       pull_new_changesets
-      hg(&quot;update&quot;, ['-r', revision.number])
+      if revision
+        hg(&quot;update&quot;, ['-r', revision.number])
+      else
+        hg(&quot;update&quot;)
+      end
     end
 
     def up_to_date?(reasons = [])</diff>
      <filename>lib/source_control/mercurial.rb</filename>
    </modified>
    <modified>
      <diff>@@ -23,6 +23,14 @@ class SourceControl::GitTest &lt; Test::Unit::TestCase
     end
   end
 
+  def test_update_with_no_revision
+    in_sandbox do
+      git = new_git
+      git.expects(:git).with(&quot;reset&quot;, [&quot;--hard&quot;])
+      git.update
+    end
+  end
+
   def test_up_to_date?_should_return_false_if_there_are_new_revisions
     in_sandbox do
       git = new_git</diff>
      <filename>test/unit/source_control/git_test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -30,6 +30,23 @@ module SourceControl
       end
     end
 
+    def test_update
+      in_sandbox do
+        stub_revision = stub('revision', :number =&gt; '12345')
+        @mercurial.expects(:hg).with('pull')
+        @mercurial.expects(:hg).with('update', ['-r', '12345'])
+        assert_nothing_raised { @mercurial.update(stub_revision) }
+      end
+    end
+
+    def test_update_with_no_revision_specified
+      in_sandbox do
+        @mercurial.expects(:hg).with('pull')
+        @mercurial.expects(:hg).with('update')
+        assert_nothing_raised { @mercurial.update }
+      end
+    end
+
     # TODO tests for other public methods of this class
 
   end</diff>
      <filename>test/unit/source_control/mercurial_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>916f9060d2ee2ef8a753aafda16baf306dd33fd7</id>
    </parent>
  </parents>
  <author>
    <name>Alexey Verkhovsky</name>
    <email>alexey.verkhovsky@gmail.com</email>
  </author>
  <url>http://github.com/willbryant/cruisecontrolrb/commit/363b8ba5496777da8f60c7223a28115a68b9e345</url>
  <id>363b8ba5496777da8f60c7223a28115a68b9e345</id>
  <committed-date>2008-06-05T10:24:31-07:00</committed-date>
  <authored-date>2008-06-05T10:24:31-07:00</authored-date>
  <message>update() without revision for Git and Mercurial (used by Project to recover from a failure after reloading cruise_config.rb)</message>
  <tree>9c29c45f1317f51f92ba4a1c52d4fa7e5716b1bd</tree>
  <committer>
    <name>Alexey Verkhovsky</name>
    <email>alexey.verkhovsky@gmail.com</email>
  </committer>
</commit>
