From: Andrew Chilton <andychilton@gmail.com>
Date: Sat, 23 Jan 2010 12:34:42 +0000 (+1300)
Subject: Make the steal and edit commands do --add and --commit
X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=f862194c863b62eee336f141defb1e0fd3861a24;p=cil.git

Make the steal and edit commands do --add and --commit
---

diff --git a/lib/CIL/Command/Edit.pm b/lib/CIL/Command/Edit.pm
index dcb1d92..f5dacc7 100644
--- a/lib/CIL/Command/Edit.pm
+++ b/lib/CIL/Command/Edit.pm
@@ -35,7 +35,7 @@ my $y = 'y';
 sub name { 'edit' }
 
 sub run {
-    my ($self, $cil, undef, $issue_name) = @_;
+    my ($self, $cil, $args, $issue_name) = @_;
 
     my $issue = CIL::Utils->load_issue_fuzzy( $cil, $issue_name );
 
@@ -64,6 +64,17 @@ sub run {
 
     # save it
     $issue->save($cil);
+
+    # if we want to add or commit this issue
+    if ( $args->{add} or $args->{commit} ) {
+        $cil->vcs->add( $cil, $issue );
+    }
+
+    # if we want to commit this issue
+    if ( $args->{commit} ) {
+        $cil->vcs->commit( $cil, $issue );
+    }
+
     CIL::Utils->display_issue($cil, $issue);
 }
 
diff --git a/lib/CIL/Command/Steal.pm b/lib/CIL/Command/Steal.pm
index 901926e..d86f549 100644
--- a/lib/CIL/Command/Steal.pm
+++ b/lib/CIL/Command/Steal.pm
@@ -40,7 +40,17 @@ sub run {
     $issue->AssignedTo( CIL::Utils->user($cil) );
     $issue->save($cil);
 
-    CIL::Utils->display_issue($cil, $issue);
+    # if we want to add or commit this issue
+    if ( $args->{add} or $args->{commit} ) {
+        $cil->vcs->add( $cil, $issue );
+    }
+
+    # if we want to commit this issue
+    if ( $args->{commit} ) {
+        $cil->vcs->commit( $cil, $issue );
+    }
+
+    CIL::Utils->display_issue_full($cil, $issue);
 }
 
 1;