From patchwork Sat Sep 14 00:35:53 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [41, of, 55, RFC, c-hglib:level1] hg_remove: creating a high level function for mercurial remove command From: Iulian Stana X-Patchwork-Id: 2485 Message-Id: To: mercurial-devel@selenic.com Date: Sat, 14 Sep 2013 03:35:53 +0300 # HG changeset patch # User Iulian Stana # Date 1379115559 -10800 # Sat Sep 14 02:39:19 2013 +0300 # Node ID a27d088e451fcf982bf8baaa2ef8687f72acfbdd # Parent 8fcdd165d31f87fe3d6728d2647f91bf0bda5a4a hg_remove: creating a high level function for mercurial remove command diff --git a/client.c b/client.c --- a/client.c +++ b/client.c @@ -1163,6 +1163,23 @@ return exitcode; } +/* The high level remove command for hglib API. */ +int hg_remove(hg_handle *handle, int(*callback)(const char *msg, size_t len), + char *argument[]) +{ + int exitcode; + char **command = cmdbuilder("remove", argument , NULL); + + if(hg_rawcommand(handle, command) < 0){ + return -1; + } + free(command); + + exitcode = hg_runcommand(handle, callback, NULL); + + return exitcode; +} + /* The yield next step. Getting the next entry. */ int hg_fetch_entry(hg_stream_buffer *stream, int (*detect_byte)(char *buff, int buf_size, int data_on_pipe), int func_type) diff --git a/client.h b/client.h --- a/client.h +++ b/client.h @@ -1752,6 +1752,33 @@ * - hg_rawcommand errors * */ int hg_recover(hg_handle *handle, int(*callback)(const char *msg, size_t len)); + +/** + * \brief hg_remove command for hglib API. + * + * Schedule the indicated files for removal from the current branch. + * + * This command schedules the files to be removed at the next commit. To undo a + * remove before that, see hg revert. To undo added files, see hg forget. + * + * Options/Argument list option: + * + * -A, --after record delete for missing files + * -f, --force remove (and delete) file even if added or modified + * -I, --include include names matching the given patterns + * -X, --exclude exclude names matching the given patterns + * + * \param handle The handle of the connection, wherewith I want to communicate + * \param callback A function that will handle error data. + * A NULL pointer will ignore error data. + * \param argument The option list. Will contain all option that you wish. + * \retval exitcode To indicate the end of remove_command. + * + * errno can be: + * - hg_rawcommand errors + * */ +int hg_remove(hg_handle *handle, int(*callback)(const char *msg, size_t len), + char *argument[]); /** * \brief The yield mechanism that will get the next entry.