Module: Amp::Core::Repositories::CommonVersionedFileMethods

Included in:
AbstractVersionedFile
Defined in:
lib/amp-core/repository/abstract/common_methods/versioned_file.rb

Overview

CommonVersionedFileMethods

These methods are common to all repositories, and this module is mixed into the AbstractLocalRepository class. This guarantees that all repositories will have these methods.

No methods should be placed into this module unless it relies on methods in the general API for repositories.

Instance Method Summary collapse

Instance Method Details

#===(other) ⇒ Boolean

Compares two versioned files - namely, their data.

Parameters:

  • other (VersionedFile)

    what to compare to

Returns:

  • (Boolean)

    true if the two are the same



42
43
44
45
# File 'lib/amp-core/repository/abstract/common_methods/versioned_file.rb', line 42

def ===(other)
  self.path == other.path &&
  self.data == other.data
end

#branchString

The branch this tracked file belongs to

Returns:

  • (String)


79
# File 'lib/amp-core/repository/abstract/common_methods/versioned_file.rb', line 79

def branch; changeset.branch; end

#childrenObject

Working directory has no children!



83
# File 'lib/amp-core/repository/abstract/common_methods/versioned_file.rb', line 83

def children; []; end

#clean?Boolean

Returns if the file has been changed since its parent. Slow. If your implementation has a fast way of doing this, we recommend you override this method.

Returns:

  • (Boolean)

    has the file been changed since its parent?



52
53
54
# File 'lib/amp-core/repository/abstract/common_methods/versioned_file.rb', line 52

def clean?
  self === parents.first
end

#dateDateTime

Date this revision to this file was committed

Returns:

  • (DateTime)


67
# File 'lib/amp-core/repository/abstract/common_methods/versioned_file.rb', line 67

def date; changeset.date; end

#descriptionString

The description of the commit that contained this file revision

Returns:

  • (String)


73
# File 'lib/amp-core/repository/abstract/common_methods/versioned_file.rb', line 73

def description; changeset.description; end

#unified_diff_with(other_vf, opts = {}) ⇒ Object



30
31
32
33
34
35
# File 'lib/amp-core/repository/abstract/common_methods/versioned_file.rb', line 30

def unified_diff_with(other_vf, opts = {})    
  Diffs::Mercurial::MercurialDiff.unified_diff(self.data, self.changeset.easy_date, 
                                               other_vf.data, other_vf.changeset.easy_date,
                                               self.path, other_vf.path || "/dev/null", 
                                               false, opts)
end

#userString

User who committed this revision to this file

Returns:

  • (String)

    the user



61
# File 'lib/amp-core/repository/abstract/common_methods/versioned_file.rb', line 61

def user; changeset.user; end