diff options
author | Michael Muré <batolettre@gmail.com> | 2021-02-14 10:06:16 +0100 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2021-02-14 12:19:04 +0100 |
commit | 99b9dd84cb4b0cfd3eb1fd50b07c8b826eb52d19 (patch) | |
tree | 72a6328157d4b972d2480c785e575c25673b14f6 /entity/dag/entity_actions.go | |
parent | 94f06cd54defa73f5e8b79345597279e454c78e6 (diff) | |
download | git-bug-99b9dd84cb4b0cfd3eb1fd50b07c8b826eb52d19.tar.gz |
entity: support different author in staging operations
Diffstat (limited to 'entity/dag/entity_actions.go')
-rw-r--r-- | entity/dag/entity_actions.go | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/entity/dag/entity_actions.go b/entity/dag/entity_actions.go index 707c93aa..2926e992 100644 --- a/entity/dag/entity_actions.go +++ b/entity/dag/entity_actions.go @@ -12,7 +12,7 @@ import ( // ListLocalIds list all the available local Entity's Id func ListLocalIds(def Definition, repo repository.RepoData) ([]entity.Id, error) { - refs, err := repo.ListRefs(fmt.Sprintf("refs/%s/", def.namespace)) + refs, err := repo.ListRefs(fmt.Sprintf("refs/%s/", def.Namespace)) if err != nil { return nil, err } @@ -22,12 +22,12 @@ func ListLocalIds(def Definition, repo repository.RepoData) ([]entity.Id, error) // Fetch retrieve updates from a remote // This does not change the local entity state func Fetch(def Definition, repo repository.Repo, remote string) (string, error) { - return repo.FetchRefs(remote, def.namespace) + return repo.FetchRefs(remote, def.Namespace) } // Push update a remote with the local changes func Push(def Definition, repo repository.Repo, remote string) (string, error) { - return repo.PushRefs(remote, def.namespace) + return repo.PushRefs(remote, def.Namespace) } // Pull will do a Fetch + MergeAll @@ -74,7 +74,7 @@ func MergeAll(def Definition, repo repository.ClockedRepo, resolver identity.Res go func() { defer close(out) - remoteRefSpec := fmt.Sprintf("refs/remotes/%s/%s/", remote, def.namespace) + remoteRefSpec := fmt.Sprintf("refs/remotes/%s/%s/", remote, def.Namespace) remoteRefs, err := repo.ListRefs(remoteRefSpec) if err != nil { out <- entity.MergeResult{Err: err} @@ -101,16 +101,16 @@ func merge(def Definition, repo repository.ClockedRepo, resolver identity.Resolv remoteEntity, err := read(def, repo, resolver, remoteRef) if err != nil { return entity.NewMergeInvalidStatus(id, - errors.Wrapf(err, "remote %s is not readable", def.typename).Error()) + errors.Wrapf(err, "remote %s is not readable", def.Typename).Error()) } // Check for error in remote data if err := remoteEntity.Validate(); err != nil { return entity.NewMergeInvalidStatus(id, - errors.Wrapf(err, "remote %s data is invalid", def.typename).Error()) + errors.Wrapf(err, "remote %s data is invalid", def.Typename).Error()) } - localRef := fmt.Sprintf("refs/%s/%s", def.namespace, id.String()) + localRef := fmt.Sprintf("refs/%s/%s", def.Namespace, id.String()) // SCENARIO 1 // if the remote Entity doesn't exist locally, it's created @@ -202,7 +202,7 @@ func merge(def Definition, repo repository.ClockedRepo, resolver identity.Resolv return entity.NewMergeError(err, id) } - editTime, err := repo.Increment(fmt.Sprintf(editClockPattern, def.namespace)) + editTime, err := repo.Increment(fmt.Sprintf(editClockPattern, def.Namespace)) if err != nil { return entity.NewMergeError(err, id) } @@ -236,7 +236,7 @@ func merge(def Definition, repo repository.ClockedRepo, resolver identity.Resolv func Remove(def Definition, repo repository.ClockedRepo, id entity.Id) error { var matches []string - ref := fmt.Sprintf("refs/%s/%s", def.namespace, id.String()) + ref := fmt.Sprintf("refs/%s/%s", def.Namespace, id.String()) matches = append(matches, ref) remotes, err := repo.GetRemotes() @@ -245,7 +245,7 @@ func Remove(def Definition, repo repository.ClockedRepo, id entity.Id) error { } for remote := range remotes { - ref = fmt.Sprintf("refs/remotes/%s/%s/%s", remote, def.namespace, id.String()) + ref = fmt.Sprintf("refs/remotes/%s/%s/%s", remote, def.Namespace, id.String()) matches = append(matches, ref) } |