C# Class Hpdi.Vss2Git.GitWrapper

Wraps execution of Git and implements the common Git commands.
显示文件 Open project: abevoelker/vss2git Class Usage Examples

Public Methods

Method Description
Add ( IEnumerable paths ) : bool
Add ( string path ) : bool
AddAll ( ) : bool
Commit ( string authorName, string authorEmail, string comment, DateTime localTime ) : bool
FindExecutable ( ) : bool
GitWrapper ( string repoPath, Logger logger ) : System
Init ( ) : void
Move ( string sourcePath, string destPath ) : void
Remove ( string path, bool recursive ) : void
SetConfig ( string name, string value ) : void
Tag ( string name, string taggerName, string taggerEmail, string comment, DateTime localTime ) : void

Private Methods

Method Description
AddComment ( string comment, string &args, TempFile &tempFile ) : void
Execute ( ProcessStartInfo startInfo, string &stdout, string &stderr ) : int
ExecuteUnless ( ProcessStartInfo startInfo, string unless ) : bool
FailExitCode ( string exec, string args, string stdout, string stderr, int exitCode ) : void
FindInPathVar ( string filename, string &foundPath ) : bool
FindInPaths ( string filename, IEnumerable searchPaths, string &foundPath ) : bool
GetStartInfo ( string args ) : ProcessStartInfo
GetUtcTimeString ( DateTime localTime ) : string
GitExec ( string args ) : void
GitExecUnless ( string args, string unless ) : bool
NeedsQuoting ( char c ) : bool
Quote ( string arg ) : string

Puts quotes around a command-line argument if it includes whitespace or quotes.

There are two things going on in this method: quoting and escaping. Quoting puts the entire string in quotes, whereas escaping is per- character. Quoting happens only if necessary, when whitespace or a quote is encountered somewhere in the string, and escaping happens only within quoting. Spaces don't need escaping, since that's what the quotes are for. Slashes don't need escaping because apparently a backslash is only interpreted as an escape when it precedes a quote. Otherwise both slash and backslash are just interpreted as directory separators.

memoryStreamToString ( MemoryStream strm ) : string
parseOutput ( StreamReader output, char mark ) : string

Method Details

Add() public method

public Add ( IEnumerable paths ) : bool
paths IEnumerable
return bool

Add() public method

public Add ( string path ) : bool
path string
return bool

AddAll() public method

public AddAll ( ) : bool
return bool

Commit() public method

public Commit ( string authorName, string authorEmail, string comment, DateTime localTime ) : bool
authorName string
authorEmail string
comment string
localTime DateTime
return bool

FindExecutable() public method

public FindExecutable ( ) : bool
return bool

GitWrapper() public method

public GitWrapper ( string repoPath, Logger logger ) : System
repoPath string
logger Logger
return System

Init() public method

public Init ( ) : void
return void

Move() public method

public Move ( string sourcePath, string destPath ) : void
sourcePath string
destPath string
return void

Remove() public method

public Remove ( string path, bool recursive ) : void
path string
recursive bool
return void

SetConfig() public method

public SetConfig ( string name, string value ) : void
name string
value string
return void

Tag() public method

public Tag ( string name, string taggerName, string taggerEmail, string comment, DateTime localTime ) : void
name string
taggerName string
taggerEmail string
comment string
localTime DateTime
return void