Skip to content

Commit

Permalink
MAINT: Rework master to main throughout
Browse files Browse the repository at this point in the history
  • Loading branch information
HaoZeke committed Feb 1, 2024
1 parent f9c05ae commit 8dc2289
Show file tree
Hide file tree
Showing 22 changed files with 143 additions and 143 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: pre-commit
on:
pull_request:
push:
branches: [master]
branches: [main]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down
4 changes: 2 additions & 2 deletions asv.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
// project being benchmarked
"repo": ".",

// List of branches to benchmark. If not provided, defaults to "master"
// List of branches to benchmark. If not provided, defaults to "main"
// (for git) or "default" (for mercurial).
"branches": ["master"],
"branches": ["main"],

// The DVCS being used. If not set, it will be automatically
// determined from "repo" by looking at the protocol in the URL
Expand Down
2 changes: 1 addition & 1 deletion asv/commands/profiling.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def run(cls, conf, benchmark, revision=None, gui=None, output=None,
if env.python != "{0}.{1}".format(*sys.version_info[:2]):
raise util.UserError(
"Profiles must be run in the same version of Python as the "
"asv master process")
"asv main process")

benchmarks = Benchmarks.discover(conf, repo, environments,
[commit_hash],
Expand Down
6 changes: 3 additions & 3 deletions asv/commands/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ def setup_arguments(cls, subparsers):
Run a benchmark suite.
examples:
asv run master run for one branch
asv run master^! run for one commit (git)
asv run "--merges master" run for only merge commits (git)
asv run main run for one branch
asv run main^! run for one commit (git)
asv run "--merges main" run for only merge commits (git)
"""))

cls._setup_arguments(parser)
Expand Down
4 changes: 2 additions & 2 deletions asv/repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def get_new_range_spec(self, latest_result, branch=None):
"""
Returns a formatted string giving the results between the
latest result and the newest hash in a given branch.
If no branch given, use the 'master' branch.
If no branch given, use the 'main' branch.
"""
raise NotImplementedError()

Expand Down Expand Up @@ -230,7 +230,7 @@ class NoRepository(Repo):
"""

dvcs = "none"
_default_branch = "master"
_default_branch = "main"

def __init__(self, url=None, path=None):
self.url = None
Expand Down
4 changes: 2 additions & 2 deletions asv/template/asv.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@
// "install_command": ["in-dir={env_dir} python -mpip install {wheel_file}"],
// "uninstall_command": ["return-code=any python -mpip uninstall -y {project}"],

// List of branches to benchmark. If not provided, defaults to "master"
// List of branches to benchmark. If not provided, defaults to "main"
// (for git) or "default" (for mercurial).
// "branches": ["master"], // for git
// "branches": ["main"], // for git
// "branches": ["default"], // for mercurial

// The DVCS being used. If not set, it will be automatically
Expand Down
4 changes: 2 additions & 2 deletions asv/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -1279,8 +1279,8 @@ def git_default_branch():
[which('git'), 'config', '--system', 'init.defaultBranch'],
display_error=False).strip()
except ProcessError:
# Default to master when global and system are not set
default_branch = 'master'
# Default to main when global and system are not set
default_branch = 'main'
return default_branch


Expand Down
28 changes: 14 additions & 14 deletions asv/www/asv.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
$(document).ready(function() {
/* GLOBAL STATE */
/* The index.json content as returned from the server */
var master_timestamp = '';
var master_json = {};
var main_timestamp = '';
var main_json = {};
/* Extra pages: {name: show_function} */
var loaded_pages = {};
/* Previous window scroll positions */
Expand Down Expand Up @@ -284,7 +284,7 @@ $(document).ready(function() {
}
else {
$.ajax({
url: url + '?timestamp=' + $.asv.master_timestamp,
url: url + '?timestamp=' + $.asv.main_timestamp,
dataType: "json",
cache: true
}).done(function(data) {
Expand Down Expand Up @@ -417,17 +417,17 @@ $(document).ready(function() {
}

function get_commit_hash(revision) {
var commit_hash = master_json.revision_to_hash[revision];
var commit_hash = main_json.revision_to_hash[revision];
if (commit_hash) {
// Return printable commit hash
commit_hash = commit_hash.slice(0, master_json.hash_length);
commit_hash = commit_hash.slice(0, main_json.hash_length);
}
return commit_hash;
}

function get_revision(commit_hash) {
var rev = null;
$.each(master_json.revision_to_hash, function(revision, full_commit_hash) {
$.each(main_json.revision_to_hash, function(revision, full_commit_hash) {
if (full_commit_hash.startsWith(commit_hash)) {
rev = revision;
// break the $.each loop
Expand All @@ -438,15 +438,15 @@ $(document).ready(function() {
}

function init_index() {
/* Fetch the master index.json and then set up the page elements
/* Fetch the main index.json and then set up the page elements
based on it. */
$.ajax({
url: "index.json" + '?timestamp=' + $.asv.master_timestamp,
url: "index.json" + '?timestamp=' + $.asv.main_timestamp,
dataType: "json",
cache: true
}).done(function (index) {
master_json = index;
$.asv.master_json = index;
main_json = index;
$.asv.main_json = index;

/* Page title */
var project_name = $("#project-name")[0];
Expand Down Expand Up @@ -475,8 +475,8 @@ $(document).ready(function() {
dataType: "json",
cache: false
}).done(function (info) {
master_timestamp = info['timestamp'];
$.asv.master_timestamp = master_timestamp;
main_timestamp = info['timestamp'];
$.asv.main_timestamp = main_timestamp;
init_index();
}).fail(function () {
$.asv.ui.network_error();
Expand All @@ -503,8 +503,8 @@ $(document).ready(function() {
this.get_commit_hash = get_commit_hash;
this.get_revision = get_revision;

this.master_timestamp = master_timestamp; /* Updated after info.json loads */
this.master_json = master_json; /* Updated after index.json loads */
this.main_timestamp = main_timestamp; /* Updated after info.json loads */
this.main_json = main_json; /* Updated after index.json loads */

this.format_date_yyyymmdd = format_date_yyyymmdd;
this.format_date_yyyymmdd_hhmm = format_date_yyyymmdd_hhmm;
Expand Down
2 changes: 1 addition & 1 deletion asv/www/asv_ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ $(document).ready(function() {
$.asv.load_graph_data(
graph_url
).done(function (data) {
var params = $.asv.master_json.benchmarks[benchmark_basename].params;
var params = $.asv.main_json.benchmarks[benchmark_basename].params;
data = $.asv.filter_graph_data_idx(data, 0, parameter_idx, params);
var options = {
colors: ['#000'],
Expand Down
48 changes: 24 additions & 24 deletions asv/www/graphdisplay.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ $(document).ready(function() {

function get_x_from_revision(rev) {
if (date_scale) {
return $.asv.master_json.revision_to_date[rev];
return $.asv.main_json.revision_to_date[rev];
} else {
return rev;
}
Expand Down Expand Up @@ -150,12 +150,12 @@ $(document).ready(function() {
var stack = [tree];

/* Sort keys for tree construction */
var benchmark_keys = Object.keys($.asv.master_json.benchmarks);
var benchmark_keys = Object.keys($.asv.main_json.benchmarks);
benchmark_keys.sort();

/* Build tree */
$.each(benchmark_keys, function(i, bm_name) {
var bm = $.asv.master_json.benchmarks[bm_name];
var bm = $.asv.main_json.benchmarks[bm_name];
var parts = bm_name.split('.');
var i = 0;
var j;
Expand Down Expand Up @@ -299,7 +299,7 @@ $(document).ready(function() {
var y = item.datapoint[1];
var commit_hash = get_commit_hash(item.datapoint[0]);
if (commit_hash) {
var unit = $.asv.master_json.benchmarks[current_benchmark].unit;
var unit = $.asv.main_json.benchmarks[current_benchmark].unit;
showTooltip(
item.pageX, item.pageY,
$.asv.pretty_unit(y, unit) + " @ " + commit_hash);
Expand Down Expand Up @@ -328,7 +328,7 @@ $(document).ready(function() {
if (previous_hash !== commit_hash) {
previous_hash = commit_hash;
window.open(
$.asv.master_json.show_commit_url + previous_hash,
$.asv.main_json.show_commit_url + previous_hash,
'_blank');
}
}
Expand All @@ -348,7 +348,7 @@ $(document).ready(function() {
/*
Generic parameter selections
*/
var index = $.asv.master_json;
var index = $.asv.main_json;
if (!state || state_selection !== null) {
/*
Setup the default configuration on first load,
Expand Down Expand Up @@ -428,7 +428,7 @@ $(document).ready(function() {

function update_state_url(params) {
var info = $.asv.parse_hash_string(window.location.hash);
$.each($.asv.master_json.params, function(param, values) {
$.each($.asv.main_json.params, function(param, values) {
if (values.length > 1) {
if (state[param].length != values.length || param == 'branch') {
info.params[param] = state[param];
Expand All @@ -445,7 +445,7 @@ $(document).ready(function() {
}

function replace_params_ui() {
var index = $.asv.master_json;
var index = $.asv.main_json;

var nav = $('#graphdisplay-state-params');
nav.empty();
Expand Down Expand Up @@ -521,8 +521,8 @@ $(document).ready(function() {
}

function replace_benchmark_params_ui() {
var params = $.asv.master_json.benchmarks[current_benchmark].params;
var param_names = $.asv.master_json.benchmarks[current_benchmark].param_names;
var params = $.asv.main_json.benchmarks[current_benchmark].params;
var param_names = $.asv.main_json.benchmarks[current_benchmark].param_names;

/* Parameter selection UI */
var nav = $('#graphdisplay-navigation-params');
Expand Down Expand Up @@ -574,7 +574,7 @@ $(document).ready(function() {
if (rev === null) {
button.text("last");
} else {
var date_fmt = new Date($.asv.master_json.revision_to_date[rev]);
var date_fmt = new Date($.asv.main_json.revision_to_date[rev]);
button.text($.asv.get_commit_hash(rev)
+ " "
+ date_fmt.toUTCString());
Expand Down Expand Up @@ -659,7 +659,7 @@ $(document).ready(function() {
return;
}

var params = $.asv.master_json.benchmarks[current_benchmark].params;
var params = $.asv.main_json.benchmarks[current_benchmark].params;
x_coordinate_is_category = false;
if (x_coordinate_axis != 0) {
for (var j = 0; j < params[x_coordinate_axis-1].length; ++j) {
Expand Down Expand Up @@ -754,7 +754,7 @@ $(document).ready(function() {
if (current_benchmark) {
/* For the current set of enabled parameters, generate a
list of all the permutations we need to load. */
var state_permutations = $.grep($.asv.master_json.graph_param_list, function (params) {
var state_permutations = $.grep($.asv.main_json.graph_param_list, function (params) {
var ok = true;
$.each(state, function (key, values) {
if ($.inArray(params[key], values) == -1) {
Expand All @@ -767,14 +767,14 @@ $(document).ready(function() {
/* Find where the parameters are different. */
var different = find_different_properties(state_permutations);
/* For parameterized tests: names of benchmark parameters */
var params = $.asv.master_json.benchmarks[current_benchmark].params;
var param_names = $.asv.master_json.benchmarks[current_benchmark].param_names;
var params = $.asv.main_json.benchmarks[current_benchmark].params;
var param_names = $.asv.main_json.benchmarks[current_benchmark].param_names;
/* Selected permutations of benchmark parameters, omitting x-axis */
var selection = obj_copy(param_selection);
selection[x_coordinate_axis] = [null]; /* value not referenced, set to null */
var param_permutations = permutations(selection);

/* Generate a master list of URLs and legend labels for
/* Generate a main list of URLs and legend labels for
the graphs. */
var all = [];
$.each(state_permutations, function (i, perm) {
Expand Down Expand Up @@ -852,7 +852,7 @@ $(document).ready(function() {
series = $.asv.filter_graph_data(data,
x_coordinate_axis,
graph_content[0],
$.asv.master_json.benchmarks[current_benchmark].params);
$.asv.main_json.benchmarks[current_benchmark].params);
orig_graphs.push({
data: series,
label: graph_content[1],
Expand Down Expand Up @@ -980,11 +980,11 @@ $(document).ready(function() {
options.yaxis.max = Math.pow(10, max) * reference;

if (!reference_scale) {
options.yaxis.axisLabel = $.asv.master_json.benchmarks[current_benchmark].unit;
options.yaxis.axisLabel = $.asv.main_json.benchmarks[current_benchmark].unit;
}
}
else {
var unit = $.asv.master_json.benchmarks[current_benchmark].unit;
var unit = $.asv.main_json.benchmarks[current_benchmark].unit;
var unit_list = null;

if (unit == "seconds") {
Expand Down Expand Up @@ -1080,7 +1080,7 @@ $(document).ready(function() {
date_to_revision = {};
$.each(graphs, function(i, graph) {
$.each(graph.data, function(j, point) {
var date = $.asv.master_json.revision_to_date[point[0]];
var date = $.asv.main_json.revision_to_date[point[0]];
date_to_revision[date] = point[0];
point[0] = date;
});
Expand Down Expand Up @@ -1110,7 +1110,7 @@ $(document).ready(function() {
else {
graphs = orig_graphs;
}
var param_names = $.asv.master_json.benchmarks[current_benchmark].param_names;
var param_names = $.asv.main_json.benchmarks[current_benchmark].param_names;
options.xaxis.axisLabel = param_names[x_coordinate_axis-1];
}
}
Expand All @@ -1125,7 +1125,7 @@ $(document).ready(function() {
var markings = [];

if (x_coordinate_axis == 0) {
$.each($.asv.master_json.tags, function(tag, revision) {
$.each($.asv.main_json.tags, function(tag, revision) {
var x = get_x_from_revision(revision);
markings.push(
{ color: "#ddd", lineWidth: 1, xaxis: { from: x, to: x } }
Expand Down Expand Up @@ -1157,7 +1157,7 @@ $(document).ready(function() {
if (reference_scale) {
unit = 'relative';
} else {
unit = $.asv.master_json.benchmarks[current_benchmark].unit;
unit = $.asv.main_json.benchmarks[current_benchmark].unit;
}

var options = {
Expand Down Expand Up @@ -1342,7 +1342,7 @@ $(document).ready(function() {
var canvas = plot.getCanvas();
var xmin = plot.getAxes().xaxis.min;
var xmax = plot.getAxes().xaxis.max;
$.each($.asv.master_json.tags, function(tag, revision) {
$.each($.asv.main_json.tags, function(tag, revision) {
var x = get_x_from_revision(revision);
if (x >= xmin && x <= xmax) {
var p = plot.pointOffset({x: x, y: 0});
Expand Down
Loading

0 comments on commit 8dc2289

Please sign in to comment.