SF.net SVN: geany-plugins:[1675] trunk/geany-plugins/geanyvc
yurand at users.sourceforge.net
yurand at xxxxx
Fri Oct 22 19:46:50 UTC 2010
Revision: 1675
http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=1675&view=rev
Author: yurand
Date: 2010-10-22 19:46:50 +0000 (Fri, 22 Oct 2010)
Log Message:
-----------
geanyvc: Added support of CVS commit
patch from Jean-Paul Iribarren, thanks
Modified Paths:
--------------
trunk/geany-plugins/geanyvc/THANKS
trunk/geany-plugins/geanyvc/src/vc_cvs.c
Modified: trunk/geany-plugins/geanyvc/THANKS
===================================================================
--- trunk/geany-plugins/geanyvc/THANKS 2010-10-17 19:25:27 UTC (rev 1674)
+++ trunk/geany-plugins/geanyvc/THANKS 2010-10-22 19:46:50 UTC (rev 1675)
@@ -10,6 +10,7 @@
Karel Kolman <kolmis(at)gmail(dot)com> - Bazaar support.
David Kalnischkies <kalnischkies(at)gmail(dot)com> - Mercurial support
Thomas Martitz <thomas(dot)martitz(at)student(dot)HTW-Berlin(dot)de> - Lot of improvments and patches e.g. on commit dialog
+Jean-Paul Iribarren <jeanpaul(dot)iribarren(at)free(dot)fr> - patch for cvs's commit
Projects
--------
Modified: trunk/geany-plugins/geanyvc/src/vc_cvs.c
===================================================================
--- trunk/geany-plugins/geanyvc/src/vc_cvs.c 2010-10-17 19:25:27 UTC (rev 1674)
+++ trunk/geany-plugins/geanyvc/src/vc_cvs.c 2010-10-22 19:46:50 UTC (rev 1675)
@@ -32,7 +32,7 @@
static const gchar *CVS_CMD_REMOVE[] = { "cvs", "remove", BASE_FILENAME, NULL };
static const gchar *CVS_CMD_LOG_FILE[] = { "cvs", "log", BASE_FILENAME, NULL };
static const gchar *CVS_CMD_LOG_DIR[] = { "cvs", "log", NULL };
-static const gchar *CVS_CMD_COMMIT[] = { "cvs", NULL };
+static const gchar *CVS_CMD_COMMIT[] = { "cvs", "commit", "-m", MESSAGE, FILE_LIST, NULL };
static const gchar *CVS_CMD_BLAME[] = { "cvs", "annotate", BASE_FILENAME, NULL };
static const gchar *CVS_CMD_SHOW[] = { "cvs", NULL };
static const gchar *CVS_CMD_UPDATE[] = { "cvs", "up", "-d", NULL };
@@ -142,10 +142,106 @@
return find_dir(filename, "CVS", FALSE);
}
+static GSList *
+get_commit_files_cvs(const gchar * dir)
+{
+ enum
+ {
+ FIRST_CHAR,
+ SKIP_SPACE,
+ FILE_NAME,
+ };
+
+ gchar *txt;
+ GSList *ret = NULL;
+ gint pstatus = FIRST_CHAR;
+ const gchar *p;
+ gchar *base_name;
+ const gchar *start = NULL;
+ CommitItem *item;
+
+ const gchar *status;
+ gchar *filename;
+ const char *argv[] = { "cvs", "-nq", "update", NULL };
+
+ execute_custom_command(dir, argv, NULL, &txt, NULL, dir, NULL, NULL);
+ if (!NZV(txt))
+ return NULL;
+ p = txt;
+
+ while (*p)
+ {
+ if (*p == '\r')
+ {
+ }
+ else if (pstatus == FIRST_CHAR)
+ {
+ status = NULL;
+ if (*p == '?')
+ status = FILE_STATUS_UNKNOWN;
+ else if (*p == 'M')
+ status = FILE_STATUS_MODIFIED;
+ else if (*p == 'D')
+ status = FILE_STATUS_DELETED;
+ else if (*p == 'A')
+ status = FILE_STATUS_ADDED;
+
+ if (!status || *(p + 1) != ' ')
+ {
+ // skip unknown status line
+ while (*p)
+ {
+ p++;
+ if (*p == '\n')
+ {
+ p++;
+ break;
+ }
+ }
+ pstatus = FIRST_CHAR;
+ continue;
+ }
+ pstatus = SKIP_SPACE;
+ }
+ else if (pstatus == SKIP_SPACE)
+ {
+ if (*p == ' ' || *p == '\t')
+ {
+ }
+ else
+ {
+ start = p;
+ pstatus = FILE_NAME;
+ }
+ }
+ else if (pstatus == FILE_NAME)
+ {
+ if (*p == '\n')
+ {
+ if (status != FILE_STATUS_UNKNOWN)
+ {
+ base_name = g_malloc0(p - start + 1);
+ memcpy(base_name, start, p - start);
+ filename = g_build_filename(dir, base_name, NULL);
+ g_free(base_name);
+ item = g_new(CommitItem, 1);
+ item->status = status;
+ item->path = filename;
+ ret = g_slist_append(ret, item);
+ }
+ pstatus = FIRST_CHAR;
+ }
+ }
+ p++;
+ }
+ g_free(txt);
+ return ret;
+}
+
VC_RECORD VC_CVS = {
.commands = commands,
.program = "cvs",
.get_base_dir = get_base_dir,
.in_vc = in_vc_cvs,
- .get_commit_files = get_commit_files_null,
+ .get_commit_files = get_commit_files_cvs,
};
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Plugins-Commits
mailing list