original_docstring: commit code, tag that commit and reset repositories state
  
          performs something like the following
  
              CHEAD=$(git rev-parse HEAD)
              git add <files...>
              git add -u
              git commit -m "edflow ..."
              git tag -a edflow_date-and-time-project -m "more"
              git reset --mixed $CHEAD
          
docstring: commit code, tag that commit and reset repositories state
  performs something like the following
  
  
docstring_tokens: commit code tag that commit and reset repositories state performs something like the following
code: def _git_commit(cls):
          """commit code, tag that commit and reset repositories state
  
          performs something like the following
  
              CHEAD=$(git rev-parse HEAD)
              git add <files...>
              git add -u
              git commit -m "edflow ..."
              git tag -a edflow_date-and-time-project -m "more"
              git reset --mixed $CHEAD
          """
          try:
              CHEAD = subprocess.run(
                  ["git rev-parse HEAD"],
                  shell=True,
                  check=True,
                  stdout=subprocess.PIPE,
                  universal_newlines=True,
              ).stdout.strip()
          except subprocess.CalledProcessError:
              cls.logger.warning(
                  "Tried to commit state of project but the current working directory does not appear to be a git repository."
              )
              tagname = "error: no git repository found"
          else:
              tagname = "{}_{}".format(cls.now, cls.postfix)
              message = "command: {}\nroot: {}".format(" ".join(sys.argv), cls.root)
              try:
                  addcommand = "git add {pyfiles}; git add {yamlfiles}; git add -u".format(
                      pyfiles=os.path.join(cls.code_root, "\*.py"),
                      yamlfiles=os.path.join(cls.code_root, "\*.yaml"),
                  )
                  output = subprocess.run(
                      [addcommand],
                      shell=True,
                      stdout=subprocess.PIPE,
                      stderr=subprocess.STDOUT,
                      universal_newlines=True,
                  ).stdout
                  cls.logger.debug(output)
                  if (
                      subprocess.run(
                          ["git diff-index --quiet HEAD"], shell=True
                      ).returncode
                      != 0
                  ):
                      # dirty working directory - add commit
                      command = "git commit -m '{commitmessage}'; git tag '{tagname}'".format(
                          commitmessage=message, tagname=tagname
                      )
                  else:
                      # nothing to add - put message into annotated tag
                      command = "git tag -a '{tagname}' -m '{tagmessage}'".format(
                          tagname=tagname, tagmessage=message
                      )
                  cls.logger.debug(command)
                  output = subprocess.run(
                      [command],
                      shell=True,
                      check=True,
                      stdout=subprocess.PIPE,
                      stderr=subprocess.STDOUT,
                      universal_newlines=True,
                  ).stdout
                  cls.logger.debug(output)
              except Exception as e:
                  cls.logger.warning(
                      "Tried to commit state of project but error occured: {}".format(e)
                  )
                  tagname = "error: {}".format(e)
              finally:
                  cls.logger.debug("git reset --mixed {}".format(CHEAD))
                  output = subprocess.run(
                      ["git reset --mixed {}".format(CHEAD)],
                      shell=True,
                      stdout=subprocess.PIPE,
                      stderr=subprocess.STDOUT,
                      universal_newlines=True,
                  ).stdout
                  cls.logger.debug(output)
          return tagname
code_tokens: def _git_commit ( cls ) : try : CHEAD = subprocess . run ( [ "git rev-parse HEAD" ] , shell = True , check = True , stdout = subprocess . PIPE , universal_newlines = True , ) . stdout . strip ( ) except subprocess . CalledProcessError : cls . logger . warning ( "Tried to commit state of project but the current working directory does not appear to be a git repository." ) tagname = "error: no git repository found" else : tagname = "{}_{}" . format ( cls . now , cls . postfix ) message = "command: {}\nroot: {}" . format ( " " . join ( sys . argv ) , cls . root ) try : addcommand = "git add {pyfiles}; git add {yamlfiles}; git add -u" . format ( pyfiles = os . path . join ( cls . code_root , "\*.py" ) , yamlfiles = os . path . join ( cls . code_root , "\*.yaml" ) , ) output = subprocess . run ( [ addcommand ] , shell = True , stdout = subprocess . PIPE , stderr = subprocess . STDOUT , universal_newlines = True , ) . stdout cls . logger . debug ( output ) if ( subprocess . run ( [ "git diff-index --quiet HEAD" ] , shell = True ) . returncode != 0 ) : command = "git commit -m '{commitmessage}'; git tag '{tagname}'" . format ( commitmessage = message , tagname = tagname ) else : command = "git tag -a '{tagname}' -m '{tagmessage}'" . format ( tagname = tagname , tagmessage = message ) cls . logger . debug ( command ) output = subprocess . run ( [ command ] , shell = True , check = True , stdout = subprocess . PIPE , stderr = subprocess . STDOUT , universal_newlines = True , ) . stdout cls . logger . debug ( output ) except Exception as e : cls . logger . warning ( "Tried to commit state of project but error occured: {}" . format ( e ) ) tagname = "error: {}" . format ( e ) finally : cls . logger . debug ( "git reset --mixed {}" . format ( CHEAD ) ) output = subprocess . run ( [ "git reset --mixed {}" . format ( CHEAD ) ] , shell = True , stdout = subprocess . PIPE , stderr = subprocess . STDOUT , universal_newlines = True , ) . stdout cls . logger . debug ( output ) return tagname
short_docstring: commit code, tag that commit and reset repositories state
  performs something like the following
short_docstring_tokens: commit code tag that commit and reset repositories state performs something like the following
comment: """commit code, tag that commit and reset repositories state
  
          performs something like the following
  
              CHEAD=$(git rev-parse HEAD)
              git add <files...>
              git add -u
              git commit -m "edflow ..."
              git tag -a edflow_date-and-time-project -m "more"
              git reset --mixed $CHEAD
          """$SEP$# dirty working directory - add commit$SEP$# nothing to add - put message into annotated tag