diffbrowser

package
v0.3.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 9, 2024 License: BSD-3-Clause Imports: 17 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDiffBrowserVCS

func NewDiffBrowserVCS(repo vcs.Repo, revA, revB string)

NewDiffBrowserVCS returns a new diff browser for files that differ between two given revisions in the repository.

Types

type Browser

type Browser struct {
	core.Frame

	// starting paths for the files being compared
	PathA, PathB string
}

Browser is a diff browser, for browsing a set of paired files for viewing differences between them, organized into a tree structure, e.g., reflecting their source in a filesystem.

func NewBrowser

func NewBrowser(parent ...tree.Node) *Browser

NewBrowser returns a new Browser with the given optional parent: Browser is a diff browser, for browsing a set of paired files for viewing differences between them, organized into a tree structure, e.g., reflecting their source in a filesystem.

func NewBrowserWindow

func NewBrowserWindow() (*Browser, *core.Body)

NewBrowserWindow opens a new diff Browser in a new window

func (*Browser) DiffDirs

func (br *Browser) DiffDirs(pathA, pathB string, excludeFile func(fname string) bool)

DiffDirs creates a tree of files within the two paths, where the files have the same names, yet differ in content. The excludeFile function, if non-nil, will exclude files or directories from consideration if it returns true.

func (*Browser) DiffVCS

func (br *Browser) DiffVCS(repo vcs.Repo, revA, revB string)

DiffVCS creates a tree of files changed in given revision.

func (*Browser) Init

func (br *Browser) Init()

func (*Browser) MakeToolbar

func (br *Browser) MakeToolbar(p *tree.Plan)

func (*Browser) OpenFiles

func (br *Browser) OpenFiles()

OpenFiles Updates the tree based on files

func (*Browser) SetPathA

func (t *Browser) SetPathA(v string) *Browser

SetPathA sets the [Browser.PathA]: starting paths for the files being compared

func (*Browser) SetPathB

func (t *Browser) SetPathB(v string) *Browser

SetPathB sets the [Browser.PathB]: starting paths for the files being compared

func (*Browser) Splits

func (br *Browser) Splits() *core.Splits

func (*Browser) Tabs

func (br *Browser) Tabs() *core.Tabs

func (*Browser) Tree

func (br *Browser) Tree() *Node

func (*Browser) ViewDiff

func (br *Browser) ViewDiff(fn *Node) *texteditor.DiffEditor

ViewDiff views diff for given file Node, returning a texteditor.DiffEditor

type Node

type Node struct {
	core.Tree

	// file names (full path) being compared. Name of node is just the filename.
	// Typically A is the older, base version and B is the newer one being compared.
	FileA, FileB string

	// VCS revisions for files if applicable
	RevA, RevB string

	// Status of the change from A to B: A=Added, D=Deleted, M=Modified, R=Renamed
	Status string

	// Text content of the files
	TextA, TextB string

	// Info about the B file, for getting icons etc
	Info fileinfo.FileInfo
}

Node is an element in the diff tree

func NewNode

func NewNode(parent ...tree.Node) *Node

NewNode returns a new Node with the given optional parent: Node is an element in the diff tree

func (*Node) Browser

func (tn *Node) Browser() *Browser

Browser returns the parent browser

func (*Node) ContextMenu

func (tn *Node) ContextMenu(m *core.Scene)

func (*Node) Init

func (tn *Node) Init()

func (*Node) SetFileA

func (t *Node) SetFileA(v string) *Node

SetFileA sets the [Node.FileA]: file names (full path) being compared. Name of node is just the filename. Typically A is the older, base version and B is the newer one being compared.

func (*Node) SetFileB

func (t *Node) SetFileB(v string) *Node

SetFileB sets the [Node.FileB]: file names (full path) being compared. Name of node is just the filename. Typically A is the older, base version and B is the newer one being compared.

func (*Node) SetInfo

func (t *Node) SetInfo(v fileinfo.FileInfo) *Node

SetInfo sets the [Node.Info]: Info about the B file, for getting icons etc

func (*Node) SetRevA

func (t *Node) SetRevA(v string) *Node

SetRevA sets the [Node.RevA]: VCS revisions for files if applicable

func (*Node) SetRevB

func (t *Node) SetRevB(v string) *Node

SetRevB sets the [Node.RevB]: VCS revisions for files if applicable

func (*Node) SetStatus

func (t *Node) SetStatus(v string) *Node

SetStatus sets the [Node.Status]: Status of the change from A to B: A=Added, D=Deleted, M=Modified, R=Renamed

func (*Node) SetTextA

func (t *Node) SetTextA(v string) *Node

SetTextA sets the [Node.TextA]: Text content of the files

func (*Node) SetTextB

func (t *Node) SetTextB(v string) *Node

SetTextB sets the [Node.TextB]: Text content of the files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL