Skip to content

ficoos/python-gerrit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

python-gerrit

Gerrit bindings for python

The bindings are still a work in progress!

How to use

  • Connect to a server:
    import gerrit
    import paramiko

    pkey = paramiko.RSAKey(filename="/home/foo/.ssh/id_rsa.pub")
    username = "Bob"
    host = "example.com"
    port = 29418  # Default Gerrit ssh port

    g = Gerrit(host, port, username, pkey)
  • Query for changes:
    g = Gerrit(host, port, username, pkey)

    # Query for all changes in project 'bar' including comments
    changes = g.query("project:bar", options=[QueryOptions.Comments])
    for change in changes:
    	print change
  • Add a reviewer:
    g = Gerrit(host, port, username, pkey)

    # Query for all changes in project 'bar' including the current patch-set
    changes = g.query("project:bar", options=[QueryOptions.CurrentPatchSet])
    for change in changes:
    	revision = change['currentPatchSet']['revision']
    	g.set_reviewers(revision, add=[username])
  • Add a review
    g = Gerrit(host, port, username, pkey)

    # Query for all changes in project 'bar' including the current patch-set
    changes = g.query("project:bar", options=[QueryOptions.CurrentPatchSet])
    for change in changes:
    	revision = change['currentPatchSet']['revision']
    	g.review(revision, message="Hello World!")

About

Python bindings for Gerrit

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages