func PushFile(c *pachclient.APIClient, pfc pachclient.PutFileClient, pfsFile *pfs.File, osFile io.ReadSeeker) error {
	fileInfo, err := c.InspectFile(pfsFile.Commit.Repo.Name, pfsFile.Commit.ID, pfsFile.Path)
	if err != nil && !isNotExist(err) {
		return err
	}

	var i int
	var object *pfs.Object
	if fileInfo != nil {
		for i, object = range fileInfo.Objects {
			hash := pfs.NewHash()
			if _, err := io.CopyN(hash, osFile, pfs.ChunkSize); err != nil {
				if err == io.EOF {
					break
				}
				return err
			}

			if object.Hash != pfs.EncodeHash(hash.Sum(nil)) {
				break
			}
		}
	}

	if _, err := osFile.Seek(int64(i)*pfs.ChunkSize, 0); err != nil {
		return err
	}

	_, err = pfc.PutFileOverwrite(pfsFile.Commit.Repo.Name, pfsFile.Commit.ID, pfsFile.Path, osFile, int64(i))
	return err
}
func PushFile(c *pachclient.APIClient, pfc pachclient.PutFileClient, pfsFile *pfs.File, osFile io.ReadSeeker) error {
	fileInfo, err := c.InspectFile(pfsFile.Commit.Repo.Name, pfsFile.Commit.ID, pfsFile.Path)
	if err != nil && !isNotExist(err) {
		return err
	}

	var i int
	var object *pfs.Object
	if fileInfo != nil {
		for i, object = range fileInfo.Objects {
			hash := pfs.NewHash()
			if _, err := io.CopyN(hash, osFile, pfs.ChunkSize); err != nil {
				if err == io.EOF {
					break
				}
				return err
			}

			if object.Hash != pfs.EncodeHash(hash.Sum(nil)) {
				break
			}
		}
	}

	if _, err := osFile.Seek(int64(i)*pfs.ChunkSize, 0); err != nil {
		return err
	}

	_, err = pfc.PutFileOverwrite(pfsFile.Commit.Repo.Name, pfsFile.Commit.ID, pfsFile.Path, osFile, int64(i))
	return err
}
func PushFile ( c * pachclient . APIClient , pfc pachclient . PutFileClient , pfsFile * pfs . File , osFile io . ReadSeeker ) error { fileInfo , err := c . InspectFile ( pfsFile . Commit . Repo . Name , pfsFile . Commit . ID , pfsFile . Path ) if err != nil && ! isNotExist ( err ) { return err } var i int var object * pfs . Object if fileInfo != nil { for i , object = range fileInfo . Objects { hash := pfs . NewHash ( ) if _ , err := io . CopyN ( hash , osFile , pfs . ChunkSize ) ; err != nil { if err == io . EOF { break } return err } if object . Hash != pfs . EncodeHash ( hash . Sum ( nil ) ) { break } } } if _ , err := osFile . Seek ( int64 ( i ) * pfs . ChunkSize , 0 ) ; err != nil { return err } _ , err = pfc . PutFileOverwrite ( pfsFile . Commit . Repo . Name , pfsFile . Commit . ID , pfsFile . Path , osFile , int64 ( i ) ) return err }
// PushFile makes sure that pfsFile has the same content as osFile.
PushFile makes sure that pfsFile has the same content as osFile .