-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsync.go
More file actions
68 lines (55 loc) · 1.91 KB
/
sync.go
File metadata and controls
68 lines (55 loc) · 1.91 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package main
import (
"flag"
"fmt"
"net/url"
"os"
)
func syncDefaults() {
fmt.Printf("gojazz sync [options]\n")
flag.PrintDefaults()
}
func syncOp() {
sandboxPath := flag.String("sandbox", "", "Location of the sandbox to sync the files")
force := flag.Bool("force", false, "Don't prompt for anything. Clobber files when necessary.")
flag.Usage = syncDefaults
flag.Parse()
if *sandboxPath == "" {
path, err := os.Getwd()
if err != nil {
panic(err)
}
path = findSandbox(path)
sandboxPath = &path
}
status, err := scmStatus(*sandboxPath, STAGE)
if err != nil {
panic(err)
}
if status.metaData.isstream {
panic(simpleWarning("Sync is for repository workspaces, use load instead to incrementally update your loaded stream."))
}
userId, password, err := getCredentials()
if err != nil {
panic(err)
}
client, err := NewClient(userId, password)
if err != nil {
panic(err)
}
scmCheckin(client, status, *sandboxPath)
// Clear out all of the changes in the status before performing the load
status.Added = make(map[string]bool)
status.Modified = make(map[string]bool)
status.Deleted = make(map[string]bool)
scmLoad(client, status.metaData.ccmBaseUrl, status.metaData.projectName, status.metaData.workspaceId, status.metaData.isstream, status.metaData.userId, *sandboxPath, status, *force)
// Force a load/reload of the jazzhub sandbox to avoid out of sync when
// looking at the changes page
err = loadWorkspace(client, status.metaData.projectName, status.metaData.workspaceId)
if err != nil {
panic(err)
}
fmt.Println("Visit the following URL to work with your changes, deliver them to the rest of the team and more:")
redirect := fmt.Sprintf(jazzHubBaseUrl + "/code/jazzui/changes.html#" + "/code/jazz/Changes/_/file/" + client.GetJazzId() + "-OrionContent/" + status.metaData.projectName)
fmt.Printf("https://login.jazz.net/psso/proxy/jazzlogin?redirect_uri=%v\n", url.QueryEscape(redirect))
}