-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master' into 4556-view-filter-co…
…ntrols
- Loading branch information
Showing
1,151 changed files
with
24,270 additions
and
144,146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,7 @@ tmp/* | |
solr_runtime/* | ||
fl_notes.txt | ||
*.ini | ||
!ckan/migration/alembic.ini | ||
.noseids | ||
*~ | ||
.idea | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Change this variable if you are using another name for ckan/ckan's remote | ||
REMOTE=origin | ||
PR_ENDPOINT=https://api.github.com/repos/ckan/ckan/pulls | ||
|
||
prepare_branches() { | ||
echo List existing branches | ||
# awk filters out `master`, `release-something`, `dev-something` and `MAJOR.MINOR-something` branches | ||
custom_branches=$(git fetch $REMOTE && git branch -r --list $REMOTE/* | awk '{ if ($2 !~ /^[0-9]\.[0-9]|^release|^dev-|^master$|HEAD/) print $2}' FS=/) | ||
|
||
echo Calculate total amount of active PRs | ||
# github adds Link header, that contains reference to last page with results. And that helps us to define total number of pages | ||
last_page=$(curl -s -I $PR_ENDPOINT | grep '^Link' | sed -E 's/.*page=([[:digit:]]+).*rel="last".*/\1/') | ||
|
||
echo Compute branches that are in use by active PRs | ||
for ((i=1; i<=$last_page; i++)) | ||
do | ||
# Take JSON, get name of branch with feature, leave only those ones, that starts with `ckan:`. I think, that jq is much more nice way to process json, but i'm not sure, that every one has it. But if you do, | ||
# you can replace python's section with something like `| jq '.[] | .head.label' -r |` | ||
next_portion=$(curl -s "$PR_ENDPOINT?page=$i" | python -c 'import json, sys; raw=sys.stdin.read(); labels=[str(item["head"]["label"]) for item in json.loads(raw)]; print("\n".join(labels))' | grep '^ckan' | sed 's/^ckan://') | ||
used_branches="$used_branches\n$next_portion" | ||
echo [$i of $last_page parts processed] | ||
done; | ||
|
||
echo Compute list of branches that can be safetely removed | ||
tmp_file=$(mktemp) | ||
diff <(echo -e "$used_branches" | sort) <(echo -e "$custom_branches" | sort) --unchanged-line-format="" >> $tmp_file | ||
|
||
echo | ||
echo List of all branches that can be removed stored into $tmp_file. Review it\'s content and run \'$0 --apply $tmp_file\'. | ||
echo NOTE. This command requires write access to CKAN repository and will actually remove all branches that are listed in $tmp_file. | ||
} | ||
|
||
if [[ $# -gt 0 ]]; | ||
then | ||
case "$1" in | ||
-h|--help) | ||
echo Compute/remove unused branches | ||
echo Usage: $0 [--apply FILE_WITH_BRANCHES] | ||
;; | ||
--apply) | ||
shift | ||
if [[ -f $1 ]] | ||
then | ||
while read branch | ||
do | ||
git push $REMOTE --delete $branch | ||
done < $1 | ||
else | ||
echo File does not exist | ||
fi | ||
shift | ||
;; | ||
*) | ||
echo Check usage with: $0 --help | ||
;; | ||
esac | ||
else | ||
prepare_branches | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# encoding: utf-8 | ||
|
||
import os | ||
|
||
import click | ||
import logging | ||
from logging.config import fileConfig as loggingFileConfig | ||
|
||
log = logging.getLogger(__name__) | ||
|
||
|
||
def error_shout(exception): | ||
click.secho(str(exception), fg=u'red', err=True) | ||
|
||
|
||
click_config_option = click.option( | ||
u'-c', | ||
u'--config', | ||
default=None, | ||
metavar=u'CONFIG', | ||
help=u'Config file to use (default: development.ini)' | ||
) | ||
|
||
|
||
def load_config(config=None): | ||
from paste.deploy import appconfig | ||
if config: | ||
filename = os.path.abspath(config) | ||
config_source = u'-c parameter' | ||
elif os.environ.get(u'CKAN_INI'): | ||
filename = os.environ.get(u'CKAN_INI') | ||
config_source = u'$CKAN_INI' | ||
else: | ||
default_filename = u'development.ini' | ||
filename = os.path.join(os.getcwd(), default_filename) | ||
if not os.path.exists(filename): | ||
# give really clear error message for this common situation | ||
msg = u'ERROR: You need to specify the CKAN config (.ini) '\ | ||
u'file path.'\ | ||
u'\nUse the --config parameter or set environment ' \ | ||
u'variable CKAN_INI or have {}\nin the current directory.' \ | ||
.format(default_filename) | ||
exit(msg) | ||
|
||
if not os.path.exists(filename): | ||
msg = u'Config file not found: %s' % filename | ||
msg += u'\n(Given by: %s)' % config_source | ||
exit(msg) | ||
|
||
loggingFileConfig(filename) | ||
log.info(u'Using configuration file {}'.format(filename)) | ||
return appconfig(u'config:' + filename) |
Oops, something went wrong.