query stringlengths 7 9.55k | document stringlengths 10 363k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Simulate working for given time. `softcover check` is more satisfying if it looks like it's doing work. | def simulate_work(time)
return
sleep time unless Softcover::test?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_120_tasks_every_second_with_ms_task\n min_time = 1\n rl = @testClass.new 120, min_time\n delta = timed_run(rl) { sleep 0.001 }\n # puts \"\\n#{delta} >? #{min_time}\"\n assert((delta / min_time) > TIMING_TOLERANCE)\n end",
"def fake_cycles\n return if test?\n sleep(rand(0.25..0.75)... | [
"0.6607848",
"0.64222926",
"0.61008805",
"0.60743266",
"0.60478574",
"0.5982164",
"0.597985",
"0.59465206",
"0.59358597",
"0.5927469",
"0.5912231",
"0.5912231",
"0.5891085",
"0.58636737",
"0.58589154",
"0.5848832",
"0.5848128",
"0.5810851",
"0.5800614",
"0.57938194",
"0.57804... | 0.849172 | 0 |
Initialize a new instance of Drud::Readme ==== Attributes +:path+ The local path of the site cookbooks ==== Examples This can be placed in a convenient location, such as a Rake task inside the cookbook. When the render method is called, it will overwrite the cookbooks README.md readme = Drud::Readme.new(File.dirname(__... | def initialize(path)
@path = File.expand_path(path)
@cookbooks = load_cookbooks
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(path)\n @path = path\n\n base = path.empty? ? docroot : \"#{docroot}/#{path}\"\n\n if File.directory? base\n @file = \"#{base}/README.md\"\n @dir = base\n @type = :readme\n elsif File.exist? \"#{base}.md\"\n @file = \"#{base}.md\"\n @dir = Fil... | [
"0.74435145",
"0.68895984",
"0.6786456",
"0.6676949",
"0.66068584",
"0.66068584",
"0.6547596",
"0.6536943",
"0.65090936",
"0.6501539",
"0.6461521",
"0.6283595",
"0.62257147",
"0.61746484",
"0.60859996",
"0.6082265",
"0.607781",
"0.6019502",
"0.60172665",
"0.60075617",
"0.5995... | 0.62468815 | 12 |
Renders the README.md file and saves it in the cookbooks path. | def render
markdown = ReadmeTemplate.new(
metadata: @metadata, tasks: @tasks, credit: @credit
)
template_path = File.join(
File.dirname(File.expand_path(__FILE__)),
'../../templates/readme.md.erb'
)
readme = markdown.render(File.read(template_path))
File.open(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def about\n require \"github/markup\"\n @readme = GitHub::Markup.render(\"README.md\", File.read(\"README.md\")).html_safe\n end",
"def readme\n\tsystem('touch README.md')\n\tfile = File.open('README.md', 'w')\n\tfile.puts('this project is written in the ruby computer science language')\n\tfile.puts('more... | [
"0.7821056",
"0.752415",
"0.74221045",
"0.7234142",
"0.7119548",
"0.7039448",
"0.70284534",
"0.6807393",
"0.6759776",
"0.6759776",
"0.6759776",
"0.66320735",
"0.6617426",
"0.66126215",
"0.6429813",
"0.64192826",
"0.64192826",
"0.6398799",
"0.63737166",
"0.6330257",
"0.6288600... | 0.7844976 | 0 |
Generates a hash of all site cookbook metadata by cookbook folder name | def load_cookbooks # :doc:
_cookbooks = Hash.new
Dir.glob(File.join(@path, '*/*.rb')).each do |cb_metadata|
cb_path = File.dirname(cb_metadata)
cb_name = File.basename(cb_path)
_cookbooks[cb_name] = [
'path' => cb_path,
'metadata' => load_metadata(cb_metadata)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def path_hash(path)\n if File.exist?(path)\n %x{\n { cd cookbooks;\n export LC_ALL=C;\n find #{path} -type f -exec md5sum {} + | sort; echo;\n find #{path} -type d | sort;\n find #{path} -type d | sort | md5sum;\n } | md5sum\n }.split(' '... | [
"0.6187479",
"0.58582",
"0.5809342",
"0.57981104",
"0.5686569",
"0.5631453",
"0.560211",
"0.55998725",
"0.556693",
"0.555725",
"0.55250025",
"0.5510208",
"0.5485188",
"0.5481834",
"0.5473502",
"0.54346687",
"0.5434389",
"0.54248405",
"0.5400804",
"0.53994167",
"0.53964883",
... | 0.53195304 | 26 |
Reads the cookbooks metadata and instantiates an instance of Chef::Cookbook::Metadata | def load_metadata(cb_metadata) # :doc:
metadata = Chef::Cookbook::Metadata.new
metadata.from_file(cb_metadata)
metadata
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def metadata_info\n @metadata = Chef::Cookbook::Metadata.new\n @metadata.from_file(File.join(@opts[:path], 'metadata.rb'))\n end",
"def metadata\n return @metadata unless @metadata.nil?\n\n @metadata = Chef::Cookbook::Metadata.new\n\n metadata_filenames.each do |metadata_file|\n... | [
"0.822205",
"0.8025285",
"0.77749336",
"0.77509594",
"0.6554114",
"0.6532105",
"0.64755946",
"0.64411414",
"0.6252243",
"0.6237839",
"0.61432165",
"0.6101496",
"0.60990125",
"0.60877407",
"0.6085581",
"0.60716546",
"0.60703343",
"0.6068285",
"0.5990023",
"0.5988461",
"0.59884... | 0.8386515 | 0 |
Private: Refreshes all settings from 'app.yml' for every request (no app restarts required). Provides a global 'App' constant holding projectwide settings. | def _reload_app_yml
App::build_settings_hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_app_setting\n @app_setting = AppSetting.settings\n end",
"def reload\n # reload the app file\n load(config.app.path)\n\n # reset config\n envs = config.app.loaded_envs\n config.reset\n\n # reload config\n self.class.load_config(*envs)\n\n load_app\n end"... | [
"0.6965878",
"0.6784682",
"0.6587794",
"0.6471645",
"0.6447967",
"0.64222944",
"0.63725215",
"0.63674283",
"0.62613213",
"0.62072885",
"0.60345364",
"0.59957206",
"0.5981245",
"0.5979915",
"0.58983177",
"0.58926255",
"0.58863646",
"0.5878602",
"0.58572286",
"0.5824188",
"0.57... | 0.75600106 | 0 |
GET /trustees GET /trustees.json | def index
if params
@trustees = Trustee.search(params).page(params[:page])
else
@trustees = Trustee.all.page(params[:page])
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @charity_trustees = CharityTrustee.search(params, 50)\n end",
"def trusts_to(selected_trustee)\n self.trusts.where(:trustee_id => selected_trustee.id)\n end",
"def set_trustee\n @trustee = Trustee.find(params[:id])\n end",
"def findFollowees\n @user = User.find(params[:id])\n... | [
"0.6440799",
"0.6438986",
"0.59911996",
"0.5870228",
"0.57403535",
"0.570447",
"0.56866056",
"0.56502026",
"0.56502026",
"0.56459993",
"0.5620888",
"0.56025875",
"0.5568573",
"0.55572855",
"0.55566096",
"0.55344915",
"0.54967296",
"0.5492178",
"0.54799235",
"0.5459365",
"0.54... | 0.74471736 | 0 |
GET /trustees/1 GET /trustees/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n if params\n @trustees = Trustee.search(params).page(params[:page])\n else\n @trustees = Trustee.all.page(params[:page])\n end\n end",
"def trusts_to(selected_trustee)\n self.trusts.where(:trustee_id => selected_trustee.id)\n end",
"def set_trustee\n @trustee = Trustee.f... | [
"0.7107886",
"0.6382955",
"0.6331172",
"0.6044169",
"0.59634906",
"0.58235437",
"0.5669292",
"0.5581643",
"0.5514598",
"0.551388",
"0.5512083",
"0.5469975",
"0.5461173",
"0.5457732",
"0.5448939",
"0.5448432",
"0.54184866",
"0.54134077",
"0.5411778",
"0.5407267",
"0.5404427",
... | 0.0 | -1 |
POST /trustees POST /trustees.json | def create
@trustee = Trustee.new(trustee_params)
respond_to do |format|
if @trustee.save
format.html { redirect_to @trustee, notice: 'Trustee was successfully created.' }
format.json { render action: 'show', status: :created, location: @trustee }
else
format.html { render a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trustee_params\n params.require(:trustee).permit(:access_id, :full_name, :trustee_type, :dates_of_service, :university_status, :first_year)\n end",
"def postEntityUser_trust( entity_id, user_id, trust)\n params = Hash.new\n params['entity_id'] = entity_id\n params['user_id'] = user_id\n p... | [
"0.62526166",
"0.6126302",
"0.58248615",
"0.5791861",
"0.5759345",
"0.57524943",
"0.559101",
"0.54792714",
"0.5453513",
"0.5451625",
"0.5403501",
"0.53829026",
"0.53595364",
"0.5258494",
"0.5248292",
"0.5247486",
"0.5243838",
"0.5229013",
"0.51985687",
"0.51975703",
"0.519516... | 0.69394344 | 0 |
PATCH/PUT /trustees/1 PATCH/PUT /trustees/1.json | def update
respond_to do |format|
if @trustee.update(trustee_params)
format.html { redirect_to @trustee, notice: 'Trustee was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @trustee.errors, s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_by_body\n @person = Person.find(person_update_params[:id])\n\n if @person.update_attributes(person_update_params)\n render json: { status: 'PUT Success' }, status: :ok\n else\n render json: { status: 'Error', message:'Error updating person', person: @person.errors }, status: :unproces... | [
"0.6155008",
"0.6112162",
"0.61013514",
"0.60197186",
"0.60066015",
"0.5978959",
"0.5976944",
"0.5914735",
"0.5888756",
"0.5875734",
"0.5844704",
"0.5832345",
"0.5829277",
"0.5828279",
"0.5775298",
"0.5770416",
"0.5741986",
"0.5711443",
"0.5699035",
"0.5698877",
"0.5688185",
... | 0.710767 | 0 |
DELETE /trustees/1 DELETE /trustees/1.json | def destroy
@trustee.destroy
respond_to do |format|
format.html { redirect_to trustees_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @trustees_minute.destroy\n respond_to do |format|\n format.html { redirect_to trustees_minutes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trust_transaction.destroy\n respond_to do |format|\n format.html { redirect_to trust_transactions_url ... | [
"0.6918001",
"0.68032557",
"0.6600493",
"0.6587346",
"0.6536546",
"0.64856184",
"0.648552",
"0.6476952",
"0.6447671",
"0.6438424",
"0.6424027",
"0.6419466",
"0.6417545",
"0.64170134",
"0.6394376",
"0.63740426",
"0.6373741",
"0.636905",
"0.63588",
"0.6344523",
"0.63390124",
... | 0.7826502 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_trustee
@trustee = Trustee.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def trustee_params
params.require(:trustee).permit(:access_id, :full_name, :trustee_type, :dates_of_service, :university_status, :first_year)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.6980957",
"0.6783065",
"0.6747844",
"0.6741468",
"0.67356336",
"0.6592548",
"0.65036845",
"0.64978707",
"0.64825076",
"0.64795035",
"0.64560914",
"0.64397955",
"0.6379666",
"0.6376688",
"0.6366702",
"0.6319728",
"0.6300833",
"0.6300629",
"0.6294277",
"0.6293905",
"0.629117... | 0.0 | -1 |
Initializes a new directory to the given path, and with the current configuration. | def initialize(path="", create=false, config=nil)
super(path, create, config)
@hg = working_join ".hg"
@file_opener = Amp::Opener.new @root
@file_opener.default = :open_file # these two are the same, pretty much
@hg_opener = Amp::Opener.new @root
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize_directory(dir)\n Dir.mkdir(dir) unless Dir.exist?(dir)\n dir\nend",
"def initialize(path = nil)\n self.path = path || generate_path\n \n FileUtils.mkdir_p(self.path)\n end",
"def initialize(working_tree_path)\n raise RubyGit::Error, \"Path '#{working_tree_path}' not valid.\" unl... | [
"0.69139993",
"0.6910179",
"0.6865005",
"0.6848333",
"0.680836",
"0.67427456",
"0.67041224",
"0.6696074",
"0.66482365",
"0.6561995",
"0.65435934",
"0.6417347",
"0.64099896",
"0.6407652",
"0.638045",
"0.6365641",
"0.63122857",
"0.63026184",
"0.6288461",
"0.6284755",
"0.6259091... | 0.0 | -1 |
Creates this repository's folders and structure. | def init(config=@config)
# make the directory if it's not there
super
FileUtils.makedirs @hg
requirements = ["revlogv1"]
# add some requirements
if config["format"]["usestore", Boolean] || true
FileUtils.mkdir "#{@hg}/store"
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n create_directories\n end",
"def create\n FileUtils.mkdir_p(@repos_path)\n @dirs_created << @repos_path\n ::Svn::Repos.create(@repos_path)\n self\n end",
"def mkdirs\n if (not exists?)\n parent.mkdirs\n factory.system.mkdir @path\n end\n end... | [
"0.7735579",
"0.71100736",
"0.6755001",
"0.6753487",
"0.67130226",
"0.670898",
"0.6641604",
"0.65626746",
"0.65501255",
"0.6513028",
"0.64851934",
"0.6473357",
"0.640963",
"0.6396631",
"0.6379723",
"0.63591725",
"0.6340843",
"0.6330866",
"0.63236403",
"0.63147706",
"0.6313445... | 0.0 | -1 |
Has the repository been changed since the last commit? Returns true if there are NO outstanding changes or uncommitted merges. | def pristine?
dirstate.parents.last == RevlogSupport::Node::NULL_ID &&
status(:only => [:modified, :added, :removed, :deleted]).all? {|_, v| v.empty? }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last_commit_changed_status?\n ref = last_commit.ref\n last_commits = commits.where(ref: ref).last(2)\n\n if last_commits.size < 2\n false\n else\n last_commits[0].status != last_commits[1].status\n end\n end",
"def anything_changed?\n @any_changes ||=\n ! @status.match(/noth... | [
"0.7852418",
"0.7825864",
"0.7632236",
"0.7616494",
"0.75280905",
"0.7414718",
"0.7329293",
"0.7294467",
"0.7237889",
"0.71374303",
"0.7079968",
"0.69982797",
"0.69922835",
"0.69922835",
"0.69637495",
"0.6954587",
"0.69518304",
"0.69217044",
"0.6920795",
"0.69112337",
"0.6905... | 0.0 | -1 |
Gets the changeset at the given revision. | def [](rev)
if rev.nil?
return Amp::Mercurial::WorkingDirectoryChangeset.new(self)
end
if rev.is_a?(Range)
unless rev.begin.kind_of?(Integer) && rev.end.kind_of?(Integer)
raise ArgumentError.new("Invalid range #{rev.inspect} passed to LocalRepository#[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_original_changeset(rev)\n changesets.where(\n 'patch_id = ? and committer = ? and authored_on = ? and revision <> ?',\n rev.patch_id,\n rev.author,\n rev.authored_on,\n rev.identifier\n ).first\n end",
"def revision\n return changeset.rev if @changeset || @change_i... | [
"0.71710837",
"0.7118102",
"0.7044357",
"0.6841537",
"0.6707497",
"0.64742935",
"0.64427435",
"0.6417023",
"0.63892275",
"0.6371734",
"0.6365124",
"0.63424623",
"0.63318336",
"0.6302544",
"0.6275439",
"0.6247738",
"0.6222126",
"0.6211021",
"0.6132737",
"0.6094795",
"0.5991338... | 0.644274 | 7 |
Creates a lock at the given path. At first it tries to just make it straight away. If this fails, we then sleep for up to a given amount of time (defaults to 10 minutes!) and continually try to acquire the lock. | def make_lock(lockname, wait, release_proc, acquire_proc, desc)
begin
lock = Lock.new(lockname, :timeout => 0, :release_fxn => release_proc, :desc => desc)
rescue LockHeld => err
raise unless wait
UI.warn("waiting for lock on #{desc} held by #{err.locker}")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def acquire_atomic_fs_lock(name)\n times = 0\n name += '.lock'\n Dir.mkdir name, 0700\n logger.debug(\"Acquired lock #{name}\")\n yield\n rescue Errno::EEXIST\n times += 1\n logger.debug(\"Waiting for lock #{name}\")\n sleep 1\n unless times >= 10\n retry\n ... | [
"0.741402",
"0.6878178",
"0.6442293",
"0.6411488",
"0.63340044",
"0.6306802",
"0.6229023",
"0.62096673",
"0.6174073",
"0.6160126",
"0.6149545",
"0.6123052",
"0.61114043",
"0.6024708",
"0.5986971",
"0.5976795",
"0.59262204",
"0.58612406",
"0.5769579",
"0.5763358",
"0.57464325"... | 0.64433897 | 2 |
Locks the repository's .hg/store directory. Returns the lock, or if a block is given, runs the block with the lock, and clears the lock afterward. | def lock_store(wait = true)
return @lock_ref if @lock_ref && @lock_ref.weakref_alive?
lock = make_lock(store_join("lock"), wait, nil, nil, "repository #{root}")
@lock_ref = WeakRef.new(lock)
if block_given?
begin
yield
ensure
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lock(&block)\n # TODO: only use replace strategy when server is executing the lock\n return call_strategy unless (locked_token = locksmith.lock(&block))\n\n locked_token\n end",
"def lock_repo(payload)\n lock_path = File.join(\n working_directory,\n \"#{payl... | [
"0.65954465",
"0.6389121",
"0.6325601",
"0.62712497",
"0.6223298",
"0.6204927",
"0.6164072",
"0.61213267",
"0.6075895",
"0.5946927",
"0.5934624",
"0.5924994",
"0.5867032",
"0.58409464",
"0.582292",
"0.57832736",
"0.57776445",
"0.5773989",
"0.5734742",
"0.57286936",
"0.5709488... | 0.6875341 | 0 |
Locks the repository's working directory. Returns the lock, or if a block is given, runs the block with the lock, and clears the lock afterward. | def lock_working(wait = true)
return @working_lock_ref if @working_lock_ref && @working_lock_ref.weakref_alive?
lock = make_lock(join("wlock"), wait, nil, nil, "working directory of #{root}")
@working_lock_ref = WeakRef.new(lock)
if block_given?
begin
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lock(&block)\n # TODO: only use replace strategy when server is executing the lock\n return call_strategy unless (locked_token = locksmith.lock(&block))\n\n locked_token\n end",
"def lock\n # Flush everything to start with a clean state\n # and to protect the @locked varia... | [
"0.69821763",
"0.66309047",
"0.6586678",
"0.6569479",
"0.64757526",
"0.64565396",
"0.643259",
"0.63774085",
"0.62744063",
"0.6190383",
"0.6174863",
"0.6121578",
"0.61144596",
"0.6083149",
"0.60682106",
"0.60028654",
"0.5955308",
"0.59323865",
"0.5922575",
"0.588516",
"0.58841... | 0.6948076 | 1 |
Takes a block, and runs that block with both the store and the working directory locked. | def lock_working_and_store(wait=true)
lock_store(wait) do
lock_working(wait) do
yield
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_stored_block\n self.run_in_context @stored_block if @stored_block\n end",
"def call(*, &block)\n lock_instance.execute(&block)\n end",
"def run_block\n if @block\n _block = @block\n @block = nil\n instance_eval &_block\n true\n end\n end",
... | [
"0.68970126",
"0.6303301",
"0.62241507",
"0.61920094",
"0.6120014",
"0.61047816",
"0.6098045",
"0.6097654",
"0.6097654",
"0.6097654",
"0.6044039",
"0.60364914",
"0.603256",
"0.603256",
"0.603256",
"0.603256",
"0.603256",
"0.603256",
"0.603256",
"0.60307515",
"0.60307515",
"... | 0.6421469 | 1 |
Returns an opener object, which knows how to open objects in the repository's store. | def store_opener
@store.opener
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open\n object.open\n end",
"def open(*args, &block)\n @hg_opener.open(*args, &block)\n end",
"def open_new_object\n save_state\n oid = open_object\n close_object\n add_object(oid)\n reopen_object(oid)\n oid\n end",
"def repository\n Repository[self]\n end",
"d... | [
"0.5739297",
"0.5643844",
"0.55945295",
"0.53689367",
"0.5275958",
"0.51558524",
"0.5110781",
"0.50408286",
"0.50281495",
"0.5012545",
"0.50012076",
"0.4974614",
"0.492908",
"0.4921584",
"0.491941",
"0.49181676",
"0.49094385",
"0.49045694",
"0.48122147",
"0.4775811",
"0.47617... | 0.63441205 | 0 |
Gets the filelog for the given path, so we can look at an individual file's history, for example. | def file_log(f)
f = f[1..-1] if f[0, 1] == "/"
Amp::Mercurial::FileLog.new @store.opener, f
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_log\n @file_log ||= @repo.file_log @path\n end",
"def log_file(log_path = nil)\n # Get hostname\n host = session.sys.config.sysinfo[\"Computer\"]\n\n # Create Filename info to be appended to downloaded files\n filenameinfo = \"_\" + ::Time.now.strftime(\"%Y%m%d.%M%S\")\n\n # C... | [
"0.7146621",
"0.6613266",
"0.6605436",
"0.6596951",
"0.65176725",
"0.6513372",
"0.6418677",
"0.63620275",
"0.6293259",
"0.6274884",
"0.61617315",
"0.6138726",
"0.6132355",
"0.60616654",
"0.6050074",
"0.6041114",
"0.6028829",
"0.6009537",
"0.5965523",
"0.59634125",
"0.5962834"... | 0.6572779 | 4 |
Returns the parent changesets of the specified changeset. Defaults to the working directory, if +change_id+ is unspecified. | def parents(change_id=nil)
self[change_id].parents
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parents\n @parents ||= begin\n p = @repo.dirstate.parents\n p = [p[0]] if p[1] == NULL_ID\n p.map {|x| Changeset.new(@repo, x) }\n end\n end",
"def parents\n p = @path\n rp = repo_path\n pcl... | [
"0.7325555",
"0.6876564",
"0.6410205",
"0.61728054",
"0.5959959",
"0.58681476",
"0.5866955",
"0.5856831",
"0.584192",
"0.5840622",
"0.58305365",
"0.58227813",
"0.5752657",
"0.57241815",
"0.5701204",
"0.5609934",
"0.5609071",
"0.55945694",
"0.5582361",
"0.554435",
"0.55423224"... | 0.82042956 | 0 |
Gets a versioned file for the given path, so we can look at the individual file's history with the file object itself. | def versioned_file(path, opts={})
Amp::Mercurial::VersionedFile.new(self, path, opts)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_file(path, file_id = nil, file_log = nil)\n file_id = file_node(path) if file_id.nil?\n VersionedFile.new(@repo, path, :file_id => file_id, :changeset => self,\n :file_log => file_log)\n end",
"def latest_version_of(path)\n @latest_version_of_ca... | [
"0.75830495",
"0.6987075",
"0.6699318",
"0.6660326",
"0.6657742",
"0.65646243",
"0.6485968",
"0.63847446",
"0.6331287",
"0.63128954",
"0.62805617",
"0.6251332",
"0.6226678",
"0.6216684",
"0.6213513",
"0.6158417",
"0.60841835",
"0.6061254",
"0.6014733",
"0.6008534",
"0.5965513... | 0.6871487 | 2 |
Gets a versioned file, but using the working directory, so we are looking past the last commit. Important because it uses a different class. Duh. | def working_file(path, opts={})
VersionedWorkingFile.new(self, path, opts)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def latest_version_file\n sorted_files.first\n end",
"def get_last_changed_revision(repo, fname)\n case repository_type\n when 'git'\n %x[git log -n 1 -- \"#{fname}\"].split(\"\\n\").first[7..-1]\n when 'git-svn', 'svn'\n begin\n svn_info = %x[svn info -r head \"#{repo}/#{fname}\"]\n ... | [
"0.67696226",
"0.6623224",
"0.65453464",
"0.64977807",
"0.6478629",
"0.6472223",
"0.64251494",
"0.6418417",
"0.63609505",
"0.63591963",
"0.62981737",
"0.6270973",
"0.62611264",
"0.6249876",
"0.62193173",
"0.6178718",
"0.6123038",
"0.61009973",
"0.60979146",
"0.60720074",
"0.6... | 0.57307374 | 59 |
Reads from a file, but in the working directory. Uses encoding if we are set up to do so. | def working_read(filename)
data = @file_opener.open(filename, "r") {|f| f.read }
data = @filters["encode"].call(filename, data) if @filters["encode"]
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read(file)\n if @options[:input_file]\n file = File.join(File.dirname(@options[:input_file]), file)\n end\n File.read(file)\n end",
"def read file\n File.open file\n end",
"def read_file(file)\n text_file = (path.ftype == \"directory\" ? path : Pathna... | [
"0.6783776",
"0.66561615",
"0.65734714",
"0.6522023",
"0.6522023",
"0.6381909",
"0.6381909",
"0.6377981",
"0.63283604",
"0.6306875",
"0.62767035",
"0.6248504",
"0.6236711",
"0.6160031",
"0.6145099",
"0.61441255",
"0.61319524",
"0.6113249",
"0.6112556",
"0.6108361",
"0.6102488... | 0.6011876 | 29 |
Writes to a file, but in the working directory. Uses encoding if we are set up to do so. Also handles symlinks and executables. Ugh. | def working_write(path, data, flags = "")
@file_opener.open(path, "w") do |file|
file.write(data)
end
if flags && flags.include?('x')
FileHelpers.set_executable(working_join(path), true)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_file(content, dir, file)\n filename = File.basename(file).gsub(/(\\.s?[ac]ss)+/, options[:extension])\n path = File.join(dir, filename)\n\n unless options[:noop]\n FileUtils.mkdir_p(dir)\n File.open(path, 'w') {|f| f.write(content) }\n end\n\n path\n ... | [
"0.62823695",
"0.6134746",
"0.5992164",
"0.5948648",
"0.59285206",
"0.5909406",
"0.58872575",
"0.58585453",
"0.57926",
"0.57787275",
"0.57743675",
"0.5765623",
"0.57537156",
"0.574742",
"0.5744337",
"0.5694829",
"0.56736153",
"0.56549454",
"0.56547713",
"0.56416583",
"0.56406... | 0.6386947 | 0 |
Returns the changelog for this repository. This changelog basically is the history of all commits. | def changelog
return @changelog if @changelog
@changelog = Amp::Mercurial::ChangeLog.new @store.opener
if path = ENV['HG_PENDING']
if path =~ /^#{root}/
@changelog.read_pending('00changelog.i.a')
end
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def changelog\n @vcs.changelog\n end",
"def changelog\n changes = options.point ? repo.changes : repo.change_points\n ChangeLog.new(changes).above(options.level)\n end",
"def changelog\n @changelog ||= Changelog.new\n end",
"def changelog\n @changelog ||= Generator.call(vers... | [
"0.8230358",
"0.78673756",
"0.7845446",
"0.7726678",
"0.7417236",
"0.72470516",
"0.72003096",
"0.71249294",
"0.7106021",
"0.7072606",
"0.7009355",
"0.69820964",
"0.6963257",
"0.69421893",
"0.68990755",
"0.686869",
"0.67693406",
"0.67458963",
"0.6726639",
"0.67105705",
"0.6637... | 0.7945757 | 1 |
Has the file been modified from node1 to node2? | def file_modified?(file, opts={})
vf_old, vf_new = opts[:node1][file], opts[:node2][file]
tests = [vf_old.flags != vf_new.flags,
vf_old.file_node != vf_new.file_node &&
(vf_new.changeset.include?(file) || vf_old === vf_new)]
tests.any?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def modified?(path); end",
"def changed?(file)\n if !stored?(file)\n return true\n end\n ok_file = get_ok_file_for(file)\n fail_file = get_fail_file_for(file)\n f = File.new(file) \n if ( \n ( File.exists?(ok_file) && f.stat.mtime > File.new(ok... | [
"0.67486227",
"0.6707673",
"0.66712713",
"0.6639178",
"0.6580054",
"0.6507725",
"0.649856",
"0.6418172",
"0.6415621",
"0.63886994",
"0.6378072",
"0.6377241",
"0.6371446",
"0.6363734",
"0.63485354",
"0.6347785",
"0.63288546",
"0.63231933",
"0.6319751",
"0.6288067",
"0.6271593"... | 0.7607564 | 0 |
Marks a file as resolved according to the merge state. Basic form of merge conflict resolution that all repositories must support. | def mark_resolved(filename)
merge_state.mark_resolved filename
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def try_resolve_conflict\n # retry the merge\n working_changeset = self[nil]\n merge_changeset = working_changeset.parents.last\n \n # backup the current file to a .resolve file (but retain the extension\n # so editors that rely on extensions won't bug out)\n ... | [
"0.7390556",
"0.6800961",
"0.56297064",
"0.54432225",
"0.53862387",
"0.5383353",
"0.53724355",
"0.5351419",
"0.5226725",
"0.5223422",
"0.5202016",
"0.5144869",
"0.5130031",
"0.506274",
"0.50454456",
"0.50278246",
"0.5021503",
"0.4967287",
"0.49347076",
"0.48842746",
"0.486374... | 0.8135461 | 0 |
Marks a file as conflicted according to the merge state. Basic form of merge conflict resolution that all repositories must support. | def mark_conflicted(filename)
merge_state.mark_conflicted filename
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def try_resolve_conflict\n # retry the merge\n working_changeset = self[nil]\n merge_changeset = working_changeset.parents.last\n \n # backup the current file to a .resolve file (but retain the extension\n # so editors that rely on extensions won't bug out)\n ... | [
"0.7130593",
"0.7003585",
"0.6625638",
"0.65716565",
"0.5937547",
"0.5893094",
"0.58703995",
"0.58115214",
"0.5802634",
"0.5741331",
"0.56839013",
"0.55701995",
"0.5523746",
"0.5523746",
"0.5496823",
"0.5496157",
"0.54608816",
"0.53961295",
"0.5330194",
"0.5325467",
"0.529881... | 0.83440804 | 0 |
Returns all files that have not been merged. In other words, if we're waiting for the user to fix up their merge, then return the list of files we need to be correct before merging. | def uncommitted_merge_files
merge_state.uncommitted_merge_files
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_uncommitted_files\n\t\t\tlist = read_command_output( 'hg', 'status', '-n', '--color', 'never' )\n\t\t\tlist = list.split( /\\n/ )\n\n\t\t\ttrace \"Changed files: %p\" % [ list ]\n\t\t\treturn list\n\t\tend",
"def uncommitted_files\n files = nil\n p4 (['change','-o']).each do |line|\n fil... | [
"0.67958206",
"0.65119696",
"0.64313966",
"0.6410938",
"0.6410938",
"0.63929546",
"0.6209821",
"0.6168226",
"0.61506027",
"0.61506027",
"0.601696",
"0.600079",
"0.59762746",
"0.5970858",
"0.59644914",
"0.5946217",
"0.59224194",
"0.58936304",
"0.58852124",
"0.57645375",
"0.575... | 0.727151 | 0 |
Attempts to resolve the given file, according to how mercurial manages merges. Needed for api compliance. | def try_resolve_conflict
# retry the merge
working_changeset = self[nil]
merge_changeset = working_changeset.parents.last
# backup the current file to a .resolve file (but retain the extension
# so editors that rely on extensions won't bug out)
path... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resolve(file, &block)\n @files = []\n _resolve(file, &block)\n end",
"def _resolve(file)\n imported_path = nil\n\n IO.foreach(file) do |line|\n # Implementing subclasses may throw :done from the parse method when\n # the file is exhausted for dependency declaration possib... | [
"0.6577126",
"0.6416045",
"0.6150668",
"0.6101174",
"0.59403956",
"0.59297794",
"0.58921564",
"0.57321954",
"0.5672695",
"0.56265265",
"0.56172305",
"0.5601283",
"0.5600628",
"0.55909336",
"0.55850095",
"0.5564977",
"0.5564977",
"0.5492231",
"0.54861164",
"0.5471397",
"0.5468... | 0.7564383 | 0 |
Returns the merge state for this repository. The merge state keeps track of what files need to be merged for an update to be successfully completed. | def merge_state
@merge_state ||= Amp::Mercurial::Merges::MergeState.new(self)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def store_merge_state\n merge_head = `git rev-parse MERGE_HEAD 2> #{File::NULL}`.chomp\n\n # Store the merge state if we're in the middle of resolving a merge\n # conflict. This is necessary since stashing removes the merge state.\n if merge_head != 'MERGE_HEAD'\n @merge_head = merge_hea... | [
"0.6881699",
"0.6864073",
"0.66066444",
"0.62093824",
"0.6056125",
"0.5924244",
"0.5880523",
"0.56798834",
"0.56048733",
"0.56048733",
"0.56022716",
"0.55562633",
"0.54167724",
"0.53775567",
"0.53081524",
"0.5298021",
"0.52354383",
"0.52018386",
"0.5162515",
"0.5157459",
"0.5... | 0.698973 | 0 |
Returns the manifest for this repository. The manifest keeps track of what files exist at what times, and if they have certain flags (such as executable, or is it a symlink). | def manifest
return @manifest if @manifest
changelog #load the changelog
@manifest = Amp::Mercurial::Manifest.new @store.opener
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def manifest\n fail ResourceNotFound, \"#{full_repo_name} does not exist\" unless repo_exists?\n fail ResourceNotPublic, \"#{full_repo_name} is not public\" unless public?\n fail ManifestMissing, \"#{full_repo_name} has no manifest\" unless manifest_exists?\n fail ResourceN... | [
"0.75872177",
"0.73303074",
"0.6773378",
"0.6758566",
"0.6738221",
"0.6700481",
"0.66840446",
"0.66387695",
"0.6589728",
"0.6471752",
"0.6400227",
"0.63738865",
"0.6267411",
"0.6262031",
"0.6213859",
"0.62000585",
"0.61144096",
"0.6053944",
"0.60502464",
"0.6025231",
"0.60217... | 0.5727717 | 40 |
Returns the dirstate for this repository. The dirstate keeps track of files status, such as removed, added, merged, and so on. It also keeps track of the working directory. | def dirstate
staging_area.dirstate
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dir\n @working_directory\n end",
"def last_updated\n repo = Grit::Repo.init_bare_or_open(File.join(path , '.git'))\n repo.commits.first.commited_date\n end",
"def working_dir\n return nil if !repo || !user\n return \"#{Bini.data_dir}/repos/#{user}/#{repo}\"\n end",
"def day_to... | [
"0.56800807",
"0.5402462",
"0.5382645",
"0.5322024",
"0.523133",
"0.5217159",
"0.51987517",
"0.5185628",
"0.5157074",
"0.51433337",
"0.50818706",
"0.506864",
"0.50678575",
"0.5063949",
"0.5014414",
"0.50057304",
"0.4971183",
"0.49480844",
"0.4936146",
"0.4900331",
"0.48998362... | 0.65982074 | 0 |
Returns the URL of this repository. Uses the "file:" scheme as such. | def url; "file:#{@root}"; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def uri\n \"file://\" + self.repos_path\n end",
"def get_repo_file_url(namespace, filename)\n \"#{get_repo_url}#{namespace}/#{filename}\"\n end",
"def file_url(filename)\n raw_url = git_repository_url[0..-5]\n \"#{raw_url}/blob/#{git_commit_sha}/#{filename}\"\n end",
"def repository_ur... | [
"0.83672035",
"0.77578735",
"0.7620177",
"0.7491083",
"0.74657863",
"0.74064106",
"0.73763853",
"0.72892773",
"0.72779596",
"0.7255634",
"0.7239964",
"0.721772",
"0.70706433",
"0.6918198",
"0.69107324",
"0.6904453",
"0.6900648",
"0.68995076",
"0.6854385",
"0.68320644",
"0.681... | 0.6883694 | 18 |
Opens a file using our opener. Can only access files in .hg/ | def open(*args, &block)
@hg_opener.open(*args, &block)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open(file, mode='r', &block)\n if @default == :open_file\n open_file file, mode, &block\n else\n open_hg file, mode, &block\n end\n end",
"def open!(file, *args, &block); end",
"def open( *args, &block ) # :yield: file\n File.open( expand_tilde, *a... | [
"0.7593669",
"0.6496667",
"0.648866",
"0.6477072",
"0.64435214",
"0.6431024",
"0.6400433",
"0.635815",
"0.6346278",
"0.6335438",
"0.6311838",
"0.6296051",
"0.6281619",
"0.62485534",
"0.6247055",
"0.6244116",
"0.6244116",
"0.6227627",
"0.6201326",
"0.6192971",
"0.6189126",
"... | 0.7388721 | 1 |
Joins the path from this repo's path (.hg), to the file provided. | def join(file)
File.join(@hg, file)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def path\n File.join(repository.path, '.hg', 'hgrc')\n end",
"def hg_repo_path\n path = `hg root 2>/dev/null`.strip\n @hg_repo_path ||= path + '/.hg' unless path == ''\nend",
"def repo_path(path)\n File.join(File.expand_path('../../..', $0), path)\n end",
"def add_to_file entry, content... | [
"0.65976393",
"0.6134355",
"0.59769505",
"0.5939929",
"0.5794313",
"0.57551676",
"0.573501",
"0.5710953",
"0.5697014",
"0.567492",
"0.56694233",
"0.56285375",
"0.56285375",
"0.56127566",
"0.5563338",
"0.55301934",
"0.5526777",
"0.5518071",
"0.5515049",
"0.54922163",
"0.546094... | 0.7848126 | 0 |
Looks up an identifier for a revision in the commit history. This key could be an integer (specifying a revision number), "." for the latest revision, "null" for the null revision, "tip" for the tip of the repository, a node_id (in hex or binary form) for a revision in the changelog. Yeah. It's a flexible method. | def lookup(key)
key = key.to_i if key.to_i.to_s == key.to_s # casting for things like "10"
case key
when Fixnum, Bignum, Integer
changelog.node_id_for_index(key)
when "."
dirstate.parents().first
when "null", nil
NULL_ID
whe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def identifier\n if repository.class.respond_to? :changeset_identifier\n repository.class.changeset_identifier self\n else\n revision.to_s\n end\n end",
"def revision\n @commit.id_abbrev\n end",
"def revision\n # HEAD is the default, but lets just be explicit here.\n get_r... | [
"0.67681867",
"0.6605243",
"0.6543338",
"0.64851075",
"0.6445012",
"0.6362339",
"0.63610744",
"0.6357324",
"0.63100916",
"0.6299859",
"0.62684506",
"0.6228435",
"0.608404",
"0.59491014",
"0.59462446",
"0.59317786",
"0.5928176",
"0.5875916",
"0.5843308",
"0.58355016",
"0.58334... | 0.7705186 | 0 |
Finds the nodes between two nodes this algorithm is ported from the python for mercurial (localrepo.py:1247, for 1.2.1 source). Since this is used by servers, it implements their algorithm... which seems to intentionally not return every node between +top+ and +bottom+. Each one is twice as far from +top+ as the previo... | def between(pairs)
pairs.map do |top, bottom|
node, list, counter = top, [], 0
add_me = 1
while node != bottom && node != NULL_ID
if counter == add_me
list << node
add_me *= 2
end
parent = changelog.p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def common_nodes(remote, opts={:heads => nil, :force => nil, :base => nil})\n # variable prep!\n node_map = changelog.node_map\n search = []\n unknown = []\n fetch = {}\n seen = {}\n seen_branch = {}\n opts[:base] ||= {}\n ... | [
"0.66730034",
"0.6214594",
"0.6204486",
"0.6157956",
"0.61443406",
"0.6078314",
"0.6063954",
"0.5939927",
"0.5924287",
"0.5895509",
"0.58814317",
"0.5881232",
"0.5822873",
"0.5819487",
"0.5797834",
"0.5793247",
"0.578348",
"0.5768956",
"0.57410824",
"0.5727137",
"0.5709189",
... | 0.65280265 | 1 |
Pull new changegroups from +remote+ This does not apply the changes, but pulls them onto the local server. | def pull(remote, opts={:heads => nil, :force => nil})
lock_store do
# get the common nodes, missing nodes, and the remote heads
# this is findcommonincoming in the Python code, for those with both open
common, fetch, remote_heads = *common_nodes(remote, :heads => opts[:head... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pull(remote)\n namehost, folder, _barefolder = split_url(remote.name)\n try_system %[ssh #{namehost} \"cd #{folder} && git push origin\"]\n Dir.chdir(bare_repo.repo.to_s) do\n try_system(\"git fetch #{remote.name} master:master\")\n end\n #bare_repo.fetch(remote)\n simple_p... | [
"0.6570857",
"0.6251514",
"0.6229209",
"0.5969411",
"0.59471023",
"0.5870653",
"0.5804786",
"0.5785778",
"0.57293767",
"0.57170177",
"0.56914246",
"0.56723654",
"0.5633338",
"0.5629414",
"0.562745",
"0.5594189",
"0.5504671",
"0.5488205",
"0.54618937",
"0.54589885",
"0.5428601... | 0.69755775 | 0 |
Add a changegroup to the repo. Return values: nothing changed or no source: 0 more heads than before: 1+added_heads (2..n) fewer heads than before: 1removed_heads (2..n) number of heads stays the same: 1 Don't the first and last conflict? they stay the same if nothing has changed... | def add_changegroup(source, type, url, opts={:empty => []})
run_hook :pre_changegroup, :throw => true, :source => type, :url => url
changesets = files = revisions = 0
return 0 if source.is_a?(StringIO) && source.string.empty?
rev_map = proc {|x| changelog.re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def push_add_changegroup(remote, opts={})\n # no locking cuz we rockz\n ret = pre_push remote, opts\n \n if ret[0]\n cg, remote_heads = *ret\n remote.add_changegroup cg, :push, url\n else\n ret[1]\n end\n end",
"def git... | [
"0.5849762",
"0.57879525",
"0.5643796",
"0.5508041",
"0.5375303",
"0.52961683",
"0.5246602",
"0.5245872",
"0.52266204",
"0.522377",
"0.5182366",
"0.51583993",
"0.51397794",
"0.5097611",
"0.5086673",
"0.50387645",
"0.50239766",
"0.50237197",
"0.49637163",
"0.49549624",
"0.4941... | 0.6896886 | 0 |
end def A changegroup, of some sort. | def changegroup(base_nodes, source)
changegroup_subset(base_nodes, heads, source)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def group; end",
"def set_main_group(group)\r\n #@main_group = group\r\n\t\t@groups[10] = group\r\n\tend",
"def groups; end",
"def groups; end",
"def groups; end",
"def group=(new_group)\n if @group != new_group\n @dacl.reassign!(@group, new_group)\n @group = new_group\n end\n end",
... | [
"0.73886585",
"0.700448",
"0.6989254",
"0.6989254",
"0.6989254",
"0.6941083",
"0.6769911",
"0.6728007",
"0.66946155",
"0.6643204",
"0.66192",
"0.6553401",
"0.6527873",
"0.65185004",
"0.650858",
"0.6472176",
"0.64629847",
"0.6458515",
"0.64408875",
"0.6439969",
"0.6439969",
... | 0.69981533 | 2 |
Prints information about the changegroup we are going to receive. | def changegroup_info(nodes, source)
# print info
if source == :bundle
UI.status("#{nodes.size} changesets found")
end
# debug stuff
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_group(group)\n puts \"Name: \" + group.name\n puts \"Description: \" + (group.description.nil? ? \"None\" : group.description)\n puts \"Status: \" + group.status\n puts \"Href: \" + group.href\nend",
"def info()\n super(GROUP_METHODS[:info], 'GROUP')\n end",
"def info()\n ... | [
"0.6288792",
"0.6027647",
"0.6027647",
"0.585267",
"0.5731354",
"0.5681241",
"0.5656177",
"0.5638122",
"0.5573687",
"0.5559187",
"0.55495346",
"0.55486184",
"0.5545614",
"0.5522973",
"0.55104804",
"0.5503469",
"0.5503469",
"0.5486065",
"0.5477866",
"0.54418755",
"0.54400486",... | 0.6719644 | 0 |
Faster version of changegroup_subset. Useful when pushing working dir. Generate a changegruop of all nodes that we have that a recipient doesn't This is much easier than the previous function as we can assume that the recipient has any changegnode we aren't sending them. | def get_changegroup(common, source)
# Call the hooks
run_hook :pre_outgoing, :throw => true, :source => source
nodes = changelog.find_missing common
revset = Hash.with_keys(nodes.map {|n| changelog.rev(n)})
changegroup_info nodes, source
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def changegroup_subset(bases, new_heads, source, extra_nodes=nil)\n unless extra_nodes\n if new_heads.sort! == heads.sort!\n common = []\n \n # parents of bases are known from both sides\n bases.each do |base|\n changelog.parent... | [
"0.6515755",
"0.59885883",
"0.5315426",
"0.5246966",
"0.5145384",
"0.51358026",
"0.51295245",
"0.5125107",
"0.51102304",
"0.5104641",
"0.5104641",
"0.5104641",
"0.5017664",
"0.49954268",
"0.4973622",
"0.49358413",
"0.49099717",
"0.49087775",
"0.49032602",
"0.488547",
"0.48724... | 0.44218227 | 87 |
This function generates a changegroup consisting of all the nodes that are descendents of any of the bases, and ancestors of any of the heads. It is fairly complex in determining which filenodes and which manifest nodes need to be included for the changeset to be complete is nontrivial. Another wrinkle is doing the rev... | def changegroup_subset(bases, new_heads, source, extra_nodes=nil)
unless extra_nodes
if new_heads.sort! == heads.sort!
common = []
# parents of bases are known from both sides
bases.each do |base|
changelog.parents_for_node(b... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def additive_changeset(node)\n {\n 'children_attribs' => [{\n 'id' => node.c[0].id,\n 'option_attribs' => { 'id' => node.c[0].option_id, 'name_translations' => {'en' => 'Animal'} },\n 'children_attribs' => [\n {\n 'id' => node.c[0].c[0].id,\n 'option_attr... | [
"0.56233937",
"0.5398284",
"0.5321474",
"0.5240641",
"0.5076029",
"0.50652784",
"0.5013223",
"0.50017786",
"0.49904534",
"0.49849337",
"0.49073938",
"0.4904776",
"0.48992965",
"0.48798588",
"0.4865057",
"0.4864153",
"0.47942263",
"0.47790557",
"0.47693273",
"0.4732138",
"0.47... | 0.6016471 | 0 |
end def Revert a file or group of files to +revision+. If +opts[:unlink]+ is true, then the files | def revert(files=nil, opts={})
# get the parents - used in checking if we haven an uncommitted merge
parent, p2 = dirstate.parents
# get the revision
rev = opts[:revision] || opts[:rev] || opts[:to]
# check to make sure it's logically possible
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_revert(file, ref)\n if file_revisions(file).map { |r| r[:commit] }.include? ref\n file = file.gsub(%r{^/}, '')\n full_path = File.expand_path(file, @root)\n content = File.read(file_revision_at(file, ref))\n File.open(full_path, 'w') { |f| f.puts content }\n end\n ... | [
"0.63295907",
"0.6200758",
"0.61239845",
"0.6087306",
"0.59870553",
"0.57654315",
"0.55764014",
"0.55512553",
"0.5520852",
"0.5512263",
"0.5510004",
"0.5475401",
"0.5456222",
"0.5438159",
"0.5418269",
"0.53855366",
"0.5372467",
"0.5284948",
"0.52805024",
"0.52765137",
"0.5255... | 0.68161637 | 0 |
Return list of roots of the subsets of missing nodes from remote If base dict is specified, assume that these nodes and their parents exist on the remote side and that no child of a node of base exists in both remote and self. Furthermore base will be updated to include the nodes that exists in self and remote but no c... | def find_incoming_roots(remote, opts={:base => nil, :heads => nil,
:force => false, :base => nil})
common_nodes(remote, opts)[1]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_outgoing_roots(remote, opts={:base => nil, :heads => nil, :force => false})\n base, heads, force = opts[:base], opts[:heads], opts[:force]\n if base.nil?\n base = {}\n find_incoming_roots remote, :base => base, :heads => heads, :force => force\n end\n ... | [
"0.74284464",
"0.67051595",
"0.55961585",
"0.5476298",
"0.5328005",
"0.5252548",
"0.51275945",
"0.5095666",
"0.50532603",
"0.5044782",
"0.50389546",
"0.4985024",
"0.49822313",
"0.4976379",
"0.4941993",
"0.49032244",
"0.4857961",
"0.48051128",
"0.47614065",
"0.4753752",
"0.473... | 0.7196807 | 1 |
Find the common nodes, missing nodes, and remote heads. So in this code, we use opts[:base] and fetch as hashes instead of arrays. We could very well use arrays, but hashes have O(1) lookup time, and since these could get RFH (Really Fucking Huge), we decided to take the liberty and just use hash for now. If opts[:base... | def common_nodes(remote, opts={:heads => nil, :force => nil, :base => nil})
# variable prep!
node_map = changelog.node_map
search = []
unknown = []
fetch = {}
seen = {}
seen_branch = {}
opts[:base] ||= {}
opts[:heads] |... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_outgoing_roots(remote, opts={:base => nil, :heads => nil, :force => false})\n base, heads, force = opts[:base], opts[:heads], opts[:force]\n if base.nil?\n base = {}\n find_incoming_roots remote, :base => base, :heads => heads, :force => force\n end\n ... | [
"0.6981394",
"0.6933373",
"0.565841",
"0.53476834",
"0.5197911",
"0.5027225",
"0.49815556",
"0.49769363",
"0.49465764",
"0.48613304",
"0.48373687",
"0.48189852",
"0.480103",
"0.473862",
"0.47354618",
"0.4726179",
"0.46829545",
"0.46702132",
"0.46466634",
"0.46411327",
"0.4637... | 0.78956264 | 0 |
Returns the number of revisions the repository is tracking. | def size
changelog.size
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count\n `git rev-list HEAD --count`.presence.to_i\n rescue\n nil\n end",
"def getRevisionsCount(padID)\n call :getRevisionsCount, :padID => padID\n end",
"def revision_number\n ver = version\n case\n when live? then\n versions.count\n when ver then... | [
"0.73966485",
"0.72634935",
"0.6997054",
"0.694515",
"0.6874221",
"0.6719467",
"0.6634641",
"0.6508904",
"0.64396876",
"0.6400629",
"0.62697875",
"0.6230013",
"0.62028426",
"0.6157128",
"0.6133562",
"0.6104151",
"0.6074644",
"0.60728866",
"0.60533845",
"0.6046493",
"0.6044166... | 0.56783515 | 44 |
Returns the parents that aren't NULL_ID | def living_parents
dirstate.parents.select {|p| p != NULL_ID }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parent_rel_ids\n rel = relationships\n if rel.kind_of?(Array) || rel.try(:loaded?)\n rel.reject { |x| x.ancestry.blank? }.collect(&:parent_id)\n else\n rel.where.not(:ancestry => [nil, \"\"]).select(:ancestry).collect(&:parent_id)\n end\n end",
"def parents\n @parents ||= begin\... | [
"0.69757104",
"0.6949475",
"0.6859543",
"0.6712216",
"0.6708638",
"0.66026133",
"0.6591215",
"0.65688735",
"0.6491837",
"0.64672565",
"0.6451357",
"0.6448789",
"0.6422031",
"0.64160264",
"0.640745",
"0.6319328",
"0.6302704",
"0.6282049",
"0.6275251",
"0.6239707",
"0.62283784"... | 0.8198591 | 0 |
There are two ways to push to remote repo: addchangegroup assumes local user can lock remote repo (local filesystem, old ssh servers). unbundle assumes local user cannot lock remote repo (new ssh servers, http servers). | def push(remote_repo, opts={:force => false, :revs => nil})
if remote_repo.capable? "unbundle"
push_unbundle remote_repo, opts
else
push_add_changegroup remote_repo, opts
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def push_add_changegroup(remote, opts={})\n # no locking cuz we rockz\n ret = pre_push remote, opts\n \n if ret[0]\n cg, remote_heads = *ret\n remote.add_changegroup cg, :push, url\n else\n ret[1]\n end\n end",
"def pus... | [
"0.67106473",
"0.6686665",
"0.63594395",
"0.6106292",
"0.6096399",
"0.60534936",
"0.60137254",
"0.5993976",
"0.59518534",
"0.5941997",
"0.59234416",
"0.58996075",
"0.5883288",
"0.5875099",
"0.58307767",
"0.5811832",
"0.57963973",
"0.57923937",
"0.579225",
"0.5791404",
"0.5772... | 0.7802488 | 0 |
Push and add a changegroup | def push_add_changegroup(remote, opts={})
# no locking cuz we rockz
ret = pre_push remote, opts
if ret[0]
cg, remote_heads = *ret
remote.add_changegroup cg, :push, url
else
ret[1]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_changegroup(source, type, url, opts={:empty => []})\n run_hook :pre_changegroup, :throw => true, :source => type, :url => url\n changesets = files = revisions = 0\n \n return 0 if source.is_a?(StringIO) && source.string.empty?\n \n rev_map = proc {|x| c... | [
"0.6699575",
"0.66589856",
"0.64657116",
"0.6366778",
"0.63533825",
"0.6228858",
"0.6135114",
"0.61290264",
"0.6126195",
"0.6099928",
"0.6020333",
"0.6016173",
"0.5991457",
"0.5956905",
"0.5956905",
"0.595617",
"0.59472585",
"0.5918077",
"0.5889635",
"0.5877439",
"0.58505744"... | 0.7347386 | 0 |
Push an unbundled dohickey | def push_unbundle(remote, opts={})
# local repo finds heads on server, finds out what revs it
# must push. once revs transferred, if server finds it has
# different heads (someone else won commit/push race), server
# aborts.
ret = pre_push remote, opts
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lpush(key, value)\n send_command([:lpush, key, value])\n end",
"def rpush(key, value); end",
"def rpush(key, value); end",
"def push(item)\n conn.rpush key, item\n self\n end",
"def rpush(key, value)\n send_command([:rpush, key, value])\n end",
"def add(host, key); end"... | [
"0.65154254",
"0.6497511",
"0.6497511",
"0.6363062",
"0.6325555",
"0.6319366",
"0.6318687",
"0.62965906",
"0.62965906",
"0.6181518",
"0.6181518",
"0.61205757",
"0.61124074",
"0.60878944",
"0.6085864",
"0.6044346",
"0.6044346",
"0.6025031",
"0.5956853",
"0.59344244",
"0.591287... | 0.0 | -1 |
Return list of nodes that are roots of subsets not in remote If base dict is specified, assume that these nodes and their parents exist on the remote side. If a list of heads is specified, return only nodes which are heads or ancestors of these heads, and return a second element which contains all remote heads which ge... | def find_outgoing_roots(remote, opts={:base => nil, :heads => nil, :force => false})
base, heads, force = opts[:base], opts[:heads], opts[:force]
if base.nil?
base = {}
find_incoming_roots remote, :base => base, :heads => heads, :force => force
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_incoming_roots(remote, opts={:base => nil, :heads => nil,\n :force => false, :base => nil})\n common_nodes(remote, opts)[1]\n end",
"def common_nodes(remote, opts={:heads => nil, :force => nil, :base => nil})\n # variable prep!\n ... | [
"0.7284785",
"0.6797158",
"0.629961",
"0.54740185",
"0.54103386",
"0.53848225",
"0.5361709",
"0.53352195",
"0.5331094",
"0.5329927",
"0.5297764",
"0.52867264",
"0.52826834",
"0.52812684",
"0.52785945",
"0.5255812",
"0.525086",
"0.52450466",
"0.5236432",
"0.52301747",
"0.52186... | 0.7839112 | 0 |
The branches available in this repository. | def branches(*nodes)
branches = []
nodes = [changelog.tip] if nodes.empty?
# for each node, find its first parent (adam and eve, basically)
# -- that's our branch!
nodes.each do |node|
t = node
# traverse the tree, staying to the left side
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def branches\n @branches ||= get(\"/repos/show/#{owner.login}/#{name}/branches\")['branches'].map do |name, head|\n Branch.new(connection, \n :name => name,\n :head => head,\n :repo => self\n )\n end\n end",
"def branches\n client.branches(repo)\n end... | [
"0.8568691",
"0.85160816",
"0.83875614",
"0.8323346",
"0.8275205",
"0.82274",
"0.8192659",
"0.81585723",
"0.80844384",
"0.80844384",
"0.8000276",
"0.7749076",
"0.7613445",
"0.7587367",
"0.7500016",
"0.7467502",
"0.7461927",
"0.7432365",
"0.7417811",
"0.73590904",
"0.7331999",... | 0.59041953 | 75 |
Undelete a file. For instance, if you remove something and then find out that you NEED that file, you can use this command. | def undelete(list)
manifests = living_parents.map do |p|
manifest.read changelog.read(p).manifest_node
end
# now we actually restore the files
list.each do |file|
unless dirstate[file].removed?
UI.warn "#{file} isn't being removed!... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove file\n file.delete\n @files -= [file]\n end",
"def delete_file\n File.unlink file\n end",
"def delete_file\n File.unlink file\n end",
"def rm_file(file)\n @files.delete(file.path)\n end",
"def rm_file(file)\n @files.delete(file.path)\n end",
"def rm(file)\n ... | [
"0.7102739",
"0.7057031",
"0.7057031",
"0.7034081",
"0.69820464",
"0.6978646",
"0.69538254",
"0.69538254",
"0.68662965",
"0.6804249",
"0.6781419",
"0.67509574",
"0.66525984",
"0.66002846",
"0.6527024",
"0.65154254",
"0.65083706",
"0.6491987",
"0.64822185",
"0.6480484",
"0.647... | 0.0 | -1 |
Write data to a file in the CODE repo, not the .hg | def add_file(file_name, data, flags)
data = filter "decode", file_name, data
path = working_join file_name
File.unlink path rescue nil
if flags.include? 'l' # if it's a link
@file_opener.symlink path, data
else
@file_opener.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_to_file entry, content\n path = repo_path.join entry\n File.write path, content, :mode => \"a\"\n end",
"def write_to_file(data)\n\t\t\tref = File.join(@root, \"tarrifs_\" + @page[:name])\n\n\t\t\tif File.exists?(ref)\n\t\t\t\tdiff = \"\"\n\t\t\t\tstatus = Open4::popen4(\"diff #{ref} -\") do... | [
"0.6877912",
"0.6668381",
"0.66593456",
"0.6480767",
"0.6448728",
"0.63873756",
"0.63873756",
"0.6348416",
"0.62955797",
"0.62955797",
"0.62955797",
"0.62473416",
"0.62362385",
"0.6180215",
"0.6145972",
"0.61416984",
"0.6117497",
"0.6117497",
"0.6117497",
"0.6117497",
"0.6103... | 0.0 | -1 |
Returns the node_id's of the heads of the repository. | def heads(start=nil, options={:closed => true})
heads = changelog.heads(start)
should_show = lambda do |head|
return true if options[:closed]
extras = changelog.read(head).extra
return !(extras["close"])
end
heads = heads.select {|... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_branch_names(repo)\n repo.heads.collect(&:name)\n end",
"def hg_tags_nodes\n return_list = {}\n self.heads.reverse.each do |node|\n changeset = self[node]\n rev = changeset.revision\n file_node = changeset.get_file(\".hgtags\") rescue next\n ... | [
"0.6497707",
"0.61227703",
"0.6115995",
"0.6059803",
"0.6059803",
"0.60293794",
"0.5972284",
"0.59364897",
"0.5774463",
"0.5734845",
"0.5725088",
"0.5701916",
"0.56577486",
"0.55907464",
"0.55387855",
"0.54646844",
"0.5409285",
"0.5400347",
"0.5400305",
"0.5360365",
"0.535128... | 0.0 | -1 |
Walk recursively through the directory tree (or a changeset) finding all files matched by the match function | def walk(node=nil, match = Match.create({}) { true })
self[node].walk match # calls Changeset#walk
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scan(dir,match=/\\.cha$/)\n files = []\n if not dir.split('/').pop =~ /^\\./ and File.directory?(dir)\n Dir.foreach(dir) do |file|\n path = File.join(dir,file)\n \n if File.directory?(path)\n# puts \"SCANNING #{path}\"\n scan(path,match).each { |pair| files.push pair }\n ... | [
"0.69755334",
"0.68214655",
"0.67111254",
"0.66254663",
"0.65483123",
"0.65326715",
"0.6514737",
"0.64703244",
"0.64703244",
"0.6438013",
"0.6428561",
"0.641164",
"0.6361264",
"0.6334811",
"0.633377",
"0.63322365",
"0.63203394",
"0.63142926",
"0.6265564",
"0.6250032",
"0.6243... | 0.0 | -1 |
Returns the requested file at the given revision annotated by line number, so you can see who committed which lines in the file's history. | def annotate(file, revision=nil, opts={})
changeset = self[revision]
changeset[file].annotate opts[:follow_copies], opts[:line_numbers]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_indexfile_with_revision revision\n result = nil\n File.open(@indexfile, \"r\") do |f|\n f.each_line do |line|\n row = parse_indexfile_line(line)\n if row[0] == revision\n result = line\n ... | [
"0.73264647",
"0.6649405",
"0.65299493",
"0.6428069",
"0.63594115",
"0.6322476",
"0.6293284",
"0.62274486",
"0.6151694",
"0.614042",
"0.61345375",
"0.61319715",
"0.61105645",
"0.6098361",
"0.6090153",
"0.6060246",
"0.6040373",
"0.6033428",
"0.5984833",
"0.59537005",
"0.593947... | 0.5950274 | 20 |
Clone a repository. Here is what this does, pretty much: % amp init monkey % cd monkey % amp pull It's so simple it's not even funny. | def clone(remote, opts={:revs => [], :stream => false})
# now, all clients that can request uncompressed clones can
# read repo formats supported by all servers that can serve
# them.
# The streaming case:
# if revlog format changes, client will have to check... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clone_repository\n `cd #{client.config.tmp_folder} && git clone #{client.config.repository_url}.git`\n `cd #{client.config.tmp_folder}/#{client.config.repository_name} && git fetch origin #{client.config.ref_tree} && git reset --hard FETCH_HEAD`\n end",
"def clone\n # We do the clone against the ta... | [
"0.74620795",
"0.7299338",
"0.7219529",
"0.72192895",
"0.71754664",
"0.7163331",
"0.7111901",
"0.7078534",
"0.69770116",
"0.69687873",
"0.69687873",
"0.69475293",
"0.6946116",
"0.69365716",
"0.69098294",
"0.6902619",
"0.6816792",
"0.67875975",
"0.67754096",
"0.6775231",
"0.67... | 0.0 | -1 |
Stream in the data from +remote+. | def stream_in(remote)
remote.stream_out do |f|
l = f.gets # this should be the server code
unless Integer(l)
raise ResponseError.new("Unexpected response from server: #{l}")
end
case l.to_i
when 1
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remote_to_local!\n if not @remote_io or not @local_io\n raise Exception::new(\"Copy request from remote to local stream, but no local and/or remote stream have been assigned.\")\n end\n \n @local_io.acquire do |lio|\n ... | [
"0.6757016",
"0.67071885",
"0.6580707",
"0.61973405",
"0.59445393",
"0.5927389",
"0.5927146",
"0.5858771",
"0.5853762",
"0.5853762",
"0.5853762",
"0.5853762",
"0.57092315",
"0.5703417",
"0.57027185",
"0.5698763",
"0.56765467",
"0.56612927",
"0.5646734",
"0.5643399",
"0.558684... | 0.7746728 | 0 |
Invalidate the repository: delete things and reset others. | def invalidate!
@changelog = nil
@manifest = nil
invalidate_tag_cache!
invalidate_branch_cache!
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset!\n storage.map(&:repository).map { |repository| repository.send(:reset) }\n\n true\n end",
"def reset!\n all.map { |repository| repository.send(:reset) }\n\n true\n end",
"def reset\n @git = nil\n @configuration = nil\n end",
"def purge\n self.files.each do... | [
"0.69558316",
"0.67873347",
"0.66815186",
"0.6580077",
"0.6373199",
"0.634613",
"0.63309324",
"0.63127923",
"0.62911654",
"0.6280333",
"0.627057",
"0.6264798",
"0.62252045",
"0.62214196",
"0.621714",
"0.6202692",
"0.6199944",
"0.6171848",
"0.616058",
"0.61452174",
"0.61080086... | 0.6205363 | 15 |
Make the dummy changelog at .hg/00changelog.i | def make_changelog
@hg_opener.open "00changelog.i", "w" do |file|
file.write "\0\0\0\2" # represents revlogv2
file.write " dummy changelog to avoid using the old repo type"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def changelog\n return @changelog if @changelog\n \n @changelog = Amp::Mercurial::ChangeLog.new @store.opener\n \n if path = ENV['HG_PENDING']\n if path =~ /^#{root}/\n @changelog.read_pending('00changelog.i.a')\n end\n end\n ... | [
"0.68549937",
"0.681813",
"0.67133796",
"0.67094916",
"0.6273885",
"0.6187471",
"0.60833734",
"0.6038037",
"0.58455807",
"0.5827014",
"0.5768288",
"0.57622623",
"0.5704744",
"0.56333953",
"0.56120694",
"0.5592841",
"0.55814916",
"0.5577917",
"0.5510105",
"0.5508323",
"0.54661... | 0.824122 | 0 |
Write the requirements file. This returns the requirements passed so that it can be the final method call in init | def write_requires(requirements)
@hg_opener.open "requires", "w" do |require_file|
requirements.each {|r| require_file.puts r }
end
requirements
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def requirements_path\n if ::File.directory?(new_resource.path)\n ::File.join(new_resource.path, 'requirements.txt')\n else\n new_resource.path\n end\n end",
"def write_gemspec; end",
"def get_require_file\n File.new(@file_to_be_written, 'w')\n end",
... | [
"0.6551707",
"0.6492403",
"0.6473386",
"0.59886265",
"0.5864452",
"0.5862334",
"0.5791958",
"0.57900923",
"0.57900923",
"0.5760111",
"0.5633634",
"0.5629568",
"0.5621585",
"0.5572039",
"0.5572039",
"0.5572039",
"0.5572039",
"0.5571197",
"0.55599934",
"0.55152386",
"0.5496124"... | 0.7697837 | 0 |
do a binary search used by common_nodes Hash info! :find => the stuff we're searching through :on_find => what to do when we've got something new :repo => usually the remote repo where we get new info from :node_map => the nodes in the current changelog | def binary_search(opts={})
# I have a lot of stuff to do for scouts
# but instead i'm doing this
# hizzah!
count = 0
until opts[:find].empty?
new_search = []
count += 1
zipped = opts[:find].zip opts[:repo].betw... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_nodes\n puts '1st pass: find nodes'\n find :nodes\n self\n end",
"def find; end",
"def find(args, mode); end",
"def common_nodes(remote, opts={:heads => nil, :force => nil, :base => nil})\n # variable prep!\n node_map = changelog.node_map\n search = []\... | [
"0.6281388",
"0.607883",
"0.5914292",
"0.58985704",
"0.5719346",
"0.5719346",
"0.56965035",
"0.56779325",
"0.5523633",
"0.5521678",
"0.5511787",
"0.550695",
"0.55064297",
"0.55038124",
"0.5501292",
"0.5501292",
"0.5501292",
"0.5501292",
"0.5501292",
"0.5497941",
"0.5466692",
... | 0.7291406 | 0 |
this is called before every push | def pre_push(remote, opts={})
common = {}
remote_heads = remote.heads
inc = common_nodes remote, :base => common, :heads => remote_heads, :force => true
inc = inc[1]
update, updated_heads = find_outgoing_roots remote, :base => common, :heads => remote_heads
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_push\n ## empty\n end",
"def push\n end",
"def push\n end",
"def prePushListener\n end",
"def push(x)\n \n end",
"def push(x)\n \n end",
"def push(val)\n \n end",
"def push_dup; end",
"def push(item); end",
"def before_appending( state )\n\t... | [
"0.73274666",
"0.7152823",
"0.71273655",
"0.68044406",
"0.6676415",
"0.6676415",
"0.6547537",
"0.6519512",
"0.6446283",
"0.6396222",
"0.632441",
"0.63173336",
"0.62502253",
"0.6220525",
"0.60191905",
"0.60045135",
"0.5986376",
"0.5983843",
"0.5971736",
"0.5952509",
"0.5941916... | 0.0 | -1 |
Returns back a class with all the information of the document and with convenience methods to access it. TODO: Yield builder to factor out builder dependency. | def to_representor
Representor.new(to_representor_hash)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def document\n return TypeElement.new({name: 'document', content: @document}, main_element: self)\n end",
"def document\n self\n end",
"def document\n self\n end",
"def to_doc\n logger.debug \"creating doc for class: #{self.class.name}, id: #{self.id}\"\n # Churn... | [
"0.73445606",
"0.700424",
"0.700424",
"0.69842255",
"0.6844522",
"0.6660665",
"0.66374665",
"0.66167575",
"0.6576793",
"0.65598893",
"0.6544577",
"0.65358716",
"0.65325284",
"0.65126866",
"0.6511441",
"0.64357203",
"0.63928235",
"0.6389348",
"0.6385088",
"0.6376399",
"0.63437... | 0.0 | -1 |
Returns a hash representation of the data. This is useful to merge with new data which may be built by different builders. In this class we use it to support embedded resources. | def to_representor_hash(options = {})
raise "Abstract method #to_representor_hash not implemented in #{self.name} deserializer class."
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash\n data.hash\n end",
"def hash\n [ data, type ].hash\n end",
"def to_hash\n @data\n end",
"def to_hash\n @data\n end",
"def hash\n [_hash, name, owner].hash\n end",
"def to_hash()\n @data\n end",
"def to_hash\n @data.to_hash\n end"... | [
"0.80086994",
"0.7373065",
"0.7339643",
"0.7307808",
"0.7305225",
"0.72783995",
"0.7198634",
"0.71502745",
"0.7126156",
"0.71115285",
"0.7084844",
"0.7063041",
"0.70594984",
"0.70182616",
"0.70079297",
"0.699331",
"0.69872653",
"0.6917463",
"0.6911724",
"0.68952554",
"0.68619... | 0.0 | -1 |
check existence for username | def username
respond_to do |format|
format.json { render :ok, json: @user.username.to_json }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def username_exists?(username)\n return User.find_by_username(username.downcase) != nil\nend",
"def user_exists?(username)\n users(username: username).present?\n end",
"def username_exists?(username)\n return User.find_by_username(username) != nil\nend",
"def exists?(username)\n !!find(u... | [
"0.8396086",
"0.837267",
"0.83344716",
"0.8321825",
"0.83163655",
"0.8219548",
"0.8185759",
"0.81749004",
"0.81649685",
"0.8111977",
"0.8083921",
"0.80332243",
"0.80047154",
"0.7933784",
"0.7923937",
"0.78101814",
"0.7739906",
"0.77369845",
"0.77276397",
"0.77100873",
"0.7685... | 0.0 | -1 |
Returns a list of tags starting with the given search query | def tag_search(query, options = {})
response = get("tags/search", options.merge(q: query))
response
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tags\n query = params[:q]\n if query[-1,1] == \" \"\n query = query.gsub(\" \", \"\")\n Tag.find_or_create_by_name(query)\n end\n\n #Do the search in memory for better performance\n\n @tags = ActsAsTaggableOn::Tag.all\n @tags = @tags.select { |v| v.name =~ /#{query}/i }\n respond... | [
"0.6973151",
"0.6679319",
"0.65904194",
"0.6401629",
"0.62964773",
"0.6226012",
"0.6206807",
"0.61731946",
"0.615",
"0.6081959",
"0.60727435",
"0.6058973",
"0.60562235",
"0.60376054",
"0.60211426",
"0.600388",
"0.5954648",
"0.59523684",
"0.59303427",
"0.5925946",
"0.5917329",... | 0.7033226 | 0 |
This method needs to return a grid of 'cells' with value and rag_rating properties | def to_csv
csv = @stats.to_csv(row_names_as_first_column: false, superheadings:)
csv.map.with_index do |row, row_index|
row.map.with_index do |item, item_index|
# data rows start after 2 superheadings + 1 heading
if row_index <= superheadings.size
header_cell row_inde... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cells\n @cells\n end",
"def cells\n @cells\n end",
"def cells\n @cells ||= []\n end",
"def cells\n attributes.fetch(:cells)\n end",
"def cells\n rows.flatten\n end",
"def cells\n rows.map { |r| r[key] }\n end",
"def cell_columns\n c... | [
"0.68071514",
"0.68071514",
"0.6773259",
"0.6720487",
"0.6678474",
"0.65760905",
"0.6524425",
"0.6471959",
"0.63820016",
"0.6331494",
"0.63155514",
"0.6249447",
"0.6232901",
"0.622149",
"0.6112239",
"0.6097088",
"0.6079362",
"0.6046104",
"0.6045264",
"0.6038411",
"0.6036712",... | 0.0 | -1 |
uncomment when you have Enumerable included | def to_s
pairs = inject([]) do |strs, (k, v)|
strs << "#{k.to_s} => #{v.to_s}"
end
"{\n" + pairs.join(",\n") + "\n}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inclusions; end",
"def through; end",
"def collect; end",
"def refute_includes(collection, obj, msg = T.unsafe(nil)); end",
"def includes\n []\n end",
"def exclude; end",
"def each_identity; end",
"def excluded; end",
"def inclusions=(_arg0); end",
"def includes() return @includes... | [
"0.59435934",
"0.5794355",
"0.5722233",
"0.5718117",
"0.569589",
"0.5684911",
"0.5664752",
"0.566228",
"0.5641536",
"0.5562596",
"0.55595744",
"0.5515245",
"0.5475617",
"0.5450039",
"0.5450039",
"0.54184806",
"0.53960466",
"0.53936493",
"0.53872144",
"0.5383926",
"0.53793705"... | 0.0 | -1 |
Time Complexity O(n^2) Space Complexity O(n^2) | def super_digit(n)
n_array = n.to_s.split('').map {|i| i.to_i}
return n if n_array.length == 1
return super_digit(n_array.sum)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_dublicate(array)\n sum = 1000000*(1000000+1)/2 # (n*(n+1))/2\n array.each do |el| \n sum -= el\n end\n return sum\nend",
"def solution(a)\r\n n=a.size\r\n i=1\r\n for k in a.sort do\r\n\tif k!=i \r\n\t then \r\n\t return 0\r\n\t break;\r\n\tend\r\n i+=1;\r\... | [
"0.6752282",
"0.6598682",
"0.61865854",
"0.6060802",
"0.6046002",
"0.60300565",
"0.60288256",
"0.5983093",
"0.5964413",
"0.5960087",
"0.59534085",
"0.594736",
"0.59406906",
"0.5871909",
"0.58693224",
"0.58681345",
"0.5827025",
"0.5826917",
"0.58239305",
"0.58213913",
"0.58199... | 0.0 | -1 |
Time Complexity O(n^2) Space Complexity O(n^2) | def refined_super_digit(n, k)
new_n = (n.to_s * k).to_i
return super_digit(new_n)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_dublicate(array)\n sum = 1000000*(1000000+1)/2 # (n*(n+1))/2\n array.each do |el| \n sum -= el\n end\n return sum\nend",
"def solution(a)\r\n n=a.size\r\n i=1\r\n for k in a.sort do\r\n\tif k!=i \r\n\t then \r\n\t return 0\r\n\t break;\r\n\tend\r\n i+=1;\r\... | [
"0.6751567",
"0.65980524",
"0.61872053",
"0.6062173",
"0.604579",
"0.6029691",
"0.60295826",
"0.59826595",
"0.5963548",
"0.59594685",
"0.5953375",
"0.59468997",
"0.594042",
"0.58729196",
"0.5869789",
"0.5868531",
"0.5827024",
"0.5826698",
"0.58235437",
"0.5821605",
"0.5820182... | 0.0 | -1 |
Similar to the class method prepare. | def initialize(conn, sql)
@connection = conn
@call = @connection.prepare_call(sql)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prepare\n end",
"def prepare\n end",
"def prepare\n end",
"def prepare\n end",
"def prepare\n end",
"def prepare\n end",
"def prepare\n end",
"def prepare\n end",
"def prepare\n end",
"def prepare\n end",
"def prepare; end",
"def prepare; end",
"def p... | [
"0.8683636",
"0.8683636",
"0.8683636",
"0.8683636",
"0.8683636",
"0.8683636",
"0.8683636",
"0.85820657",
"0.85820657",
"0.8551253",
"0.8498723",
"0.8498723",
"0.8498723",
"0.8456653",
"0.84072846",
"0.84072846",
"0.8163392",
"0.8153791",
"0.79925424",
"0.7929667",
"0.7849333"... | 0.0 | -1 |
Allows the bound values to be retrieved along with OUT or IN OUT parameters. The bind variables are indexed from 1. If a refcursor is returned, it is retrieved as a SimpleOracleJDBC::Sql object. Other values are returned as Ruby classes, such as Date, Time, String, Float etc. | def [](i)
if i < 1
raise BindIndexOutOfRange, "Bind indexes must be greater or equal to one"
end
bind = @binds[i-1]
if bind.is_a? Array
# If its an array, it means it was in OUT or INOUT parameter
if bind[0] == Date
retrieve_date(@call, i)
elsif... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def query(sql, name, binds)\n \n rs = SA.instance.api.sqlany_execute_direct(@connection, sql)\n raise ActiveRecord::StatementInvalid.new(\"#{SA.instance.api.sqlany_error(@connection)}:#{sql}\") if rs.nil?\n \n max_cols = SA.instance.api.sqlany_num_cols(rs)\n fiel... | [
"0.6227915",
"0.606142",
"0.6003634",
"0.5768508",
"0.575531",
"0.5734462",
"0.5700084",
"0.5673832",
"0.5637915",
"0.561138",
"0.5603661",
"0.55710685",
"0.5531148",
"0.550729",
"0.5454121",
"0.5452548",
"0.5428064",
"0.5423365",
"0.53872377",
"0.53668654",
"0.5358991",
"0... | 0.70315295 | 0 |
Closes the callable statement | def close
if @call
@call.close
@call = nil
end
@bind = nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close\n @stmt.close\n end",
"def close( &block )\n compile!( :close!, &block )\n end",
"def close\n @stmt.close\n end",
"def close\n if open? then\n @stmt_api.close\n @open = false\n end\n end",
"def close\n statement = \"close #{@name}\"\n ... | [
"0.7211657",
"0.7097819",
"0.706718",
"0.689118",
"0.67901057",
"0.6574923",
"0.6541189",
"0.6541189",
"0.6541189",
"0.6541189",
"0.65378094",
"0.65375954",
"0.6483254",
"0.6483254",
"0.64763635",
"0.64053655",
"0.63965017",
"0.6310008",
"0.63088566",
"0.6289503",
"0.6282996"... | 0.6676703 | 5 |
Outputs the corresponding flash message if any are set | def flash_messages
%w(notice warning error).map do |msg|
content_tag(:script,
"$.jGrowl(\"#{flash.delete(msg.to_sym)}\", { header: '#{t(msg, :default => msg).mb_chars.titleize}', sticky: true, theme: '#{msg}' });".html_safe
) unless flash[msg.to_sym].blank?
end.join("\n").html_safe
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display_flash_message\n type = nil\n message = nil\n\n if flash[:error]\n type = 'error'\n message = flash[:error]\n elsif flash[:success]\n type = 'success'\n message = flash[:success]\n elsif flash[:info]\n type = 'info'\n message = flash[:info]\n e... | [
"0.7853185",
"0.7623813",
"0.7464963",
"0.74427426",
"0.7371555",
"0.7288088",
"0.7282568",
"0.7263154",
"0.72256833",
"0.72076195",
"0.7191742",
"0.7177645",
"0.71642697",
"0.7160001",
"0.70912445",
"0.70912445",
"0.70813227",
"0.70759934",
"0.70464104",
"0.70392144",
"0.701... | 0.6732883 | 50 |
Actually used as the update method since Settings is a singleton model | def create
Settings.instance.update!(update_params)
render_json_message(:ok, message: "Settings successfully updated!",
resource: Settings.instance.serialize)
rescue
render_json_message(:forbidden, errors: ["Unable to update settings."])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_settings\n end",
"def update_settings(opts = {})\n update(Settings, opts)\n end",
"def update\n\n ok = true\n # Save settings\n @setting = Setting.get_settings\n if @setting.update(settings_params)\n # Notify to the music server the settings change\n execute_music_cmd_chec... | [
"0.8374154",
"0.7501796",
"0.7480412",
"0.74125016",
"0.73423195",
"0.7176603",
"0.71379656",
"0.70307875",
"0.68548864",
"0.68464804",
"0.67418957",
"0.6737411",
"0.66859114",
"0.66781664",
"0.6649346",
"0.6634169",
"0.6633243",
"0.6633243",
"0.6620301",
"0.66081",
"0.660749... | 0.6734854 | 12 |
Return a new instance of Vedeu::Buffers::Refresh. | def initialize(name, options = {})
@name = present?(name) ? name : Vedeu.focus
@options = options
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def refresh!(*args)\n alloc(*args).refresh!\n end",
"def refresh(*args)\n alloc(*args).refresh\n end",
"def refresh\n self.class.new(__getobj__)\n end",
"def refresh\n generate_part_rects\n generate_buffers\n self\n end",
"def refresh(op)\n check_connection\n ... | [
"0.6597862",
"0.65905416",
"0.65418553",
"0.63711494",
"0.57677835",
"0.5767594",
"0.5749818",
"0.5648088",
"0.5590448",
"0.55595976",
"0.55447555",
"0.5536774",
"0.5536774",
"0.5503323",
"0.5503323",
"0.54391533",
"0.54382426",
"0.54154885",
"0.5395669",
"0.5375645",
"0.5361... | 0.0 | -1 |
Calculate triangle number given n rows/height | def generate_triangle_number(n)
triangle_number = 0
i = n
until i == 0
triangle_number += i
i -= 1
end
evaluate_divisors(triangle_number)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nth_triangle_number(n)\n n * (n + 1) / 2\nend",
"def pascals_triangle(n)\n triangle = []\n (1..n).each do |line|\n level = []\n num = 1\n (1..line).each do |idx|\n level << num\n num = (num * (line - idx) / idx)\n end\n triangle << level\n end\n triangle\nend",
"def triangle(n... | [
"0.764592",
"0.7626071",
"0.75232124",
"0.74519247",
"0.7433058",
"0.73891103",
"0.7356646",
"0.71684355",
"0.7152016",
"0.71252733",
"0.7112354",
"0.7088018",
"0.7084461",
"0.70843077",
"0.70581543",
"0.70154005",
"0.70140564",
"0.70087636",
"0.6993813",
"0.6966492",
"0.6944... | 0.69864887 | 19 |
Evaluate how many divisors in the triangle number | def evaluate_divisors(triangle_number)
i = 1
divisors = []
# Make use of the pairs that multiplied together equal the triangle number.
# Take 100. 1x100, 2x50, 4X25, 5x20, 10x10
# This way, only have to iterate up to the square root of triangle number.
until i > Math.sqrt(tri... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def triangle_num\n\ndivisors = 0\nn = 2\n\nuntil divisors > 500\n\tsum = 0\n\t(1..n).to_a.each do |x| sum += x end\n\t(1..sum - 1).to_a.each do |y|\n\t\tif sum % y == 0\n\t\t\tdivisors += 1\n\t\t\tif divisors > 500 \n\t\t\t\treturn sum\n\t\t\tend\n\t\tend\n\tend\ndivisors = 0\nn += 1\nend\nend",
"def triangle_di... | [
"0.82296604",
"0.8143207",
"0.81398165",
"0.7842163",
"0.77850443",
"0.7691037",
"0.76255774",
"0.74562144",
"0.7368641",
"0.7292482",
"0.72855914",
"0.71922415",
"0.7156616",
"0.7148257",
"0.7094227",
"0.70515954",
"0.7044603",
"0.70225793",
"0.70206803",
"0.7009186",
"0.698... | 0.76316786 | 6 |
Use callbacks to share common setup or constraints between actions. | def set_auction_trade
@auction_trade = Auction::Trade.includes(:account, :contact).find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def auction_trade_params
params.require(:auction_trade).permit(:status, :delivery_phone, :delivery_service)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Provide a default URL as a default if there hasn't been a file uploaded: | def default_url
"/images/fallback/" + [version_name, "network-thumb-default.png"].compact.join("_")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def url_with_default *args\n unless file_name.nil?\n url_without_default *args\n else\n nil\n end\n end",
"def default_url\n nil\n end",
"def default_url\n end",
"def default_url\n url 'default'\n end",
"def default_url\n file_path = [\n 'fallbacks',\n ... | [
"0.78820795",
"0.7755238",
"0.7460105",
"0.71573985",
"0.71373206",
"0.7076604",
"0.69839376",
"0.6944093",
"0.6933636",
"0.69253147",
"0.69225186",
"0.69225186",
"0.69225186",
"0.691627",
"0.69160384",
"0.69052",
"0.6885369",
"0.6867388",
"0.68587524",
"0.68285525",
"0.67736... | 0.6486854 | 48 |
Gets registration data from user. Redirected from register.haml with Form. Checks if incoming data is correct and redirects to login. If data is correct redirect to '/register'. Should get parameter :name User name :password User password :email User email optional :description A description of the user optional :avata... | def are_nil?(*args)
result = false
args.each do |arg|
result = result || arg == nil
end
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def register\n @title=\"Register\"\n if param_posted?(:user)\n \n #output goes to log file (log/development.log in development mode)\n #logger.info params[:user].inspect\n \n #output goes to browser\n #raise params[:user].inspect\n \n @user=User.new(params[:user])\n ... | [
"0.6608667",
"0.64994687",
"0.64831805",
"0.6380505",
"0.6369364",
"0.6345062",
"0.6341615",
"0.6308116",
"0.63080287",
"0.629425",
"0.6291172",
"0.62513256",
"0.61825585",
"0.6181843",
"0.6172908",
"0.61464113",
"0.6111394",
"0.609682",
"0.60772306",
"0.6065194",
"0.605781",... | 0.0 | -1 |
GET /good_guys GET /good_guys.json | def index
@good_guys = GoodGuy.all.includes(:good_deeds).shuffle
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @guys = Guy.all\n respond_to do |format|\n format.json { render json: @guys }\n end\n end",
"def show\n @good = Good.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @good }\n end\n end",
"def show\n @ne... | [
"0.7262162",
"0.64940894",
"0.6477809",
"0.6303792",
"0.6252078",
"0.6221917",
"0.61527973",
"0.6149291",
"0.614136",
"0.60609615",
"0.59929335",
"0.59824455",
"0.5973262",
"0.5968058",
"0.58808595",
"0.58687055",
"0.5867922",
"0.58498013",
"0.58182734",
"0.5817454",
"0.58171... | 0.0 | -1 |
GET /good_guys/1 GET /good_guys/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @guys = Guy.all\n respond_to do |format|\n format.json { render json: @guys }\n end\n end",
"def show\n @good = Good.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @good }\n end\n end",
"def show\n @ne... | [
"0.72233754",
"0.6647185",
"0.6612936",
"0.636873",
"0.63214713",
"0.6307899",
"0.6264122",
"0.62197345",
"0.6150679",
"0.6141984",
"0.6118969",
"0.6116801",
"0.6090032",
"0.6054465",
"0.60070914",
"0.6001921",
"0.5989054",
"0.5967933",
"0.5956606",
"0.59542423",
"0.59542423"... | 0.0 | -1 |
POST /good_guys POST /good_guys.json | def create
@good_guy = GoodGuy.new(good_guy_params)
respond_to do |format|
if @good_guy.save
format.html { redirect_to @good_guy, notice: 'Good guy was successfully created.' }
format.json { render :show, status: :created, location: @good_guy }
else
format.html { render :new... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @good = Good.new(good_params)\n\n respond_to do |format|\n if @good.save\n format.html { redirect_to @good, notice: 'Good was successfully created.' }\n format.json { render :show, status: :created, location: @good }\n else\n format.html { render :new }\n fo... | [
"0.64624846",
"0.641077",
"0.6395472",
"0.61120373",
"0.6073244",
"0.60215056",
"0.5939698",
"0.5928143",
"0.58799624",
"0.58751255",
"0.5824567",
"0.5794459",
"0.5776177",
"0.57629776",
"0.5747823",
"0.5743298",
"0.574138",
"0.573854",
"0.573009",
"0.57237613",
"0.5722173",
... | 0.6791228 | 0 |
PATCH/PUT /good_guys/1 PATCH/PUT /good_guys/1.json | def update
respond_to do |format|
if @good_guy.update(good_guy_params)
format.html { redirect_to @good_guy, notice: 'Good guy was successfully updated.' }
format.json { render :show, status: :ok, location: @good_guy }
else
format.html { render :edit }
format.json { render... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @good = Good.find(params[:id])\n\n respond_to do |format|\n if @good.update_attributes(params[:good])\n format.html { redirect_to :action => \"index\" }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { re... | [
"0.6584666",
"0.6529944",
"0.64555085",
"0.6375645",
"0.6356329",
"0.6301348",
"0.626718",
"0.6241615",
"0.6218634",
"0.62118703",
"0.6206121",
"0.61709386",
"0.6156664",
"0.61542094",
"0.61005884",
"0.60870403",
"0.6082751",
"0.6062951",
"0.6051499",
"0.6050829",
"0.6047392"... | 0.6538338 | 1 |
DELETE /good_guys/1 DELETE /good_guys/1.json | def destroy
@good_guy.destroy
respond_to do |format|
format.html { redirect_to good_guys_url, notice: 'Good guy was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n client.delete(\"/#{id}\")\n end",
"def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_respons... | [
"0.69546044",
"0.6882099",
"0.67660236",
"0.67631215",
"0.6741473",
"0.67300266",
"0.667693",
"0.6674071",
"0.6648727",
"0.66476655",
"0.6645262",
"0.6615542",
"0.66109866",
"0.660537",
"0.6601871",
"0.65976405",
"0.65865266",
"0.6584972",
"0.65535325",
"0.6552889",
"0.655004... | 0.6751279 | 4 |
Use callbacks to share common setup or constraints between actions. | def set_good_guy
@good_guy = GoodGuy.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def good_guy_params
params.require(:good_guy).permit(:name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.6980957",
"0.6783065",
"0.6747844",
"0.6741468",
"0.67356336",
"0.6592548",
"0.65036845",
"0.64978707",
"0.64825076",
"0.64795035",
"0.64560914",
"0.64397955",
"0.6379666",
"0.6376688",
"0.6366702",
"0.6319728",
"0.6300833",
"0.6300629",
"0.6294277",
"0.6293905",
"0.629117... | 0.0 | -1 |
Method to display error for invalid entry or look up area code and disply just the city name based on the user's city choice | def area_code_search(city)
if $dictionary.has_key?(city) == false
puts "You have entered an invalid city."
else
area_code = $dictionary.values_at(city)
puts "The area code for #{city} is #{area_code.join}!"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_area_code(cities, city_name)\n if !cities.key?(city_name)\n puts \"\\nInvalid city. Please try again.\"\n else\n puts \"\\n#{city_name} is #{cities[city_name]}\"\n end\nend",
"def check_area_code(somehash, city)\n area_code = somehash[city]\n if area_code \n return \"The area code for #{cit... | [
"0.7322102",
"0.665225",
"0.63573134",
"0.62400943",
"0.62244517",
"0.6183724",
"0.61718655",
"0.6137742",
"0.61129576",
"0.6102834",
"0.6089096",
"0.6084804",
"0.6084727",
"0.6063849",
"0.60520685",
"0.6045515",
"0.60312635",
"0.6025217",
"0.5994725",
"0.59686565",
"0.596865... | 0.6622344 | 2 |
There is currently a bug in the scoping code for dmcore which hasn't yet been addressed. This is my hack to get everything working as we need it to. [ ] | def with_scope_with_and(query, &block)
if Query === query && Query::Conditions::AbstractOperation === query.conditions
query = query.dup
scope_stack = self.scope_stack
scope_stack << query
begin
yield
ensure
scope_stack.pop
end... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scope; end",
"def scope; end",
"def scope; end",
"def scope; end",
"def scope; end",
"def scope; end",
"def scope; end",
"def scope; end",
"def scope; end",
"def scope; end",
"def scope=(_); end",
"def scope=(_arg0); end",
"def scope=(_arg0); end",
"def scope=(_arg0); end",
"def sco... | [
"0.65774256",
"0.65774256",
"0.65774256",
"0.65774256",
"0.65774256",
"0.65774256",
"0.65774256",
"0.65774256",
"0.65774256",
"0.65774256",
"0.6558772",
"0.62793094",
"0.62793094",
"0.62793094",
"0.6274005",
"0.62394154",
"0.6238054",
"0.61807656",
"0.6173517",
"0.6154846",
"... | 0.0 | -1 |
validate the line payload | def valid_post_body?(post_body, signature)
hash = OpenSSL::HMAC.digest(OpenSSL::Digest.new('SHA256'), @channel.line_channel_secret, post_body)
Base64.strict_encode64(hash) == signature
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_line_items\n \n end",
"def valid?(line)\n true\n end",
"def validate_payload\n missing_required_fields = required_payload_fields - row_payload.keys\n if missing_required_fields.present?\n errors.add(:row_payload, \"Missing required payload field(s): '#{missing_required... | [
"0.7337308",
"0.7204579",
"0.6765211",
"0.6588329",
"0.65314686",
"0.6522981",
"0.6351062",
"0.6320629",
"0.6267607",
"0.6212608",
"0.61984426",
"0.60568154",
"0.6004496",
"0.5937415",
"0.5931633",
"0.5910689",
"0.58725864",
"0.5864394",
"0.5823755",
"0.5819264",
"0.5818958",... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.