From efc7a5ebc9e10983571c080017100a8b39eee1d0 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 15 Nov 2017 21:39:40 -0500 Subject: more --- commands.go | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) (limited to 'commands.go') diff --git a/commands.go b/commands.go index a1f7f51..d017f7f 100644 --- a/commands.go +++ b/commands.go @@ -2,23 +2,25 @@ package libfastimport import ( "strconv" + + "git.lukeshu.com/go/libfastimport/textproto" ) type Cmd interface { - fiWriteCmd(*FIWriter) error + fiWriteCmd(*textproto.FIWriter) error } type CmdCommit struct { Ref string Mark int // optional; < 1 for non-use - Author *UserTime - Committer UserTime + Author *textproto.UserTime + Committer textproto.UserTime Msg []byte Parents []string Tree []FileAction } -func (c *CmdCommit) fiWriteCmd(fiw *FIWriter) error { +func (c CmdCommit) fiWriteCmd(fiw *textproto.FIWriter) error { ez := &ezfiw{fiw: fiw} ez.WriteLine("commit", c.Ref) @@ -56,11 +58,11 @@ func (c *CmdCommit) fiWriteCmd(fiw *FIWriter) error { type CmdTag struct { RefName string CommitIsh string - Tagger UserTime + Tagger textproto.UserTime Data []byte } -func (c *CmdTag) fiWriteCmd(fiw *FIWriter) error { +func (c CmdTag) fiWriteCmd(fiw *textproto.FIWriter) error { ez := &ezfiw{fiw: fiw} ez.WriteLine("tag", c.RefName) @@ -76,7 +78,7 @@ type CmdReset struct { CommitIsh string // optional } -func (c *CmdReset) fiWriteCmd(fiw *FIWriter) error { +func (c CmdReset) fiWriteCmd(fiw *textproto.FIWriter) error { ez := &ezfiw{fiw: fiw} ez.WriteLine("reset", c.RefName) @@ -92,7 +94,7 @@ type CmdBlob struct { Data []byte } -func (c *CmdBlob) fiWriteCmd(fiw *FIWriter) error { +func (c CmdBlob) fiWriteCmd(fiw *textproto.FIWriter) error { ez := &ezfiw{fiw: fiw} ez.WriteLine("blob") @@ -106,7 +108,7 @@ func (c *CmdBlob) fiWriteCmd(fiw *FIWriter) error { type CmdCheckpoint struct{} -func (c *CmdCheckpoint) fiWriteCmd(fiw *FIWriter) error { +func (c CmdCheckpoint) fiWriteCmd(fiw *textproto.FIWriter) error { return fiw.WriteLine("checkpoint") } @@ -114,7 +116,7 @@ type CmdProgress struct { Str string } -func (c *CmdProgress) fiWriteCmd(fiw *FIWriter) error { +func (c CmdProgress) fiWriteCmd(fiw *textproto.FIWriter) error { return fiw.WriteLine("progress", c.Str) } @@ -122,7 +124,7 @@ type CmdGetMark struct { Mark int } -func (c *CmdGetMark) fiWriteCmd(fiw *FIWriter) error { +func (c CmdGetMark) fiWriteCmd(fiw *textproto.FIWriter) error { return fiw.WriteLine("get-mark", ":"+strconv.Itoa(c.Mark)) } @@ -130,17 +132,17 @@ type CmdCatBlob struct { DataRef string } -func (c *CmdCatBlob) fiWriteCmd(fiw *FIWriter) error { +func (c CmdCatBlob) fiWriteCmd(fiw *textproto.FIWriter) error { return fiw.WriteLine("cat-blob", c.DataRef) } // See FileLs for using ls inside of a commit type CmdLs struct { DataRef string - Path Path + Path textproto.Path } -func (c *CmdLs) fiWriteCmd(fiw *FIWriter) error { +func (c CmdLs) fiWriteCmd(fiw *textproto.FIWriter) error { return fiw.WriteLine("ls", c.DataRef, c.Path) } @@ -149,7 +151,7 @@ type CmdFeature struct { Argument string } -func (c *CmdFeature) fiWriteCmd(fiw *FIWriter) error { +func (c CmdFeature) fiWriteCmd(fiw *textproto.FIWriter) error { if c.Argument != "" { return fiw.WriteLine("feature", c.Feature+"="+c.Argument) } else { @@ -161,13 +163,13 @@ type CmdOption struct { Option string } -func (c *CmdOption) fiWriteCmd(fiw *FIWriter) error { +func (c CmdOption) fiWriteCmd(fiw *textproto.FIWriter) error { return fiw.WriteLine("option", c.Option) } type CmdDone struct{} -func (c *CmdDone) fiWriteCmd(fiw *FIWriter) error { +func (c CmdDone) fiWriteCmd(fiw *textproto.FIWriter) error { return fiw.WriteLine("done") } @@ -175,6 +177,6 @@ type CmdComment struct { Comment string } -func (c *CmdComment) fiWriteCmd(fiw *FIWriter) error { +func (c CmdComment) fiWriteCmd(fiw *textproto.FIWriter) error { return fiw.WriteLine("#" + c.Comment) } -- cgit v1.2.3