From acdabdf359e47a739922efdd586d5353cd18e8e0 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 18 Feb 2009 04:14:45 +0100 Subject: get rid of svn id for now --- src/syrep.c | 140 ++++++++++++++++++++++++++++++------------------------------ 1 file changed, 70 insertions(+), 70 deletions(-) diff --git a/src/syrep.c b/src/syrep.c index 23843a2..96412ae 100644 --- a/src/syrep.c +++ b/src/syrep.c @@ -7,12 +7,12 @@ under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + syrep 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. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with syrep; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -58,7 +58,7 @@ #include "cleanup.h" #include "forget.h" -#include "svn-revision.h" +/* #include "svn-revision.h" */ volatile int interrupted = 0; @@ -83,10 +83,10 @@ static int do_diff(void) { if (!(path1 = strdup(get_snapshot_filename(args.inputs[0], SYREP_SNAPSHOTFILENAME)))) goto finish; - + if (!(path2 = strdup(get_snapshot_filename(args.inputs[1], SYREP_SNAPSHOTFILENAME)))) goto finish; - + if (!strcmp(path1, path2)) { fprintf(stderr, "ERROR: diff command requires two distinct snapshots as arguments\n"); goto finish; @@ -94,10 +94,10 @@ static int do_diff(void) { if (!(c1 = db_context_open(path1, 0))) goto finish; - + if (!(c2 = db_context_open(path2, 0))) goto finish; - + if (!(ddb = make_diff(c1, c2))) goto finish; @@ -105,7 +105,7 @@ static int do_diff(void) { goto finish; r = 0; - + finish: if (c1) db_context_free(c1); @@ -145,13 +145,13 @@ static int do_merge(void) { mkdir(p, 0777); set_tmp_dir(p); } - + if (!(path1 = strdup(get_snapshot_filename(args.inputs[0], SYREP_SNAPSHOTFILENAME)))) goto finish; - + if (!(path2 = strdup(get_snapshot_filename(args.inputs[1], SYREP_SNAPSHOTFILENAME)))) goto finish; - + if (!strcmp(path1, path2)) { fprintf(stderr, "ERROR: merge command requires two distinct snapshots as arguments\n"); goto finish; @@ -159,18 +159,18 @@ static int do_merge(void) { if (!(c1 = db_context_open(path1, 0))) goto finish; - + if (!(c2 = db_context_open(path2, 0))) goto finish; if (db_context_origin_warn(c2)) goto finish; - + if (merge(c1, c2, args.inputs[1], isdirectory(args.inputs[0]) > 0 ? args.inputs[0] : NULL) < 0) goto finish; r = 0; - + finish: if (c1) db_context_free(c1); @@ -201,19 +201,19 @@ static int do_makepatch(void) { fprintf(stderr, "ERROR: %s is not a directory\n", args.inputs[0]); goto finish; } - + if (args.local_temp_flag) { const char *p = get_attached_filename(args.inputs[0], SYREP_TEMPDIR); mkdir(p, 0777); set_tmp_dir(p); } - + if (!(path1 = strdup(get_snapshot_filename(args.inputs[0], SYREP_SNAPSHOTFILENAME)))) goto finish; - + if (!(path2 = strdup(get_snapshot_filename(args.inputs[1], SYREP_SNAPSHOTFILENAME)))) goto finish; - + if (!strcmp(path1, path2)) { fprintf(stderr, "ERROR: makepatch command requires two distinct snapshots as arguments\n"); goto finish; @@ -221,10 +221,10 @@ static int do_makepatch(void) { if (!(c1 = db_context_open(path1, 0))) goto finish; - + if (db_context_origin_warn(c1)) goto finish; - + if (!(c2 = db_context_open(path2, 0))) goto finish; @@ -237,7 +237,7 @@ static int do_makepatch(void) { goto finish; r = 0; - + finish: if (c1) db_context_free(c1); @@ -262,7 +262,7 @@ static int do_foreach(int (*func) (struct syrep_db_context *c), int m) { if (args.inputs_num < 1) fprintf(stderr, "WARNING: No repository or snapshot to specified!\n"); - + for (i = 0; i < args.inputs_num; i++) { static char saved_cwd[PATH_MAX]; @@ -271,30 +271,30 @@ static int do_foreach(int (*func) (struct syrep_db_context *c), int m) { mkdir(p, 0777); set_tmp_dir(p); } - + if (!(path = strdup(get_snapshot_filename(args.inputs[i], SYREP_SNAPSHOTFILENAME)))) goto finish; - + if (!(c = db_context_open(path, 0))) goto finish; if (args.inputs_num > 1) fprintf(stderr, "*** %s ***\n", path); - + if (m && args.output_directory_given) { if (!getcwd(saved_cwd, sizeof(saved_cwd))) { fprintf(stderr, "getcwd(): %s\n", strerror(errno)); return -1; } - + mkdir(args.output_directory_arg, 0777); - + if (chdir(args.output_directory_arg) < 0) { fprintf(stderr, "Failed to chdir() to directory %s: %s\n", args.output_directory_arg, strerror(errno)); return -1; } } - + if (func(c) < 0) goto finish; @@ -307,16 +307,16 @@ static int do_foreach(int (*func) (struct syrep_db_context *c), int m) { if (args.inputs_num > 1 && i < args.inputs_num-1) fprintf(stderr, "\n"); - + db_context_free(c); c = NULL; - + free(path); path = NULL; } r = 0; - + finish: if (c) db_context_free(c); @@ -341,10 +341,10 @@ static int do_update(void) { fprintf(stderr, "ERROR: If a snapshot file is specified only a single directory name is accepted!\n"); goto finish; } - + for (i = 0; i < args.inputs_num; i++) { static char saved_cwd[PATH_MAX]; - + if (isdirectory(args.inputs[i]) <= 0) { fprintf(stderr, "%s is not a directory\n", args.inputs[i]); return 1; @@ -355,10 +355,10 @@ static int do_update(void) { mkdir(p, 0777); set_tmp_dir(p); } - + if (!(path = strdup(get_snapshot_filename(args.inputs[i], SYREP_SNAPSHOTFILENAME)))) goto finish; - + if (!(c = db_context_open(path, 1))) goto finish; @@ -370,7 +370,7 @@ static int do_update(void) { if (!args.no_cache_flag) { const char *p; - + if (args.cache_given) cache = md_cache_open(args.cache_arg, args.ro_cache_flag); else if ((p = get_attached_filename(args.inputs[i], SYREP_MDCACHEFILENAME))) @@ -381,12 +381,12 @@ static int do_update(void) { fprintf(stderr, "getcwd(): %s\n", strerror(errno)); goto finish; } - + if (chdir(args.inputs[i]) < 0) { fprintf(stderr, "Failed to chdir() to directory %s: %s\n", args.inputs[i], strerror(errno)); goto finish; } - + if (update(c, cache) < 0) goto finish; @@ -398,9 +398,9 @@ static int do_update(void) { if (db_context_save(c, path) < 0) goto finish; - if (!args.no_purge_flag && cache) - md_cache_vacuum(cache); - + if (!args.no_purge_flag && cache) + md_cache_vacuum(cache); + db_context_free(c); c = NULL; @@ -414,11 +414,11 @@ static int do_update(void) { } r = 0; - + finish: if (c) db_context_free(c); - + if (path) free(path); @@ -434,7 +434,7 @@ static int do_cleanup(void) { if (args.inputs_num < 1) fprintf(stderr, "WARNING: No repository specified!\n"); - + for (i = 0; i < args.inputs_num; i++) { if (isdirectory(args.inputs[i]) <= 0) { @@ -444,7 +444,7 @@ static int do_cleanup(void) { if (args.inputs_num > 1) fprintf(stderr, "*** %s ***\n", args.inputs[i]); - + if (cleanup(args.inputs[i]) < 0) goto finish; @@ -453,7 +453,7 @@ static int do_cleanup(void) { } r = 0; - + finish: return r; @@ -467,23 +467,23 @@ static int do_forget(void) { if (args.inputs_num < 1) fprintf(stderr, "WARNING: No repository or snapshot to specified!\n"); - + for (i = 0; i < args.inputs_num; i++) { if (args.local_temp_flag && isdirectory(args.inputs[i]) >= 1) { const char *p = get_attached_filename(args.inputs[i], SYREP_TEMPDIR); mkdir(p, 0777); set_tmp_dir(p); } - + if (!(path = strdup(get_snapshot_filename(args.inputs[i], SYREP_SNAPSHOTFILENAME)))) goto finish; - + if (!(c = db_context_open(path, 0))) goto finish; if (!(target = db_context_open(NULL, 1))) goto finish; - + if (args.inputs_num > 1) fprintf(stderr, "*** %s ***\n", path); @@ -492,22 +492,22 @@ static int do_forget(void) { if (args.inputs_num > 1 && i < args.inputs_num-1) fprintf(stderr, "\n"); - + db_context_free(c); if (db_context_save(target, path) < 0) goto finish; - + db_context_free(target); c = NULL; target = NULL; - + free(path); path = NULL; } r = 0; - + finish: if (c) db_context_free(c); @@ -527,7 +527,7 @@ static void sigint(int s) { static void free_args(void) { unsigned i; - + for (i = 0; i < args.inputs_num; i++) free(args.inputs[i]); @@ -563,13 +563,13 @@ static int help(FILE *f, const char *argv0) { " --sort Sort chronologically\n\n" " --info SNAPSHOT Show information about a repository or\n" - " snapshot\n\n" + " snapshot\n\n" " --history SNAPSHOT Show history of a repository or snapshot\n\n" - + " --dump SNAPSHOT Show a structure dump of a repository or\n" " snapshot\n\n" - + " --update DIRECTORY Update (or create) a repository snapshot\n" " -SSTRING --snapshot=STRING Use a different snapshot file than the\n" " one contained in the repository\n" @@ -581,13 +581,13 @@ static int help(FILE *f, const char *argv0) { " --ro-cache Use read only cache\n" " --check-dev Store information about the device where\n" " a file resides in the MD cache\n\n" - + " --diff SNAPSHOT SNAPSHOT Show difference between two repositories\n" " or snapshots\n" " --sizes -s Show sizes for files to copy (works only\n" " with repositories)\n" " --human-readable -H Show sizes in human readable from\n" - + " --merge SNAPSHOT DIRECTORY Merge a snapshot into a repository\n" " (perform deletes, renames only)\n" " --merge PATCH DIRECTORY Merge a patch into a repository\n" @@ -600,7 +600,7 @@ static int help(FILE *f, const char *argv0) { " --always-copy Always copy instead of hard link\n\n", argv0, argv0); - fprintf(f, + fprintf(f, " --makepatch DIRECTORY SNAPSHOT Make a patch against the specified\n" " repository\n" " -oSTRING --output-file=STRING Write output to specified file instead\n" @@ -608,11 +608,11 @@ static int help(FILE *f, const char *argv0) { " --include-all Include files in patch which do exist on\n" " the other side under a \n" " different name\n\n" - + " --extract SNAPSHOT Extract the contents of a snapshot or\n" " patch\n" " -DSTRING --output-directory=STRING Write output to specified directory\n\n" - + " --cleanup DIRECTORY Remove syrep info from repository\n" " -lINT --cleanup-level=INT 1 - just remove temporary data and trash\n" " (default)\n" @@ -622,7 +622,7 @@ static int help(FILE *f, const char *argv0) { " information\n" " --remember DAYS Information of how many days should be\n" " kept? (defaults to 180)\n"); - + return 0; } @@ -631,13 +631,13 @@ static int version(const char *argv0) { int major, minor, patch; db_version(&major, &minor, &patch); - + fprintf(stderr, "%s "PACKAGE_VERSION"\n" "Compiled with %i Bit off_t.\n" "Compiled with zlib %s, linked to zlib %s.\n" "Compiled with libdb %i.%i.%i, linked to libdb %i.%i.%i\n" - "SVN Revision "SVN_REVISION"\n" +/* "SVN Revision "SVN_REVISION"\n" */ #ifdef USE_XATTR "Compiled with extended attribute support: yes\n" #else @@ -666,7 +666,7 @@ int main(int argc, char *argv[]) { bn = argv[0]; signal(SIGINT, sigint); - + cmdline_parser(argc, argv, &args); atexit(free_args); @@ -674,9 +674,9 @@ int main(int argc, char *argv[]) { return help(stdout, bn); else if (args.version_given) return version(bn); - else if (args.list_flag) + else if (args.list_flag) return do_foreach(list, 0); - else if (args.info_flag) + else if (args.info_flag) return do_foreach(info, 0); else if (args.history_flag) return do_foreach(history, 0); @@ -698,6 +698,6 @@ int main(int argc, char *argv[]) { return do_forget(); help(stderr, bn); - + return 1; } -- cgit