Commits

Michael Gatto  committed 1f18945

* Support setting the revision to archive as an optional argument to archive().

  • Participants
  • Parent commits 0b95785

Comments (0)

Files changed (2)

File Trunk/Tests/Functional/test_Archive.php

 
 $hg = new VersionControl_Hg('H:\Development\_Webroot\Trunk\Tests\Fixtures\Test_Repository');
 
+$hg->archive('tip')->to(realpath('H:\Development\_Webroot\Trunk\Tests\Fixtures'))->with('zip')->run();
 $hg->archive()->revision('tip')->to(realpath('H:\Development\_Webroot\Trunk\Tests\Fixtures'))->with('zip')->run();
-
 $hg->archive(array('revision' => 'tip', 'to' => realpath('H:\Development\_Webroot\Trunk\Tests\Fixtures')))->with('gzip')->run();
-
 $hg->archive(array('revision' => 'tip', 'to' => realpath('H:\Development\_Webroot\Trunk\Tests\Fixtures'), 'with' => 'bzip2'))->run();
-
-/*
-$hg->connect()->to('127.0.0.1')->by('ssh')->using('username', 'password')->run();
-$hg->archive('tip')->to('/home/myself/releases/')->with('gzip');
-*/

File Trunk/VersionControl/Hg/Command/Archive.php

          * semantic and "fluidic", that I can't give them up. Thus: */
         if ( array_key_exists(0, $params) ) {
             /* sometimes $params is not an array! */
-            foreach ( $params[0] as $key => $value ) {
-                switch ($key) {
-                    case 'revision':
-                    case 'to':
-                    case 'with':
-                    case 'prefix':
-                        $this->$key($value);
-                        break;
-                    default:
-                    /* default is to just ignore unkown ones */
-                        break;
+            if ( is_scalar($params[0]) ) {
+                /* we assume its a revision, like 'tip' or 7, etc */
+                $this->revision($params[0]);
+            } else {
+                foreach ( $params[0] as $key => $value ) {
+                    switch ($key) {
+                        case 'revision':
+                        case 'to':
+                        case 'with':
+                        case 'prefix':
+                            $this->$key($value);
+                            break;
+                        default:
+                        /* default is to just ignore unkown ones */
+                            break;
+                    }
                 }
             }
         }