omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    git / github workflow in stash

    Pythonista
    8
    29
    22942
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • JonB
      JonB last edited by

      yes, removing files is probably not handled well... how does git handle rm without git rm?

      i actually recommend against git pull in most cases, it will happily onliterate any local changes. i tend to use git fetch followed by git merge, which at least tries to do sane things (though is not exactly like the real git merge). iirc git reset can be helpful when files get deleted without git rm.

      I am in the process of removing gittle dependencies, and will then be able to use the most recent dulwich. Some improvements have already been made to dulwich.porcelain, and this would let us make pull requests to dulwich...

      khilnani 1 Reply Last reply Reply Quote 0
      • khilnani
        khilnani @JonB last edited by

        @JonB said:

        yes, removing files is probably not handled well... how does git handle rm without git rm?

        from what ive seen, it treats them as if git rm was called and auto stages the removes

        i actually recommend against git pull in most cases, it will happily onliterate any local changes. i tend to use git fetch followed by git merge, which at least tries to do sane things (though is not exactly like the real git merge). iirc git reset can be helpful when files get deleted without git rm.

        git fetch OR git fetch origin OR even fit fetch git@gihub... gives an error -

        stash: <type 'exceptions.Exception'>: url must match a remote name, or must start with http:// or https://
        

        i tried git reset after manually deleting a file. didnt seem to help. Still get

        stash: <type 'exceptions.OSError'>: [Errno 2] No such file or directory: '/private/var/mobile/Containers/Shared/AppGroup/A90BB332.......ACD7F/Pythonista3/Documents/pythonista-scripts/test'
        

        I am in the process of removing gittle dependencies, and will then be able to use the most recent dulwich. Some improvements have already been made to dulwich.porcelain, and this would let us make pull requests to dulwich...

        cool !!!!

        Thanks so much for helping out!!!

        1 Reply Last reply Reply Quote 0
        • mikael
          mikael last edited by

          Tried gh create_key stash, which failed because it could not import jwt. Tried pip installing jwt, which partially failed installing dependency typing. Trying the original command again, which failed with syntax error in jwk.py (which makes sense if it depends on typing).

          This with latest vanilla version of Pythonista 3 and an updated version of stash.

          1 Reply Last reply Reply Quote 0
          • JonB
            JonB last edited by

            hmm, @mikael, can you post the traceback? I don't have jwt installed, must be a module collision somewhere

            mikael 1 Reply Last reply Reply Quote 0
            • mikael
              mikael @JonB last edited by

              @JonB, not sure how to get a traceback. Here's what happens:

              gh create_key stash
              no github found in /private/var/mobile/Containers/Shared/AppGroup/447A26CB-FA57-4E8A-8C34-082F55AD274F/Pythonista3/Documents/site-packages/stash/lib
              Installing pygithub master ...
              Opening: https://github.com/pygithub/pygithub/archive/master.zip
              Save as: /private/var/mobile/Containers/Data/Application/33F31BE9-F7A7-4092-8AFE-9E3C77723213/tmp//pygithub.zip 
                 3168996
              Done
              stash: <type 'exceptions.ImportError'>: No module named jwt
              
              1 Reply Last reply Reply Quote 0
              • JonB
                JonB last edited by

                stashconf py_traceback 1

                then run the command

                1 Reply Last reply Reply Quote 0
                • mikael
                  mikael last edited by

                  Thanks. As I started stash to do this, I got a tip with that exact same line for enabling tracebacks. Funny - or scary, depending on how you see the world.

                  Here's the trace:

                  Traceback (most recent call last):
                    File "/private/var/mobile/Containers/Shared/AppGroup/447A26CB-FA57-4E8A-8C34-082F55AD274F/Pythonista3/Documents/site-packages/stash/system/shruntime.py", line 498, in exec_py_file
                      exec code in namespace, namespace
                    File "site-packages/stash/bin/gh.py", line 44, in <module>
                      import github
                    File "/private/var/mobile/Containers/Shared/AppGroup/447A26CB-FA57-4E8A-8C34-082F55AD274F/Pythonista3/Documents/site-packages/stash/lib/github/__init__.py", line 37, in <module>
                      from MainClass import Github, GithubIntegration
                    File "/private/var/mobile/Containers/Shared/AppGroup/447A26CB-FA57-4E8A-8C34-082F55AD274F/Pythonista3/Documents/site-packages/stash/lib/github/MainClass.py", line 34, in <module>
                      import jwt
                  ImportError: No module named jwt
                  
                  1 Reply Last reply Reply Quote 0
                  • JonB
                    JonB last edited by

                    Hmm, okay, pygithub now depends on pyjwt. It used to be dependency free, so could just install it directly.

                    pip install pyjwt
                    

                    should fix the issue, though i will have to update gh to maybe use pip to install pygithub (or install a specific version).

                    mikael 1 Reply Last reply Reply Quote 1
                    • mikael
                      mikael @JonB last edited by

                      @JonB, thanks, installing pyjwt - not jwt - fixed the issue.

                      1 Reply Last reply Reply Quote 0
                      • JonB
                        JonB last edited by

                        Does gh actually work for you? I note that jwt requires cryptography for certain algorithms, you can be forced to use pycrypto/ecsda instead. Just curious if anything we are using requires that.

                        mikael 1 Reply Last reply Reply Quote 0
                        • mikael
                          mikael @JonB last edited by

                          @JonB, yes, it worked, to the extent that new key was added to the github account. Further testing later.

                          1 Reply Last reply Reply Quote 0
                          • shtek
                            shtek last edited by

                            just tried git push.
                            first generate rsa key using ssh-keygen

                            ,
                            then add the generated pub key to my site,
                            then push:

                            [pythonistascripts]$ git push
                            Attempting to push to: git@code.mysite.net:shtek/pythonistascripts.git, branch: refs/heads/master
                            stash: <type 'exceptions.TypeError'>: expected a string or other character buffer object
                            

                            I don't know what this error means, but after I check the code site, I find that everything has been successfully pushed.

                            so this is an ignorable error?

                            1 Reply Last reply Reply Quote 0
                            • zrzka
                              zrzka last edited by

                              Yes, it is. Or just update StaSh to dev (selfupdate -f dev) where this is fixed already.

                              1 Reply Last reply Reply Quote 0
                              • zrzka
                                zrzka last edited by

                                Also be aware that ...

                                • git status doesn't show untracked files (#265)
                                • git push doesn't warn you that you have to sync your repo with remote and simply overwrites history (#268)

                                ... I constantly forget to git add files, when I edit readme on GH and forget to pull before push, my GH changes are lost.

                                1 Reply Last reply Reply Quote 0
                                • shtek
                                  shtek last edited by shtek

                                  edit readme on GH and forget to pull before push, my GH changes are lost

                                  tested on my git site, same problem.

                                  never thought this could happen. maybe sometimes this is useful ...... I don't need to delete the repo and rebuild it to change history :)

                                  1 Reply Last reply Reply Quote 0
                                  • zrzka
                                    zrzka last edited by

                                    It's a bug. Never ever do this in repos where someone else has access as well.

                                    1 Reply Last reply Reply Quote 0
                                    • First post
                                      Last post
                                    Powered by NodeBB Forums | Contributors