lib/rudy/scm/svn.rb in rudy-0.6.8 vs lib/rudy/scm/svn.rb in rudy-0.7.0
- old
+ new
@@ -10,11 +10,11 @@
@base_uri = args[:base]
end
def create_release(username=nil, msg=nil)
local_uri, local_revision = local_info
- rtag = generate_release_tag_name(username)
+ rtag = find_next_rtag(username)
release_uri = "#{@base_uri}/#{rtag}"
msg ||= 'Another Release by Rudy!'
msg.tr!("'", "\\'")
cmd = "svn copy -m '#{msg}' #{local_uri} #{release_uri}"
@@ -22,25 +22,25 @@
release_uri
end
def switch_working_copy(tag)
- raise "Invalid release tag (#{tag})." unless valid_uri?(tag)
+ raise "Invalid release tag (#{tag})." unless valid_rtag?(tag)
`svn switch #{tag}`
end
# rel-2009-03-05-user-rev
- def generate_release_tag_name(username=nil)
+ def find_next_rtag(username=nil)
now = Time.now
mon = now.mon.to_s.rjust(2, '0')
day = now.day.to_s.rjust(2, '0')
rev = "01"
criteria = ['rel', now.year, mon, day, rev]
criteria.insert(-2, username) if username
tag = criteria.join(Rudy::DELIM)
# Keep incrementing the revision number until we find the next one.
- tag.succ! while (valid_uri?("#{@base_uri}/#{tag}"))
+ tag.succ! while (valid_rtag?("#{@base_uri}/#{tag}"))
tag
end
def local_info
ret = `svn info 2>&1`
@@ -53,15 +53,16 @@
def working_copy?(path)
(File.exists?(File.join(path, '.svn')))
end
- def valid_uri?(uri)
+ def valid_rtag?(uri)
ret = `svn info #{uri} 2>&1` || '' # Valid SVN URIs will return some info
(ret =~ /Repository UUID/) ? true : false
end
- def everything_checked_in?
+ # Are all local changes committed?
+ def clean_working_copy?
`svn diff . 2>&1` == '' # svn diff should return nothing
end
end
end
end
\ No newline at end of file