Skip to content

Commit

Permalink
Merge branch 'master' into feature/add-support-for-filtering-mrs-with…
Browse files Browse the repository at this point in the history
…-labels
  • Loading branch information
2-shell authored Aug 12, 2020
2 parents f90b3db + 105b60c commit 697934b
Show file tree
Hide file tree
Showing 2 changed files with 238 additions and 5 deletions.
230 changes: 230 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,230 @@

# Created by https://www.toptal.com/developers/gitignore/api/python,vim,linux,macos,windows
# Edit at https://www.toptal.com/developers/gitignore?templates=python,vim,linux,macos,windows

### Linux ###
*~

# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*

# KDE directory preferences
.directory

# Linux trash folder which might appear on any partition or disk
.Trash-*

# .nfs files are created when an open file is removed but is still being accessed
.nfs*

### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
pytestdebug.log

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/
doc/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

### Vim ###
# Swap
[._]*.s[a-v][a-z]
!*.svg # comment out if you don't need vector files
[._]*.sw[a-p]
[._]s[a-rt-v][a-z]
[._]ss[a-gi-z]
[._]sw[a-p]

# Session
Session.vim
Sessionx.vim

# Temporary
.netrwhist
# Auto-generated tag files
tags
# Persistent undo
[._]*.un~

### Windows ###
# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db

# Dump file
*.stackdump

# Folder config file
[Dd]esktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp

# Windows shortcuts
*.lnk

# End of https://www.toptal.com/developers/gitignore/api/python,vim,linux,macos,windows
13 changes: 8 additions & 5 deletions gitlab-manager
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,12 @@ class MergeRequest:
def print_mr(self):
return "### {}: {}\n\n{}\n\n * by: {}\n\n * Merge Request ID:{}\n".format(self.Label, self.Title, self.Description, self.Author, self.Id)

def list_mrs(project, wip, labels=[]):
def list_mrs(project, state, wip, labels=[]):
print("\nHere is the list of MRs for your chosen project:\n")
mrs = []
if len(labels) > 0:
mrs = project.mergerequests.list(state='opened', order_by='updated_at', wip=wip, labels=labels)
else:
mrs = project.mergerequests.list(state='opened', order_by='updated_at', wip=wip)
mrs = project.mergerequests.list(state=state, order_by='updated_at', wip=wip, labels=labels)
mrs = project.mergerequests.list(state=state, order_by='updated_at', wip=wip)
all_mr = ""
for mr in mrs:
current = MergeRequest(mr)
Expand Down Expand Up @@ -86,6 +85,10 @@ def init_argparse():
ls_mr = subparsers.add_parser('ls')
ls_mr.add_argument("--wip", dest='wip', action='store', type=str,
help='search wip or not', choices=['yes', 'no'])
ls_mr.add_argument("--state", dest='state', action='store', type=str,
help='filter for the specified state',
choices=['all', 'opened', 'closed', 'locked', 'merged'],
default='opened')
ls_mr.add_argument("--labels", dest='labels', action='store', type=str,
help='Comma separated list of labels to filter MRs for',
default='')
Expand Down Expand Up @@ -149,7 +152,7 @@ if __name__ == '__main__':
project = projects[0]
if args.command == "mr":
if args.action == "ls":
list_mrs(project, args.wip, [item for item in args.labels.split(',')])
list_mrs(project, args.state, args.wip, [item for item in args.labels.split(',')])
if args.action == "update":
update_mr(project, args.mr_id, args.label, args.tag)
if args.command == "changelog":
Expand Down

0 comments on commit 697934b

Please sign in to comment.