lib/rscm/base.rb in rscm-0.3.4 vs lib/rscm/base.rb in rscm-0.3.5
- old
+ new
@@ -18,10 +18,11 @@
# * diff
# * edit
# * move
# * revisions
# * uptodate?
+ # * file
#
# In addition to operations related to working copies, the same instance should provide
# methods to administer the working copy's associated 'central' repository. These are:
#
# * central_exists?
@@ -75,12 +76,18 @@
# might dead lock on this. Implement a guard for that.
# TODO: Add some visitor support here too?
public
- attr_accessor :checkout_dir
+ def checkout_dir=(dir)
+ @checkout_dir = PathConverter.filepath_to_nativepath(dir, false)
+ end
+ def checkout_dir
+ @checkout_dir
+ end
+
def to_yaml_properties
props = instance_variables
props.delete("@checkout_dir")
props.sort!
end
@@ -142,11 +149,11 @@
end
# Commit (check in) modified files.
def commit(message)
end
-
+
# Checks out or updates contents from a central SCM to +checkout_dir+ - a local working copy.
# If this is a distributed SCM, this method should create a 'working copy' repository
# if one doesn't already exist. Then the contents of the central SCM should be pulled into
# the working copy.
#
@@ -184,13 +191,14 @@
end
relative_added_file_paths
end
# Returns a Revisions object for the period specified by +from_identifier+ (exclusive, i.e. after)
- # and +to_identifier+ (inclusive).
+ # and +to_identifier+ (inclusive). If +relative_path+ is specified, the result will only contain
+ # revisions pertaining to that path.
#
- def revisions(from_identifier, to_identifier=Time.infinity)
+ def revisions(from_identifier, to_identifier=Time.infinity, relative_path=nil)
# Should be overridden by subclasses
revisions = Revisions.new
revisions.add(
Revision.new(
"up/the/chimney",
@@ -203,9 +211,14 @@
"999",
Time.now.utc
)
)
revisions
+ end
+
+ # Returns a HistoricFile for +relative_path+
+ def file(relative_path)
+ HistoricFile.new(relative_path, self)
end
# Whether the working copy is in synch with the central
# repository's revision/time identified by +identifier+.
# If +identifier+ is nil, 'HEAD' of repository should be assumed.