aboutsummaryrefslogtreecommitdiffstats
path: root/bug/operation_pack.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2018-07-17 01:52:56 +0200
committerMichael Muré <batolettre@gmail.com>2018-07-17 01:52:56 +0200
commit0180b68cb0bb3aecf9b4a6186094a084762b4a25 (patch)
tree95597554cfdda76b9f6cc5aab7c3fd5b24a3db75 /bug/operation_pack.go
parent1d678dfdfa026968dbb19795c9bed16385603b21 (diff)
downloadgit-bug-0180b68cb0bb3aecf9b4a6186094a084762b4a25.tar.gz
implement pull/merge
Diffstat (limited to 'bug/operation_pack.go')
-rw-r--r--bug/operation_pack.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/bug/operation_pack.go b/bug/operation_pack.go
index 60016474..cce1845c 100644
--- a/bug/operation_pack.go
+++ b/bug/operation_pack.go
@@ -15,6 +15,9 @@ import (
// apply to get the final state of the Bug
type OperationPack struct {
Operations []Operation
+
+ // Private field so not serialized by gob
+ commitHash util.Hash
}
func ParseOperationPack(data []byte) (*OperationPack, error) {
@@ -73,3 +76,18 @@ func (opp *OperationPack) Write(repo repository.Repo) (util.Hash, error) {
return hash, nil
}
+
+// Make a deep copy
+func (opp *OperationPack) Clone() OperationPack {
+
+ clone := OperationPack{
+ Operations: make([]Operation, len(opp.Operations)),
+ commitHash: opp.commitHash,
+ }
+
+ for i, op := range opp.Operations {
+ clone.Operations[i] = op
+ }
+
+ return clone
+}