[PATCH c-hglib] level0.c: log command example, implemented using level 0

Matt Mackall mpm at selenic.com
Tue Sep 24 13:21:01 CDT 2013


On Mon, 2013-09-23 at 22:55 +0300, Iulian Stana wrote:
> # HG changeset patch
> # User Iulian Stana <julian.stana at gmail.com>
> # Date 1379682875 -10800
> #      Fri Sep 20 16:14:35 2013 +0300
> # Node ID fdb234af921ba5288ba30a4159aa7ff062f30875
> # Parent  0f979fbe86d000fad5f1807cfe7008d034c71483
> level0.c: log command example, implemented using level 0
> 
> This is a illustative implementation for log command. The data is unparsed and
> the implementation is using just level0 functions.
> 
> diff --git a/examples/level0.c b/examples/level0.c
> new file mode 100644
> --- /dev/null
> +++ b/examples/level0.c
> @@ -0,0 +1,126 @@
> +#include <stdio.h>
> +#include <stdlib.h>
> +#include <string.h>
> +
> +#include <unistd.h>
> +
> +#include "../hglib/client.h"
> +#include "../hglib/utils.h"

Let's pass a -I to the compiler instead of relative paths here.

> +
> +#define BUFF_SIZE 4096
> +
> +/****** Convenience functions. *******/
> +
> +/**
> + * \brief Create and setup the tmp directory where the acction will happends.

You might invest in enabling a spell-checker in your editor. For
instance, flyspell in emacs.

> + * \brief Fill the current repository with commits for log command.

It's sufficient to just work on an existing repo rather than build one.
Let's aim to make an example that's as short and simple as possible.

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list