starting on the commit logic
This commit is contained in:
@@ -6,11 +6,13 @@ import (
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/deranjer/gvc/common/database"
|
||||
engine "github.com/deranjer/gvc/common/engine"
|
||||
"github.com/rs/zerolog"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
// NewManager creates a new manager interface that contains all the needed information to make changes to the repo
|
||||
@@ -31,12 +33,13 @@ func NewManager(rootDir string, version string, dbPath string, informer chan Ope
|
||||
if err != nil {
|
||||
log.Fatal().Msgf("unable to create or open db: %s", err)
|
||||
}
|
||||
|
||||
var wg *sync.WaitGroup
|
||||
m := Manager{
|
||||
version,
|
||||
|
||||
//settings,
|
||||
log,
|
||||
wg,
|
||||
patcher,
|
||||
gvcDB,
|
||||
informer,
|
||||
@@ -160,6 +163,22 @@ func (m *Manager) prepareDatabaseForFile(tmpFile database.File) (int, error) {
|
||||
|
||||
}
|
||||
|
||||
func (m *Manager) BeginCommit(fileList []database.File, branch string) error {
|
||||
diffChannel := make(chan database.DiffObject)
|
||||
diffContext := context.Background()
|
||||
m.WaitGroup.Add(2)
|
||||
commit, err := m.dB.FetchLastCommitOnBranch(branch)
|
||||
if err != nil {
|
||||
m.Err(err).Msgf("unable to fetch last commit on branch, assuming first commit on branch", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Manager) FetchCommitByNumber(branch string, commitNumber string) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// FetchTrackedFiles just grabbes all the files currently tracked in the repo
|
||||
func (m *Manager) FetchTrackedFiles() ([]database.File, error) {
|
||||
files, err := m.dB.RetrieveTrackedFiles()
|
||||
|
||||
@@ -3,6 +3,7 @@ package manager
|
||||
//https://github.com/apsdehal/go-logger
|
||||
import (
|
||||
"os/user"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
database "github.com/deranjer/gvc/common/database"
|
||||
@@ -14,7 +15,7 @@ type Manager struct {
|
||||
Version string //What version of the client or server are we using
|
||||
//Settings *UserSettings
|
||||
*zerolog.Logger
|
||||
//*sync.WaitGroup
|
||||
*sync.WaitGroup
|
||||
//watcher engine.FileWatcher
|
||||
patcher engine.Patcher
|
||||
dB *database.DB
|
||||
|
||||
Reference in New Issue
Block a user