summaryrefslogtreecommitdiff
path: root/fileactions.go
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2017-11-15 21:39:40 -0500
committerLuke Shumaker <lukeshu@lukeshu.com>2017-11-15 21:39:40 -0500
commitefc7a5ebc9e10983571c080017100a8b39eee1d0 (patch)
treeb11aea0aaefb6c16521b2433338ebe7d0440de14 /fileactions.go
parent7675ebe9567bd7cae4306f484e3677bf88ba8b55 (diff)
more
Diffstat (limited to 'fileactions.go')
-rw-r--r--fileactions.go40
1 files changed, 22 insertions, 18 deletions
diff --git a/fileactions.go b/fileactions.go
index 2d81177..d45b982 100644
--- a/fileactions.go
+++ b/fileactions.go
@@ -1,26 +1,30 @@
package libfastimport
+import (
+ "git.lukeshu.com/go/libfastimport/textproto"
+)
+
type FileAction interface {
- fiWriteFA(*FIWriter) error
+ fiWriteFA(*textproto.FIWriter) error
}
type FileModify struct {
- Mode Mode
- Path Path
+ Mode textproto.Mode
+ Path textproto.Path
DataRef string
}
-func (o FileModify) fiWriteFA(fiw *FIWriter) error {
+func (o FileModify) fiWriteFA(fiw *textproto.FIWriter) error {
return fiw.WriteLine("M", o.Mode, o.DataRef, o.Path)
}
type FileModifyInline struct {
- Mode Mode
- Path Path
+ Mode textproto.Mode
+ Path textproto.Path
Data []byte
}
-func (o FileModifyInline) fiWriteFA(fiw *FIWriter) error {
+func (o FileModifyInline) fiWriteFA(fiw *textproto.FIWriter) error {
ez := &ezfiw{fiw: fiw}
ez.WriteLine("M", o.Mode, "inline", o.Path)
ez.WriteData(o.Data)
@@ -28,19 +32,19 @@ func (o FileModifyInline) fiWriteFA(fiw *FIWriter) error {
}
type FileDelete struct {
- Path Path
+ Path textproto.Path
}
-func (o FileDelete) fiWriteFA(fiw *FIWriter) error {
+func (o FileDelete) fiWriteFA(fiw *textproto.FIWriter) error {
return fiw.WriteLine("D", o.Path)
}
type FileCopy struct {
- Src Path
- Dst Path
+ Src textproto.Path
+ Dst textproto.Path
}
-func (o FileCopy) fiWriteFA(fiw *FIWriter) error {
+func (o FileCopy) fiWriteFA(fiw *textproto.FIWriter) error {
return fiw.WriteLine("C", o.Src, o.Dst)
}
@@ -49,13 +53,13 @@ type FileRename struct {
Dst string
}
-func (o FileRename) fiWriteFA(fiw *FIWriter) error {
+func (o FileRename) fiWriteFA(fiw *textproto.FIWriter) error {
return fiw.WriteLine("R", o.Src, o.Dst)
}
type FileDeleteAll struct{}
-func (o FileDeleteAll) fiWriteFA(fiw *FIWriter) error {
+func (o FileDeleteAll) fiWriteFA(fiw *textproto.FIWriter) error {
return fiw.WriteLine("deleteall")
}
@@ -64,7 +68,7 @@ type NoteModify struct {
DataRef string
}
-func (o NoteModify) fiWriteFA(fiw *FIWriter) error {
+func (o NoteModify) fiWriteFA(fiw *textproto.FIWriter) error {
return fiw.WriteLine("N", o.DataRef, o.CommitIsh)
}
@@ -73,7 +77,7 @@ type NoteModifyInline struct {
Data []byte
}
-func (o NoteModifyInline) fiWriteFA(fiw *FIWriter) error {
+func (o NoteModifyInline) fiWriteFA(fiw *textproto.FIWriter) error {
ez := &ezfiw{fiw: fiw}
ez.WriteLine("N", "inline", o.CommitIsh)
ez.WriteData(o.Data)
@@ -82,9 +86,9 @@ func (o NoteModifyInline) fiWriteFA(fiw *FIWriter) error {
// See CmdLs for using ls outside of a commit
type FileLs struct {
- Path Path
+ Path textproto.Path
}
-func (o FileLs) fiWriteFA(fiw *FIWriter) error {
+func (o FileLs) fiWriteFA(fiw *textproto.FIWriter) error {
return fiw.WriteLine("ls", o.Path)
}