Forum Archive

StaSh, git commit & push command doesn't work

dtm4beginner

Sorry, I'm terrible with English.

I got Pythonista 3.
I install StaSh.

import requests as r; exec(r.get('http://bit.ly/get-stash').text)

Downloading https://github.com/ywangd/stash/archive/master.zip ...
Unzipping into /private/var/mobile/Containers/Shared/AppGroup/E1D01013-D52C-4279-AB99-5F5C352B53FD/Pythonista3/Documents/site-packages/stash ...
Preparing the folder structure ...
Installation completed.
Please Restart Pythonista and run launch_stash.py under the Home directory to start StaSh.

StaSh run on Py2.7 and I try git command

StaSh v0.7.0 on python 2.7.12
Tip: You can invoke almost any Python scripts, including UI and Scene, directly from StaSh

[~/Documents]$ git clone https://github.com/user/test.git test
dulwich was not found. Will attempt to download.
Need to download dulwich. OK to download [y/n]?y
Opening: https://github.com/jsbain/dulwich/archive/ForStaSH_0.12.2.zip

Save as: /private/var/mobile/Containers/Data/Application/9AB2D22D-74F9-4093-BBDC-825D0D343B18/tmp//dulwich.zip (??? bytes)
400490
/private/var/mobile/Containers/Shared/AppGroup/E1D01013-D52C-4279-AB99-5F5C352B53FD/Pythonista3/Documents/site-packages/stash/lib/dulwich.old: does not exist
mv: /private/var/mobile/Containers/Shared/AppGroup/E1D01013-D52C-4279-AB99-5F5C352B53FD/Pythonista3/Documents/site-packages/stash/lib/dulwich: no such file or directory
/private/var/mobile/Containers/Shared/AppGroup/E1D01013-D52C-4279-AB99-5F5C352B53FD/Pythonista3/Documents/site-packages/stash/lib/dulwich.old: does not exist
Opening: https://github.com/jsbain/gittle/archive/master.zip

Save as: /private/var/mobile/Containers/Data/Application/9AB2D22D-74F9-4093-BBDC-825D0D343B18/tmp//gittle.zip (??? bytes)
28334
Opening: https://github.com/FriendCode/funky/archive/master.zip

Save as: /private/var/mobile/Containers/Data/Application/9AB2D22D-74F9-4093-BBDC-825D0D343B18/tmp//funky.zip (??? bytes)
8474
[~/Documents]$ cd test
[test]$ echo 'hello world' > readme.md
[test]$ git add readme.md
Adding readme.md
[test]$ git status
STAGED
add ['readme.md']
UNSTAGED LOCAL MODS
[]
[test]$ git commit
Commit Message: hello
Author Name: user
Save this setting? [y/n]y
stash: : 'StackedConfig' object has no attribute 'write_to_path'

when I input save setting, AttributeError occured.
I enter 'n', It doesn't happen.???

so,I try git push.

[test]$ git push
Attempting to push to: https://github.com/haj60270/test.git, branch: refs/heads/master
stash: : 'function' object has no attribute 'urlparse'

I don't understand.
Please help me.

StaSh v0.7.0
Pythonista 3.2 (320000)
iOS 11.4.1 (64-bit iPad4,4)
Python 2.7.12
root: ~/Documents/site-packages/stash
core.py: 2018-08-26 21:18:42
SELFUPDATE_BRANCH: master
BIN_PATH:
~/Documents/bin
~/Documents/stash_extensions/bin
~/Documents/site-packages/stash/bin

JonB

yeah, a recent update broke git. i need to fix it.

in the mean time, you can try:

edit ~/.gitconfig

then add to the file:

[user]
    name = Your Name
    email = your@email.adress.com

try your push again.

JonB

https://github.com/ywangd/stash/issues/328#issuecomment-416044398
as a temporary workaround, you cab back out that change, see abive.

dtm4beginner

Thank you for your advice.
I try
edit ~/.gitconfig
and set my name &email.
then, git commit sucsess!

thankyou!

but, git push doesn't work yet.

[test]$ git push
Attempting to push to: https://github.com/user/test.git, branch: refs/heads/master
stash: : 'function' object has no attribute 'urlparse'

dtm4beginner

I rewrite code.

as a temporary workaround, in bin/git.py, at line 391, change

config = repo.repo.get_stackedconfig()
to
config = repo.repo.get_config()

may be at line 401.
but, git push failed.
The same error occurs as before the fix.

[test]$ git push
Attempting to push to: https://github.com/user/test.git, branch: refs/heads/master
stash: : 'function' object has no attribute 'urlparse'

I don't understand.
Please continue to help.

JonB

can you try

stashconf py_traceback 1

then repeat? this will give a full traceback that we can look at

dtm4beginner

I'm not sure,,, Is this correct?

[test]$ git push
Attempting to push to: https://github.com/haj60270/test.git, branch: refs/heads/master
stash: : 'function' object has no attribute 'urlparse'

Traceback (most recent call last):
File "/private/var/mobile/Containers/Shared/AppGroup/E1D01013-D52C-4279-AB99-5F5C352B53FD/Pythonista3/Documents/site-packages/stash/system/shruntime.py", line 510, in exec_py_file
exec(code, namespace, namespace)
File "../site-packages/stash/bin/git.py", line 763, in
ns.func(args)
File "../site-packages/stash/bin/git.py", line 561, in git_push
netloc = urlparse.urlparse(result.url).netloc
AttributeError: 'function' object has no attribute 'urlparse'

JonB

well damn that is frustrating... changes got made without being tested.
search/replace urlparse.urlparse with simple urlparse.

dtm4beginner

Oh! Thankyu all problem was cleared.

  1. search/replace
    urlparse.urlpase => urlparse
    I fixed 3 place, at line 501, 561, 591

  2. For use urlunpase
    Add 1 line
    from six.moves.urllib.parse import urlunparse
    and urlparse.urlunpase => urlunpase

dtm4beginner

I appriciate your help.
I'm able to enjoy Pythonista 3 !!!
Thank you very much !!