Phly Documentation Phly
Phly_Darcs
[ return to channel ] [ class tree: Phly ] [ index: Phly ] [ all elements ]

Class: Phly_Darcs_Model

Source Location: /Phly_Darcs/Phly/Darcs/Model.php

Class Phly_Darcs_Model

Class Overview

Make calls to darcs

Allows a developer to list darcs repositories, browse them, and retrieve information about changes.

Located in /Phly_Darcs/Phly/Darcs/Model.php [line 43]



		
				Author(s):
		
		
		
Information Tags:
Version:  $Id: Phly_Darcs_Model.html 71 2007-05-12 20:54:24Z matthew $
Copyright:  2006 - Present, Matthew Weier O'Phinney
License:  BSD
Todo:  Ability to PUT to repository
[ Top ]
Property Summary
false|string   $_darcs   Darcs executable
false|string   $_repoPath   Path to directory containing one or more darcs repositories

[ Top ]
Method Summary
string   browseRepo()   Create a directory listing for a given path in a repository
string   execute()   Execute a darcs command
array   getRepos()   Get a list of current repositories
string   listRepos()   Return a list of darcs repositories
boolean   setExecutable()   Set the path to the darcs executable
boolean   setRepoPath()   Set base repository path
string   xmlWrap()   Wrap XML output with root element
string   _annotateClean()   Clean up annotation XML
void   _createTree()   Recursively fix name attributes of directory and file nodes

[ Top ]
Properties
false|string   $_darcs = false [line 71]

Darcs executable

API Tags:
Static:  
Access:  protected


[ Top ]
false|string   $_repoPath = false [line 79]

Path to directory containing one or more darcs repositories

API Tags:
Static:  
Access:  protected


[ Top ]
Methods
browseRepo  [line 427]

  string browseRepo( string $repo, [string $path = '']  )

Create a directory listing for a given path in a repository

Parameters:
string   $repo: 
string   $path: 

API Tags:
Static:  
Access:  public

Information Tags:
Throws:  Phly_Exception for invalid repository or path

[ Top ]
execute  [line 238]

  string execute( string $repo, string $command, [null|string|array $args = null], [null|string $path = null]  )

Execute a darcs command

Executes a darcs command, using the --xml-output switch, and any switches passed in $args. XML output is normalized to include the following:

  • XML declaration
  • Repository name
  • Path on which command was run (if available)
execute() assumes that you have already provided the path to the darcs executable via setExecutable(), as well as the base path to the darcs repositories via setRepoPath(); if either is not true, an exception is raised.

Exceptions are also raised if the $repo does not exist, or if the $command is not in $_commands.

If the command selected is 'diff', the switch '-u' is automatically selected, and the actuall diff is wrapped in CDATA between <diff> tags.

Parameters:
string   $repo:  Repository to use
string   $command:  Darcs command to use
null|string|array   $args:  Switches to pass to darcs command
null|string   $path:  Path being queried within repository

API Tags:
Static:  
Access:  public

Information Tags:
Throws:  Phly_Exception

[ Top ]
getRepos  [line 378]

  array getRepos( )

Get a list of current repositories


API Tags:
Static:  
Access:  public

Information Tags:
Throws:  Phly_Exception when base repo path not set

[ Top ]
listRepos  [line 406]

  string listRepos( )

Return a list of darcs repositories


API Tags:
Static:  
Access:  public


[ Top ]
setExecutable  [line 99]

  boolean setExecutable( [string $path = null]  )

Set the path to the darcs executable

If no argument is passed, or if an invalid argument is passed, and $_darcs is not set, it then attempts to find darcs in the PATH. If it does, it sets $_darcs to that value; otherwise, an exception is thrown.

True is returned when $path is successfully used to set the path; false if setExecutable() has to find darcs in the path or if the new argument is invalid.

Parameters:
string   $path: 

API Tags:
Static:  
Access:  public

Information Tags:
Throws:  Phly_Exception

[ Top ]
setRepoPath  [line 133]

  boolean setRepoPath( string $path  )

Set base repository path

This is the path to a directory containing one or more darcs repositories; do not set it to the absolute path of a single repository, but instead to the parent of that path.

Parameters:
string   $path: 

API Tags:
Static:  
Access:  public

Information Tags:
Throws:  Phly_Exception

[ Top ]
xmlWrap  [line 160]

  string xmlWrap( string $data, [mixed $repo = null], [string $path = null]  )

Wrap XML output with root element

Creates the XML open tag and declaration and the 'darcs' root element. If $repo is provided, it will also create the <path> and children, based on $repo and $path.

Parameters:
string   $data: 
string   $path: 

API Tags:
Static:  
Access:  public


[ Top ]
_annotateClean  [line 324]

  string _annotateClean( string $xml  )

Clean up annotation XML

Cleans up annotation XML to fix directory and file name attributes to use full path within repository.

Parameters:
string   $xml: 

API Tags:
Static:  
Access:  protected


[ Top ]
_createTree  [line 344]

  void _createTree( DOMElement $node, [false|string $name = false]  )

Recursively fix name attributes of directory and file nodes

Parameters:
DOMElement   $node: 
false|string   $name: 

API Tags:
Static:  
Access:  protected


[ Top ]