コード例 #1
0
ファイル: gitsetup.py プロジェクト: mhl/gib
 def get_invocation(self):
     '''Return an invocation that would run the script with options
     that will set directory_to_backup, git_directory and branch as on
     this invocation.  After init has been called, we can just specify
     the directory to backup, since the configuration file .gib.conf in
     that directory will store the git_directory and the branch.  If
     the directory to backup is just the current user's home directory,
     then that doesn't need to be specified either.'''
     invocation = sys.argv[0]
     if self.directory_to_backup != os.environ['HOME']:
         invocation += " " + "--directory="
         invocation += shellquote(self.directory_to_backup)
     return invocation
コード例 #2
0
ファイル: gitsetup.py プロジェクト: mhl/gib
 def git_for_shell(self):
     '''Returns a string with shell-safe invocation of git which can be used
     in calls that are subject to shell interpretation.'''
     command = "git --git-dir="+shellquote(self.git_directory)
     command += " --work-tree="+shellquote(self.directory_to_backup)
     return command