Anonymous avatar Anonymous committed 5ec321c

* Added 'between' method.

This operates on revisions, not dates as Log::between() does.

Comments (0)

Files changed (1)

Trunk/VersionControl/Hg/Command/Status.php

      */
     public function revision($revision = 'tip')
     {
-        //@TODO Technically, the following shouldn't occur since 'tip' is default
-        if ( empty($revision)) {
-            throw new VersionControl_Hg_Command_Exception(
-                VersionControl_Hg_Command_Exception::BAD_ARGUMENT
-            );
-        }
-
         $this->addOption('rev', $revision);
 
         /* For the fluent API */
         return $this;
     }
+
+    /**
+     * Restricts status output to changesets between two revisions $from and $to
+     *
+     * Usage:
+     * <code>$hg->status()->between(3, 17)->run();</code>
+     *
+     * @param string $from Show status entries from this revision forward through $to
+     * @param string $to   Show status entries only before this revision
+     *
+     * @return VersionControl_Hg_Command_Log
+     */
+    public function between($from = 0, $to = 'tip')
+    {
+        $this->addOption('rev', $from);
+        $this->addOption('rev', $to);
+
+        /* For the fluent API */
+        return $this;
+    }
 }
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.