Permalink
Browse files

Don't remerge an up-to-date file

  • Loading branch information...
1 parent 0c3b22a commit 6efff37fe60f33fd12ff797dbae71ec0f5550da2 @jferris jferris committed Sep 21, 2010
Showing with 25 additions and 3 deletions.
  1. +16 −1 features/sync_gemfile.feature
  2. +9 −2 lib/trout/managed_file.rb
@@ -51,4 +51,19 @@ Feature: sync a Gemfile between two repositories
gem "postgresql"
>>>>>>> .trout/upstream
"""
-
+ When I write to "Gemfile" with:
+ """
+ source "http://rubygems.org"
+ gem "rails"
+ gem "mysql"
+ gem "redcloth"
+ """
+ When I run "trout update Gemfile"
+ And I run "cat Gemfile"
+ Then the output should contain:
+ """
+ source "http://rubygems.org"
+ gem "rails"
+ gem "mysql"
+ gem "redcloth"
+ """
@@ -19,7 +19,10 @@ def copy_from(git_url)
def update
checkout(previous_git_url)
- merge_to_destination
+ unless up_to_date?
+ merge_to_destination
+ write_url_and_version
+ end
ensure
cleanup
end
@@ -76,7 +79,7 @@ def write_url_and_version
end
def checked_out_version
- git_command("rev-parse HEAD")
+ git_command("rev-parse master")
end
def checkout_last_version
@@ -95,6 +98,10 @@ def previous_git_version
version_list.version_for(filename)
end
+ def up_to_date?
+ previous_git_version == checked_out_version
+ end
+
def version_list
@version_list ||= VersionList.new(working('versions'))
end

0 comments on commit 6efff37

Please sign in to comment.