mirror of
https://github.com/MichaelMure/git-bug.git
synced 2024-12-15 02:01:43 +03:00
identity: another round of cleanups
This commit is contained in:
parent
475b7b4c49
commit
46beb4b886
@ -11,7 +11,7 @@ import (
|
||||
|
||||
// Note:
|
||||
//
|
||||
// For the actions (fetch/push/pull/merge), this package act as a master for
|
||||
// For the actions (fetch/push/pull/merge/commit), this package act as a master for
|
||||
// the identity package and will also drive the needed identity actions. That is,
|
||||
// if bug.Push() is called, identity.Push will also be called to make sure that
|
||||
// the dependant identities are also present and up to date on the remote.
|
||||
|
@ -9,20 +9,6 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
var (
|
||||
// Beware, don't those test data in multi-repo situation !
|
||||
// As an example, the Identity would be considered commited after a commit
|
||||
// in one repo,
|
||||
// rene = identity.NewIdentity("René Descartes", "rene@descartes.fr")
|
||||
// unix = time.Now().Unix()
|
||||
|
||||
// createOp = NewCreateOp(rene, unix, "title", "message", nil)
|
||||
// setTitleOp = NewSetTitleOp(rene, unix, "title2", "title1")
|
||||
// addCommentOp = NewAddCommentOp(rene, unix, "message2", nil)
|
||||
// setStatusOp = NewSetStatusOp(rene, unix, ClosedStatus)
|
||||
// labelChangeOp = NewLabelChangeOperation(rene, unix, []Label{"added"}, []Label{"removed"})
|
||||
)
|
||||
|
||||
func ExampleOperationIterator() {
|
||||
b := NewBug()
|
||||
|
||||
|
4
cache/repo_cache.go
vendored
4
cache/repo_cache.go
vendored
@ -579,8 +579,6 @@ func (c *RepoCache) NewBugRaw(author *IdentityCache, unixTime int64, title strin
|
||||
// Fetch retrieve update from a remote
|
||||
// This does not change the local bugs state
|
||||
func (c *RepoCache) Fetch(remote string) (string, error) {
|
||||
// TODO: add identities
|
||||
|
||||
return bug.Fetch(c.repo, remote)
|
||||
}
|
||||
|
||||
@ -625,8 +623,6 @@ func (c *RepoCache) MergeAll(remote string) <-chan bug.MergeResult {
|
||||
|
||||
// Push update a remote with the local changes
|
||||
func (c *RepoCache) Push(remote string) (string, error) {
|
||||
// TODO: add identities
|
||||
|
||||
return bug.Push(c.repo, remote)
|
||||
}
|
||||
|
||||
|
@ -9,10 +9,6 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var (
|
||||
userLsVerbose bool
|
||||
)
|
||||
|
||||
func runUserLs(cmd *cobra.Command, args []string) error {
|
||||
backend, err := cache.NewRepoCache(repo)
|
||||
if err != nil {
|
||||
@ -41,7 +37,4 @@ var userLsCmd = &cobra.Command{
|
||||
func init() {
|
||||
userCmd.AddCommand(userLsCmd)
|
||||
userLsCmd.Flags().SortFlags = false
|
||||
|
||||
userLsCmd.Flags().BoolVarP(&userLsVerbose, "verbose", "v", false,
|
||||
"Print extra information")
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ const idLength = 40
|
||||
const humanIdLength = 7
|
||||
|
||||
var ErrNonFastForwardMerge = errors.New("non fast-forward identity merge")
|
||||
var ErrNoIdentitySet = errors.New("user identity first needs to be created using \"git bug user create\"")
|
||||
var ErrNoIdentitySet = errors.New("user identity first needs to be created using \"git bug user create\" or \"git bug user adopt\"")
|
||||
var ErrMultipleIdentitiesSet = errors.New("multiple user identities set")
|
||||
|
||||
var _ Interface = &Identity{}
|
||||
@ -391,11 +391,6 @@ func (i *Identity) Merge(repo repository.Repo, other *Identity) (bool, error) {
|
||||
return false, errors.New("can't merge identities that has never been stored")
|
||||
}
|
||||
|
||||
/*ancestor, err := repo.FindCommonAncestor(i.lastCommit, other.lastCommit)
|
||||
if err != nil {
|
||||
return false, errors.Wrap(err, "can't find common ancestor")
|
||||
}*/
|
||||
|
||||
modified := false
|
||||
for j, otherVersion := range other.versions {
|
||||
// if there is more version in other, take them
|
||||
|
@ -40,10 +40,12 @@ func (i *IdentityStub) UnmarshalJSON(data []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Id return the Identity identifier
|
||||
func (i *IdentityStub) Id() string {
|
||||
return i.id
|
||||
}
|
||||
|
||||
// HumanId return the Identity identifier truncated for human consumption
|
||||
func (i *IdentityStub) HumanId() string {
|
||||
return FormatHumanID(i.Id())
|
||||
}
|
||||
|
@ -14,12 +14,16 @@ type Interface interface {
|
||||
|
||||
// Name return the last version of the name
|
||||
Name() string
|
||||
|
||||
// Email return the last version of the email
|
||||
Email() string
|
||||
|
||||
// Login return the last version of the login
|
||||
Login() string
|
||||
|
||||
// AvatarUrl return the last version of the Avatar URL
|
||||
AvatarUrl() string
|
||||
|
||||
// Keys return the last version of the valid keys
|
||||
Keys() []Key
|
||||
|
||||
|
@ -51,11 +51,11 @@ type VersionJSON struct {
|
||||
|
||||
Time lamport.Time `json:"time"`
|
||||
UnixTime int64 `json:"unix_time"`
|
||||
Name string `json:"name"`
|
||||
Email string `json:"email"`
|
||||
Login string `json:"login"`
|
||||
AvatarUrl string `json:"avatar_url"`
|
||||
Keys []Key `json:"pub_keys"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Email string `json:"email,omitempty"`
|
||||
Login string `json:"login,omitempty"`
|
||||
AvatarUrl string `json:"avatar_url,omitempty"`
|
||||
Keys []Key `json:"pub_keys,omitempty"`
|
||||
Nonce []byte `json:"nonce,omitempty"`
|
||||
Metadata map[string]string `json:"metadata,omitempty"`
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user