c-hglib
 All Data Structures Files Functions Variables Typedefs Macros
main.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/wait.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "client.h"
#include "utils.h"

Go to the source code of this file.

Macros

#define INIT_REPO   "init_test_repo"

Functions

void setup_tmp ()
 Create and setup the tmp directory where the acction will happends.
void clean_tmp ()
 Remove the tmp directory and all his files.
void setup_init ()
 Setup for init command.
void post_init_setup ()
 Create some commits in the current repository.
void setup_log ()
 Fill the current repository with commits for log command.
void setup_merge ()
 Setup the merge command. Without conflicts.
void setup_conflict_merge ()
 Setup the merge command. Create a conflict that will have prompts.
void setup_export_import ()
 Setup environment for export_import process.
void clean_export_import ()
 Clean the export and the import directorys.
void setup_filename_with_space ()
 Setup for filename_with_space example.
hg_handlehg_init_by_hand ()
 Init command example.
int hg_log_by_hand (hg_handle *handle)
 Log command example.
int hg_import_by_hand (hg_handle *handle, char *import_patch)
 Import command example.
char prompt_function (char *output)
 The prompt function for the merge funtion.
int hg_merge_by_hand (hg_handle *handle, char(*prompt)(char *))
 The merge command example.
int hg_verify_by_hand (hg_handle *handle)
 The verify command example.
void hg_export_import_by_hand (hg_handle *ehandle, hg_handle *ihandle)
 The export-import command example.
int hg_add_filename_with_space_by_hand (hg_handle *handle)
 Adding a file that contain spaces example.
void print_select_case ()
 Printing the welcome message.
int main (int argc, char **argv)
 The main function.

Macro Definition Documentation

#define INIT_REPO   "init_test_repo"

Definition at line 14 of file main.c.

Function Documentation

void setup_tmp ( )

Create and setup the tmp directory where the acction will happends.

Definition at line 21 of file main.c.

void clean_tmp ( )

Remove the tmp directory and all his files.

Definition at line 30 of file main.c.

void setup_init ( )

Setup for init command.

Definition at line 39 of file main.c.

void post_init_setup ( )

Create some commits in the current repository.

Definition at line 48 of file main.c.

void setup_log ( )

Fill the current repository with commits for log command.

Definition at line 59 of file main.c.

void setup_merge ( )

Setup the merge command. Without conflicts.

Definition at line 70 of file main.c.

void setup_conflict_merge ( )

Setup the merge command. Create a conflict that will have prompts.

Definition at line 82 of file main.c.

void setup_export_import ( )

Setup environment for export_import process.

Definition at line 93 of file main.c.

void clean_export_import ( )

Clean the export and the import directorys.

Definition at line 105 of file main.c.

void setup_filename_with_space ( )

Setup for filename_with_space example.

Definition at line 113 of file main.c.

hg_handle* hg_init_by_hand ( )

Init command example.

Create a repo to the specific path, and then open the connection with this new repo.

The clone command will follow the same steps.

  • clone repo
  • open connection.
Return values
handlefor the new repo.

Definition at line 134 of file main.c.

int hg_log_by_hand ( hg_handle handle)

Log command example.

Will read a huge mass of data in chunks and then will print this data on stdout.

Parameters
handleThe handle of the connection, wherewith I want to communicate
Return values
exitcode

Definition at line 167 of file main.c.

int hg_import_by_hand ( hg_handle handle,
char *  import_patch 
)

Import command example.

The purpose is to show the functionality, it's not the import function. This function will import to the handle the import_patch, using input environment.

Parameters
handleThe handle of the connection, wherewith I want to communicate
import_patchthe file from where to simulate the input importing.
Return values
exitcode

Definition at line 198 of file main.c.

char prompt_function ( char *  output)

The prompt function for the merge funtion.

Return values
charthe chosen option.

Definition at line 229 of file main.c.

int hg_merge_by_hand ( hg_handle handle,
char(*)(char *)  prompt 
)

The merge command example.

The merge function gets a prompt function that deals promps.

The prompt function will read the option from standart input. The purpose is to show the mechanism(is't not a level 0 issue)

Parameters
handleThe handle of the connection, wherewith I want to communicate
prompta pointer to a function.
Return values
exitcode

Definition at line 248 of file main.c.

int hg_verify_by_hand ( hg_handle handle)

The verify command example.

Will receive data, either from output channel, either from error channel. The data is printed on stdout.

Parameters
handleThe handle of the connection, wherewith I want to communicate
Return values
exitcode

Definition at line 294 of file main.c.

void hg_export_import_by_hand ( hg_handle ehandle,
hg_handle ihandle 
)

The export-import command example.

An export-import process that is not buffering the entire path in to memory

Parameters
ehandleThe handle connection, from where I am exporting
ihandleThe handle connection, where I am importing.
Return values
exitcode

Definition at line 328 of file main.c.

int hg_add_filename_with_space_by_hand ( hg_handle handle)

Adding a file that contain spaces example.

Parameters
handleThe handle of the connection, wherewith I want to communicate
Return values
exitcode

Definition at line 368 of file main.c.

void print_select_case ( )

Printing the welcome message.

Will print the options that you will have in this example.

Definition at line 393 of file main.c.

int main ( int  argc,
char **  argv 
)

The main function.

Definition at line 414 of file main.c.