Alien-SVN

 view release on metacpan or  search on metacpan

src/subversion/subversion/bindings/swig/ruby/svn/core.rb  view on Meta::CPAN

        file.print(source)
        file.close
        Core.io_parse_mimetypes_file(file.path)
      end

      def parse_file(path)
        Core.io_parse_mimetypes_file(path)
      end

      def detect(path, type_map={})
        Core.io_detect_mimetype2(path, type_map)
      end
    end

    class CommitInfo
      alias _date date
      def date
        Time.from_svn_format(_date)
      end
    end

    # Following methods are also available:
    #
    # [action]
    #   Returns an action taken to the path at the revision.
    # [copyfrom_path]
    #   If the path was added at the revision by the copy action from
    #   another path at another revision, returns an original path.
    #   Otherwise, returns +nil+.
    # [copyfrom_rev]
    #   If the path was added at the revision by the copy action from
    #   another path at another revision, returns an original revision.
    #   Otherwise, returns <tt>-1</tt>.
    class LogChangedPath
      # Returns +true+ when the path is added by the copy action.
      def copied?
        Util.copy?(copyfrom_path, copyfrom_rev)
      end
    end

    # For backward compatibility
    class Prop
      attr_accessor :name, :value
      def initialize(name, value)
        @name = name
        @value = value
      end

      def ==(other)
        other.is_a?(self.class) and
          [@name, @value] == [other.name, other.value]
      end
    end

    class MergeRange
      def to_a
        [self.start, self.end, self.inheritable]
      end

      def inspect
        super.gsub(/>$/, ":#{to_a.inspect}>")
      end

      def ==(other)
        to_a == other.to_a
      end
    end

    class MergeInfo < Hash
      class << self
        def parse(input)
          new(Core.mergeinfo_parse(input))
        end
      end

      def initialize(info)
        super()
        info.each do |path, ranges|
          self[path] = RangeList.new(*ranges)
        end
      end

      def diff(to, consider_inheritance=false)
        Core.mergeinfo_diff(self, to, consider_inheritance).collect do |result|
          self.class.new(result)
        end
      end

      def merge(changes)
        self.class.new(Core.swig_mergeinfo_merge(self, changes))
      end

      def remove(eraser)
        self.class.new(Core.mergeinfo_remove(eraser, self))
      end

      def sort
        self.class.new(Core.swig_mergeinfo_sort(self))
      end

      def to_s
        Core.mergeinfo_to_string(self)
      end
    end

    class RangeList < Array
      def initialize(*ranges)
        super()
        ranges.each do |range|
          self << Svn::Core::MergeRange.new(*range.to_a)
        end
      end

      def diff(to, consider_inheritance=false)
        result = Core.rangelist_diff(self, to, consider_inheritance)
        deleted = result.pop
        added = result
        [added, deleted].collect do |result|
          self.class.new(*result)
        end
      end



( run in 0.649 second using v1.01-cache-2.11-cpan-df04353d9ac )