-
Notifications
You must be signed in to change notification settings - Fork 278
/
app.go
32 lines (28 loc) · 877 Bytes
/
app.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
package vcs
import (
"github.com/rs/zerolog/log"
)
// GetRevision returns the version control system (VCS) revision information for the Encore application.
//
// If there is an error getting the revision information, no revision information is returned and the App is flagged as
// having uncommitted files. This will happen most likely because no supported VCS system can be found.
//
// Supported VCS systems include;
// - Hg
// - Git
// - Svn
// - Bzr
// - Fossil
func GetRevision(appRoot string) Status {
appRoot, cmd, err := fromDir(appRoot, "", false)
if err != nil {
log.Err(err).Str("app", appRoot).Msg("unable to determine VCS system")
return Status{Uncommitted: true}
}
status, err := cmd.Status(cmd, appRoot)
if err != nil {
log.Err(err).Str("app", appRoot).Msg("unable to get VCS status")
return Status{Uncommitted: true}
}
return status
}