Commits

Michael Gatto  committed 7d08b63

* Prevent unset options from issuing a Php notice when getOption() is called to look for it. Explicitly returning null is better.

  • Participants
  • Parent commits f2655ce

Comments (0)

Files changed (1)

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

         }
 
         /* Sort options so a files list is the last
-         * This method is the fastest; 300 X better than a uksort() */
+         * array_key_exists() is the fastest; 300 X better than a uksort() */
         if ( array_key_exists('files', $options) ) {
+            /*  */
             $files = $options['files'];
             unset($options['files']);
+
+            /* handle files as an array; useful mostly for 'clone' */
+            if ( is_array($files)) {
+                $files = join(' ', $files);
+            }
+
             /* Null key, since we want just a list without a --files argument.
              * A blank key like [] will give a cli option of --0 */
             $options[null] = $files;
      * @param string $name The name of the option we are getting
      */
     public function getOption($name) {
-        return $this->options[$name];
+        $value = null;
+
+        /* with 'files', sometimes it may not exist when called for */
+        if ( isset($this->options[$name]) ) {
+            $value = $this->options[$name];
+        }
+
+        return $value;
     }
 
     /**