-
Notifications
You must be signed in to change notification settings - Fork 3
/
shelve.go
53 lines (47 loc) · 1.65 KB
/
shelve.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package p4
import (
"strconv"
"strings"
)
func (conn *Conn) DeleteShelved(path string, change uint64) (message string, err error) {
var (
out []byte
)
out, err = conn.Output([]string{"shelve", "-df", "-c", strconv.FormatUint(change, 10), path})
message = strings.TrimSpace(string(out))
return
}
func (conn *Conn) DeleteShelve(shelveCL uint64) (message string, err error) {
var out []byte
out, err = conn.Output([]string{"shelve", "-f", "-d", "-Af", "-c", strconv.FormatUint(shelveCL, 10)})
message = strings.TrimSpace(string(out))
return
}
func (conn *Conn) Reshelve(shelveCL uint64) (message string, err error) {
var (
out []byte
)
out, err = conn.Output([]string{"reshelve", "-s", strconv.FormatUint(shelveCL, 10), "-f"})
message = strings.TrimSpace(string(out))
return
}
func (conn *Conn) Unshelve(shelveCL, CL uint64) (message string, err error) {
var out []byte
if CL != 0 {
out, err = conn.Output([]string{"unshelve", "-s", strconv.FormatUint(shelveCL, 10), "-c", strconv.FormatUint(CL, 10), "-f"})
} else {
out, err = conn.Output([]string{"unshelve", "-s", strconv.FormatUint(shelveCL, 10), "-f"})
}
message = strings.TrimSpace(string(out))
return
}
func (conn *Conn) UnshelveBypassExclusive(shelveCL, CL uint64) (message string, err error) {
var out []byte
if CL != 0 {
out, err = conn.Output([]string{"unshelve", "--bypass-exclusive-lock", "-s", strconv.FormatUint(shelveCL, 10), "-c", strconv.FormatUint(CL, 10), "-f"})
} else {
out, err = conn.Output([]string{"unshelve", "--bypass-exclusive-lock", "-s", strconv.FormatUint(shelveCL, 10), "-c", strconv.FormatUint(CL, 10), "-f"})
}
message = strings.TrimSpace(string(out))
return
}