/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=2 et sw=2 tw=80: */ /* ** Copyright (c) 2013 D. Richard Hipp ** ** This program is free software; you can redistribute it and/or ** modify it under the terms of the Simplified BSD License (also ** known as the "2-Clause License" or "FreeBSD License".) ** ** This program is distributed in the hope that it will be useful, ** but without any warranty; without even the implied warranty of ** merchantability or fitness for a particular purpose. ** ** Author contact information: ** drh@hwaci.com ** http://www.hwaci.com/drh/ ** ******************************************************************************* ** This file implements a basic 'ls' for in-repo content ** (not yet filesystem-level). */ #include "fossil-scm/fossil-cli.h" /* Fossil App mini-framework */ /* #include "fossil-scm/fossil-internal.h" */ static void fcli_local_help(){ printf("Usage:\n\t%s [options]\n\n", fcli.appName); puts("TODO: help"); } static struct VDiffApp { char * glob; } VDiffApp = { NULL }; /** ** */ static int f_vdiff(fsl_id_t v1, fsl_id_t v2){ int rc = 0; #if 0 fsl_buffer lhs = fsl_buffer_empty; fsl_buffer rhs = fsl_buffer_empty; fsl_buffer diff = fsl_buffer_empty; #endif f_out("TODO figure out diffs of RIDs " "%"FSL_ID_T_PFMT" and %"FSL_ID_T_PFMT".\n", (fsl_id_t)v1, (fsl_id_t)v2); return rc; } int main(int argc, char * const * argv ){ int rc = 0; char * vFrom = NULL; char * vTo = NULL; fsl_cx * f; fsl_id_t idFrom = 0, idTo = 0; fcli.appHelp = fcli_local_help; rc = fcli_setup(argc, argv); if(FSL_RC_BREAK==rc) /* --help */ return 0; else if(rc) goto end; /* Set up/validate args... */ f = fcli.f; if(!fsl_cx_db_repo(f)){ rc = fcli_err_set(FSL_RC_NOT_A_REPO, "Requires a repository db. See --help."); goto end; } if( fcli_flag_or_arg( "v1", "from", &vFrom) ){ fcli_flag_or_arg( "v2", "to", &vTo); } if(!vFrom || !vTo){ rc = fcli_err_set(FSL_RC_MISUSE, "Both of -v1 UUID and -v2 UUID are required."); goto end; } rc = fsl_sym_to_rid(f, vFrom, FSL_CATYPE_CHECKIN, &idFrom); if(!rc){ rc = fsl_sym_to_rid(f, vTo, FSL_CATYPE_CHECKIN, &idTo); } if(rc) goto end; fcli_flag2("g","glob", &VDiffApp.glob); rc = f_vdiff( idFrom, idTo ); if(fcli_has_unused_flags(0)) goto end; end: fsl_free(VDiffApp.glob); return (fcli_err_report(0)||rc) ? EXIT_FAILURE : EXIT_SUCCESS; }