Giter VIP home page Giter VIP logo

Comments (3)

lynna-heng avatar lynna-heng commented on July 20, 2024

I looked at the module pullrequests.py and found the class below expects to pass in "parent".
What is the value of "parent'?

class PullRequest(ResourceBase):
def init(self, id, url, client, parent):
.
.
.

Thanks,
Lynna

from stashy.

lynna-heng avatar lynna-heng commented on July 20, 2024

Here's the errors I encountered when I compile the code. The issue is the "parent" parameter, and I don't know what should the right value. Please shed some light on this.

$python test.py
Traceback (most recent call last):
File "test.py", line 8, in
creq=req.create("Talking CLI PR Title", "refs/heads/test-pr-python", "refs/heads/master", description='CLI Python', state='OPEN', reviewers="monica")
File "", line 2, in create
File "/usr/lib/python2.7/site-packages/stashy/errors.py", line 62, in response_or_error
response = fn(*args, **kw)
File "/usr/lib/python2.7/site-packages/stashy/pullrequests.py", line 264, in create
fromRef=self._make_ref(fromRef, "fromRef"),
File "/usr/lib/python2.7/site-packages/stashy/pullrequests.py", line 248, in _make_ref
repo = self._parent.get()
AttributeError: 'str' object has no attribute 'get'

=================================================
$ cat test.py
import stashy
from stashy.pullrequests import PullRequest, PullRequests
stash=stashy.connect("http://mybitbucker.com:7990", "admin", "admin")
client=stash._client;
parent=""
req=PullRequests("http://mybitbucker.com:7990", client, parent)
creq=req.create("Talking CLI PR Title", "refs/heads/test-pr-python", "refs/heads/master", description='CLI Python', state='OPEN', reviewers="monica")

from stashy.

rwilcox avatar rwilcox commented on July 20, 2024

Ok, so here's what worked for me

import stashy
from stashy.pullrequests import PullRequest, PullRequests
stash=stashy.connect("http://mybitbucker.com:7990", "admin", "admin")
client=stash._client;

projectKey = 'PROJECT_KEY_FROM_THAT_PROJECT_LIST_COLUMN_IN_THE_UI'
repoKey = 'MY_DESTINATION_REPO'

project = stash.projects[projectKey]
parent= project.repos['repoKey]

req=PullRequests("/projects/" + projectKey + "/repos/" + repoKey + "/pull-requests", client, parent)
# ^^^^ you super need that /pull-requests part of the path!!!!

creq=req.create("Talking CLI PR Title", "refs/heads/test-pr-python", "refs/heads/master", description='CLI Python', state='OPEN', reviewers="monica")

from stashy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.