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.


    StaSh ui for git cmds

    Pythonista
    git stash
    2
    5
    4905
    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.
    • Phuket2
      Phuket2 last edited by

      @ywangd , @JonB
      Just want to ask if in your opinion is building a ui interface around the commonly used git cmds using the stash object a waste of time? Firstly, will the object provide enough feedback functionality to implement something like this correctly or will it break down as it was not designed for this purpose. Or do you guys have plans that would supersede this type of approach.

      The c9devbelow is crap. Was just doing some rough testing. Using this method, I have been able to clone a git
      Add files and commit.
      What I didn't get to work was the push cmd. I did it in Stash but not in code. Me understanding the cmd line params correctly.
      But it's not an issue, I am pretty sure it would work.

      I read a nicly put guide that @webmaster4o put a link to. http://rogerdudler.github.io/git-guide/
      The process is Starting to make more sense now 😱😈

      import os
      import shutil
      import editor
      
      '''
      	ONLY TESTING  
      '''
      
      this_path , fn = os.path.split(editor.get_path())
      
      _git_dir = '.git'
      _cmd_git_clone = 'git clone {} > &3'
      _cmd_cd = 'cd {} > &3'
      _clone_dir_name = 'git_clone'
      _cmd_mkdir = 'mkdir {}'
      _cmd_git_add_file = 'git add  -m {} > &3'
      _cmd_git_commit = 'git commit message = hello > &3'
      _cmd_git_push = 'git push origin {branch} {remote_url} -u {username} > &3'
      
      _home_dir = os.path.join(os.path.expanduser('~') , 'Documents')
      _local_dir = os.path.join(_home_dir, 'uc')
      _remote = 'https://github.com/Phuket2/uc.git'
      
      exit('Not meant to be run...Only illustration...')
      
      from stash import stash
      
      _stash = stash.StaSh()
      # move to the dir
      _stash(_cmd_cd.format(_local_dir))
      # add a file/s to local index
      _stash(_cmd_git_add_file.format('Test.py'))
      # commit 
      _stash(_cmd_git_commit.format())
      # push the commits to the remote
      _stash(_cmd_git_push.format(branch = 'master', remote_url = _remote,  username = 'xxx'))
      
      JonB 1 Reply Last reply Reply Quote 1
      • JonB
        JonB @Phuket2 last edited by

        @Phuket2
        https://github.com/jsbain/gitview

        was the attempt at making a ui for git. something like this will be a better path than using the git functionality. This makes use of dulwich and gittle.

        This is obviously a pretty crappy ui, I wrote it a long time ago, but mostly functional. It is actually better than stash git for things like looking at diffs, or undoing add's, etc. I had the start of much nicer interface, which I lost when (ironically) i didn't use git to back up before uninstalling pythonista for 2.0, so I have not been terribly motivated to try to recreate a lot of lost work. I will get to it eventually.

        Phuket2 2 Replies Last reply Reply Quote 1
        • Phuket2
          Phuket2 @JonB last edited by

          @JonB , thanks I cloned your git. Hmmm, a bit more ambitious than what I was thinking of 😱 (Well let's say a lot more)

          Maybe it's not as daunting as it looks on first look. Then again for me, maybe it is.
          I am personally thinking about something with big buttons and super easy.
          Git for dummies like me.

          I have to say that the article @Webmaster4o linked to , was the best documentation I have seen to just start to your head around the basics.

          But I will look deeper, I might surprise myself

          Hmmm, a git for dummies may have averted your loss of code. If there was a one button push to update all your files/gits. Maybe give you a list of repos not updated due to local/remote inconsistencies at the end so you could decide.

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

            @JonB , ok a little less daunting now. From what I understand, there is no reason to know about or understand Dulwich, expect its a reference of a English town in a Monty Python movie. Go figure , we'll also that gittle needs it installed also.

            But from what I can see, only have to work with gittle. gittle will call on Dulwich for various low level git file format functionality.

            Pandora's box is slowly opening 😎

            The gittle sync and git_server methods also look interesting.

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

              There is actually no reason for gittle anymore. it provided some wrappers, most ofcwhich are now in dulwich.porcelain. Start with dulwich.porcelain. gittle also is not py3 compatible, though I have made some progress updating it for use in py3.

              If you want the "simple button", just clone, push and pull into a single branch, dulwich.porcelain should be adequate.

              The problem you will have with either of these is that dulwich does not have a merge capability. Which is needed when you start makng changes in two places and pushing to the same repo. Also, github sometimes refuses to accept s pull over https in dulwich,mthough ssh seems to work much better. I need to try to compare the ssh vs http push mechanism to see what is different ( the author doesn't use https, so it gets little attention)

              gitview implemented really the very minimal set of functionality, yes the ui kind of sucks, but even that minimal set is not quite enough for it to be fully useful.. you need a clone button, a push button, a pull button, or at least a fetch and merge functionslity. you ought to hsve a way to select and checkout branches. you ought to have a way to select the remote. you need the ability to add or remove files to the index, and committing with a commit message (though i suppose you could simply default to adding all files and auto-committing). It helps to be able to diff files, and to have the ability to checkout previous versions of files.

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