<commit_before>module Mercurial
  
  class Repository
    
    attr_reader :path
    
    def self.create(destination)
      init_repository(destination)      
      open(destination)
    end
    
    def self.open(destination)
      if File.exists?(destination)
        new(destination)
      else
        raise Mercurial::RepositoryNotFound.new(destination)
      end
    end
    
    def initialize(source)
      @path = source
    end
    
    def config
      @_config ||= Mercurial::ConfigFile.new(self)
    end
    
    def hooks
      @_hook_factory ||= Mercurial::HookFactory.new(self)
    end
    
    def commits
      @_commits ||= Mercurial::CommitFactory.new(self)
    end
    
    def branches
      @_branches ||= Mercurial::BranchFactory.new(self)
    end
    
    def tags
      @_tags ||= Mercurial::TagFactory.new(self)
    end
    
    def diffs
      @_diffs ||= Mercurial::DiffFactory.new(self)
    end
    
    def destroy!
      FileUtils.rm_rf(path)
    end
    
  protected
  
    def self.init_repository(destination)
      Mercurial::Shell.run("mkdir -p #{ destination }")
      Mercurial::Shell.hg('init', :in => destination)
    end
    
  end
  
end<commit_msg>Init bare repository.<commit_after>module Mercurial
  
  class Repository
    
    attr_reader :path
    
    def self.create(destination)
      init_repository(destination)      
      open(destination)
    end
    
    def self.open(destination)
      if File.exists?(destination)
        new(destination)
      else
        raise Mercurial::RepositoryNotFound.new(destination)
      end
    end
    
    def initialize(source)
      @path = source
    end
    
    def config
      @_config ||= Mercurial::ConfigFile.new(self)
    end
    
    def hooks
      @_hook_factory ||= Mercurial::HookFactory.new(self)
    end
    
    def commits
      @_commits ||= Mercurial::CommitFactory.new(self)
    end
    
    def branches
      @_branches ||= Mercurial::BranchFactory.new(self)
    end
    
    def tags
      @_tags ||= Mercurial::TagFactory.new(self)
    end
    
    def diffs
      @_diffs ||= Mercurial::DiffFactory.new(self)
    end
    
    def destroy!
      FileUtils.rm_rf(path)
    end
    
  protected
  
    def self.init_repository(destination)
      Mercurial::Shell.run("mkdir -p #{ destination }")
      Mercurial::Shell.hg('init', :in => destination)
      Mercurial::Shell.hg('update null', :in => destination)
    end
    
  end
  
end
{'fraction_non_alphanumeric': 0.09613034623217923, 'fraction_numerical': 0.0, 'mean_word_length': 2.1649484536082473, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3723778', 'n_tokens_mistral': 782, 'n_tokens_neox': 780, 'n_words': 149}