Permalink
Browse files

Adding reset command

  • Loading branch information...
1 parent 2fcedab commit fc841a43b4387e20fda765eb15edbcddaf910ab7 @winton committed Jan 26, 2012
Showing with 45 additions and 1 deletion.
  1. +13 −0 README.md
  2. +21 −0 features/gitcycle.feature
  3. +4 −0 features/steps/gitcycle_steps.rb
  4. +7 −1 lib/gitcycle.rb
View
@@ -19,6 +19,19 @@ Type `gitc` + your ticket URL to create a new branch:
gitc https://xxx.lighthouseapp.com/projects/0000/tickets/0000-my-ticket
+Reset Branch
+------------
+
+If you associate the wrong branch with a ticket, use `git reset` to fix it.
+
+Checkout the branch that you will eventually merge your feature into:
+
+ git checkout master
+
+Type `gitc reset` + your ticket URL to reset the branch:
+
+ gitc reset https://xxx.lighthouseapp.com/projects/0000/tickets/0000-my-ticket
+
Pull Changes from Upstream
--------------------------
View
@@ -62,6 +62,27 @@ Scenario: Feature branch
"""
And redis entries valid
+Scenario: Reset feature branch
+ Given a fresh set of repositories
+ When I cd to the user repo
+ And I execute gitcycle reset with the Lighthouse ticket URL
+ And I enter "y"
+ And I enter "y"
+ Then gitcycle runs
+ And output includes
+ """
+ Retrieving branch information from gitcycle.
+ Your work will eventually merge into 'master'. Is this correct? (y/n)
+ Would you like to name your branch 'ticket.id'? (y/n)
+ Adding remote repo 'config.owner/config.repo'.
+ Fetching remote repo 'config.owner/config.repo'.
+ Checking out remote branch 'ticket.id' from 'config.owner/config.repo/master'.
+ Pulling 'origin/ticket.id'.
+ Pushing 'origin/ticket.id'.
+ Sending branch information to gitcycle.
+ """
+ And redis entries valid
+
Scenario: Checkout via ticket w/ existing branch
When I cd to the user repo
And I execute gitcycle with the Lighthouse ticket URL
@@ -143,6 +143,10 @@ def type(text)
$execute << $ticket.url
end
+When /^I execute gitcycle reset with the Lighthouse ticket URL$/ do
+ $execute << "reset #{$ticket.url}"
+end
+
When /^I cd to the (.*) repo$/ do |user|
if ENV['REPO']
puts "(overiding repo as #{ENV['REPO']})"
View
@@ -35,7 +35,7 @@ def initialize(args=nil)
start(args) if args
end
- def create_branch(url_or_title)
+ def create_branch(url_or_title, reset=false)
require_git && require_config
params = {}
@@ -53,6 +53,8 @@ def create_branch(url_or_title)
}
end
+ params['reset'] = '1' if reset
+
puts "\nRetrieving branch information from gitcycle.\n".green
branch = get('branch', params)
@@ -283,6 +285,10 @@ def ready(*issues)
end
end
+ def reset(ticket_or_url)
+ create_branch(ticket_or_url, true)
+ end
+
def reviewed(*issues)
require_git && require_config

0 comments on commit fc841a4

Please sign in to comment.