瀏覽代碼

adding the "add" command

bmallred 11 年之前
父節點
當前提交
bf6217a8a5
共有 1 個文件被更改,包括 29 次插入0 次删除
  1. 29 0
      extensions/add.py

+ 29 - 0
extensions/add.py

@ -0,0 +1,29 @@
1
import subprocess
2
from utilities import isGit, isMercurial, isBazaar
3
4
def add(arguments):
5
    '''
6
    Add file(s) to the pending changes.
7
    '''
8
    
9
    if isGit():
10
        command = ["git", "add"]
11
        command.extend(arguments)
12
        executeCommand(command)
13
14
    if isMercurial():
15
        command = ["hg", "add"]
16
        command.extend(arguments)
17
        executeCommand(command)
18
19
    if isBazaar():
20
        command = ["bzr", "add"]
21
        command.extend(arguments)
22
        executeCommand(command)
23
24
def executeCommand(command):
25
    '''
26
    Execute the given command.
27
    '''
28
29
    subprocess.call(command)