Commits

m...@mm-laptop  committed db84da2

Added some documentation

  • Participants
  • Parent commits e7af528

Comments (0)

Files changed (3)

 I => 'ignored'
 );
 
-# TODO
-# diff of file/dir/project
-# commit of file/dir/project
+
 
 =head1 NAME
 
-Padre::Plugin::Git - Simple Git interface for Padre
+Padre::Plugin::HG - Mecurial interface for Padre
 
 =head1 SYNOPSIS
 
-cpan install Padre::Plugin::Git
+cpan install Padre::Plugin::HG
 
-Acces it via Plugin/Git
+Access it via Plugin/HG then View Project 
 
 
 =head1 AUTHOR
 
-Kaare Rasmussen, C<< <kaare at cpan.org> >>
+Michael Mueller << <michael at muellers.net.au> >>
 
 =head1 BUGS
 
 
 =head1 COPYRIGHT & LICENSE
 
-Copyright 2008-2009 The Padre development team as listed in Padre.pm.
+Copyright 2008-2009 Michael Mueller
 all rights reserved.
 
 This program is free software; you can redistribute it and/or modify it
 		'View Project'	    => sub {$self->show_statusTree},
 		'Add'		    => sub {$self->vcs_add},
 		'Clone'		    => sub {$self->show_project_clone},
-		'Commit...' => [
-			'File'     => sub { $self->vcs_commit_file },
-			'Project'  => sub { $self->show_commit_list},
-		],
-		'Status...' => [
-			'File'    => sub { $self->vcs_status_of_file },
-			'Dir'     => sub { $self->status_of_dir },
-			'Project' => sub { $self->vcs_status_of_project },
-		],
-		'Diff...' => [
-			'File'    => sub { $self->diff_of_file },
-			'Dir'     => sub { $self->diff_of_dir },
-			'Project' => sub { $self->diff_of_project },
-		],
+		'Commit...' 	  => sub { $self->show_commit_list},
 	];
 }
 
 	my $about = Wx::AboutDialogInfo->new;
 	$about->SetName("Padre::Plugin::HG");
 	$about->SetDescription( <<"END_MESSAGE" );
-Initial HG support for Padre
+Mecurial support for Padre
 END_MESSAGE
 	$about->SetVersion( $VERSION );
 
 
 	return;
 }
+=pod
 
+=head2 vcs_commit
+ performs the commit 
+ $self->vcs_commit($filename, $dir);
+ will prompt for the commit message.
+=cut
 
 sub vcs_commit {
 	my ($self, $path, $dir ) = @_;
 	return;	
 }
 
+=pod
 
+=head2 vcs_add
+ Adds the file to the repository
+ $self->vcs_add($filename, $dir);
+ will prompt for the commit message.
+=cut
 
 sub vcs_add {
 	my ($self, $path, $dir) = @_;
 	my $main = Padre->ide->wx->main;
-
-	#$main->message( "$VCS adding $path", 'Adding to Repository' );
 	my $command = eval "qq\0$VCSCommand{add} $path\0";
 	my $result = $self->vcs_execute($command,$dir);
 	$main->message( $result, "$VCS Adding to Repository" );
 	return;	
 }
 
+=pod
+
+=head2 vcs_add
+ Adds the file to the repository
+ $self->vcs_diff($filename, $dir);
+ provides some basic diffing the current file agains the tip
+=cut
 sub vcs_diff {
 	my ($self, $path, $dir) = @_;
 	
 	return;
 }
 
+=pod
+
+=head2 clone_project
+ Adds the file to the repository
+ $self->vcs_diff($repository, $destination_dir);
+ Will clone a repository and place it in the destination dir
+=cut
 sub clone_project
 {
 	my ($self, $path, $dir) = @_;
 	$main->message( $result, "$VCS Cloning $path" );
 	return;
 }
-
+=pod
+=head2 pull_update_project
+ Pulls updates to a project. 
+ It will perform an update automatically on the repository
+ $self->pull_update_project($file, $projectdir);
+ Only pulls changes from the default repository, which is normally
+ the one you cloned from.
+=cut
 sub pull_update_project
 {
 	my ($self, $path, $dir) = @_;
 	$main->message( $result, "$VCS Cloning $path" );
 	return;
 }
-
+=pod
+=head2 push_project
+ Pushes updates to a remote repository. 
+ Prompts for the username and password. 
+ $self->push_project($file, $projectdir);
+ Only pushes changes to the default remote repository, which is normally
+ the one you cloned from.
+=cut
 sub push_project
 {
 	my ($self, $path, $dir) = @_;
 	$main->message( $result, "$VCS Pushing $path" );
 	return;
 }
-
+=pod
+=head2 vcs_execute
+ executes a command after changing to the appropriate dir.
+ $self->vcs_execute($command, $dir);
+ All output is captured and returned as a string.
+=cut
 sub vcs_execute
 {
 	my ($self, $command, $dir) = @_;
 	print "\n\nresult = $result \n\n";
 	return $result;
 }
-# displays the status of the Hg project in the side bar. 
-#
+=pod
+=head2 show_statusTree
+ Displays a Project Browser in the side pane. The Browser shows the status of the
+ files in HG and gives menu options to perform actions. 
+=cut
 sub show_statusTree
 {	
 	my ($self) = @_;
 	}
 }
 
-# displays the status of the Hg project in the side bar. 
-#
+=pod
+=head2 show_commit_list
+ Displays a list of all the files that are awaiting commiting. It will include
+ not added and deleted files adding and removing them as required. 
+=cut
 sub show_commit_list
 {	
 	my ($self) = @_;
 	Padre::Plugin::HG::ProjectCommit->showList($self);	
 
 }
+=pod
+=head2 show_project_clone
+ Dialog for project cloning
+=cut
 
 sub show_project_clone
 {	
 	Padre::Plugin::HG::ProjectClone->new($self);	
 
 }
-
-
-
+=pod
+=head2 _project_root
+ $self->_project_root($filename);
+ Calculates the project root.  if the file is not in a project it 
+ will return 0 
+ otherwise it returns the fully qualified path to the project. 
+=cut
 
 sub _project_root
 {
 	chomp ($project_root);
 	return $project_root;
 }
-
+=pod
+=head2 _get_hg_files
+ $self->_get_hg_files(@hgStatus);
+  Pass the output of hg status and it will give back an array
+  each element of the array is [$status, $filename]
+=cut
 
 sub _get_hg_files
 {
 	return @files;
 }
 
+=pod
+=head2 current_filename
+ $self->current_filename();
+  returns the path of the file with the current attention 
+  in the ide.
+=cut
 
 
 sub current_filename {
 
 1;
 
-# Copyright 2008-2009 The Padre development team as listed in Padre.pm.
+# Copyright 2008-2009 Michael Mueller.
 # LICENSE
 # This program is free software; you can redistribute it and/or
 # modify it under the same terms as Perl 5 itself.

File HG/StatusTree.pm

 package Padre::Plugin::HG::StatusTree;
+=pod
 
+=head1 NAME
+
+Padre::Plugin::HG::StatusTree
+Displays the status of the current hg project in a tree format
+
+=head1 SYNOPSIS
+ my $object = Padre::Plugin::HG::StatusTree->new($self,$project_root);
+
+=head1 DESCRIPTION
+
+This module diplays a tree in the left panel of the ide that shows
+the mecurial status of each file.  
+Right clicking on a file will give you options to perform actions.  Right clicking the
+project root will give you project wide options. 
+
+=head1 METHODS
+
+=cut
 use strict;
 use warnings;
 
 my %WxTree;
 my $ThisTree;
 
- my $images = Wx::ImageList->new( 16, 16 );
+  #setup the image list 
+  my $images = Wx::ImageList->new( 16, 16 );
         my $file_types = {
                 M => $images->Add(
 	                        Wx::ArtProvider::GetBitmap( 'wxART_TIP', 'wxART_OTHER_C', [ 16, 16 ] ),
                         Wx::ArtProvider::GetBitmap( 'wxART_MISSING_IMAGE', 'wxART_OTHER_C', [ 16, 16 ] ),
                 ),
           };
+  
+
 
 
 my @root = qw (root root);
 
-
-
-
+=pod
+=head2 new
+ Creates and displays the status tree
+ $tree = Padre::Plugin::HG::StatusTree->new($self, $project_root);
+=cut
 
 sub new
 {
   my ($class, $hg, $root) = @_;
   $project_name = $root;
   $HG = $hg;
+
   my $self       = $class->SUPER::new( Padre::Current->main->left );
   my $box        = Wx::BoxSizer->new(Wx::wxVERTICAL);
   my $treectrl = Wx::TreeCtrl->new( $self, -1 );
    
 }
 
-sub process_key {
-        my ( $input, $event ) = @_;
-        my $code = $event->GetKeyCode;
 
-        if ( $code == WXK_UP ) {
-                Padre::Plugin::REPL::History::go_previous();
-        } elsif ( $code == WXK_DOWN ) {
-                Padre::Plugin::REPL::History::go_next();
-        }
-        $event->Skip();
-}
+=pod
+=head2 gettext_label
+        Works out what to name the tab for the project.
+=cut
 
 sub gettext_label {
         
         return "(HG) ".$name;
 }
 
-
- 
-#$dirTree{root} = 'root';# = treectrl->AppendRoot('.');
-
+=pod
+=head2 getWxNode
+        Add the nodes to the tree. 
+        getWxNode($treectrl,[name,parent,type],path);
+=cut
 
 sub getWxNode
 {
 	                                        type => 'root',
 	                                })  ); 
     
-  #$treectrl->DeleteAllItems;
+ 
   %dirTree = ();
   $dirTree{root} = ['root', 'root', 'dir'];
   chdir ($project_name);

File HG/UserPassPrompt.pm

 
 =head1 NAME
 
-Module::Name - My author was too lazy to write an abstract
+Padre::Plugin::HG::UserPassPrompt 
+provides the username and password prompts for Padre::Plugin::HG
 
 =head1 SYNOPSIS
 
-  my $object = Module::Name->new(
-      foo  => 'bar',
-      flag => 1,
+  my $object = Padre::Plugin::HG::UserPassPrompt->new(
+      title => 'project X',
+      default_username => 'fred',
+      default_password => 'XXXX',
+      
   );
   
-  $object->dummy;
+  $password = $object->{password};
+  $username = $object->{username};
 
 =head1 DESCRIPTION
 
-The author was too lazy to write a description.
+This module diplays a username and password prompt for actions like
+pushing in Padre::Plugin::HG
 
 =head1 METHODS
 
 
 =head2 new
 
-  my $object = Module::Name->new(
+  my $object = adre::Plugin::HG::UserPassPrompt->new(
       title => 'project X',
       default_username => 'fred',
       default_password => 'XXXX',
       
   );
 
-The C<new> constructor lets you create a new B<Module::Install> object.
+The C<new> constructor is the only method. 
+it will display the username and password prompts  
 
-So no big surprises there...
-
-Returns a new B<Module::Install> or dies on error.
+Access the results via
+$object->{username} and $object->{password}
 
 =cut
 
 
 =head1 SUPPORT
 
-No support is available
+http://bitbucket.org/code4pay/padre-plugin-hg/
 
 =head1 AUTHOR
 
-Copyright 2008 Anonymous.
+Copyright 2008 Michael Mueller .
 
 =cut