[Libreoffice-commits] .: 2 commits - logerrit solenv/bin
Bjoern Michaelsen
bmichaelsen at kemper.freedesktop.org
Tue Jul 31 09:50:39 PDT 2012
logerrit | 59 ++++++++++++++++---------
solenv/bin/concat-deps.c | 107 +++++++++++++++++++++++++++++++++++++----------
2 files changed, 122 insertions(+), 44 deletions(-)
New commits:
commit 4e15809a78ea3c6062e20e439cf8df3d06cd8569
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Jul 25 01:13:53 2012 +0200
add ./logerrit resubmit
resubmit creates a new Change-Id for the current change and thus allow to submit
changes for review on release branches that were already reviewed on master.
Also hint advanced users to 'git review' which requires some more setup, but
should make things easier for regular users.
Getting this functionality into 'git review' would be likely help adoption too
-- and in python there is some sane errorchecking possible.
Change-Id: Ibea6bbfe747af160728b838c6ee236fd8f89671d
diff --git a/logerrit b/logerrit
index 05346d9..6585db1 100755
--- a/logerrit
+++ b/logerrit
@@ -31,20 +31,43 @@ ask_tristate() {
}
+submit() {
+ BRANCH=$1
+ if test -z "$BRANCH"
+ then
+ BRANCH=`git symbolic-ref HEAD 2> /dev/null`
+ BRANCH="${BRANCH##refs/heads/}"
+ if test -z "$BRANCH"
+ then
+ echo "no branch specified, and could not guess the current branch"
+ exit 1
+ fi
+ echo "no branch specified, guessing current branch $BRANCH"
+ fi
+ git push $GERRITURL HEAD:refs/for/$BRANCH
+}
+
case "$1" in
help)
echo "Usage: ./logerrit subcommand [options]"
+ echo "simple and basic tool to interact with LibreOffice gerrit"
echo "subcommands:"
- echo " test test your gerrit setup"
- echo " submit [BRANCH] submit your change for review to a branch"
- echo " nextchange [BRANCH] reset branch to the remote to start with the next change"
- echo " checkout CHANGEID checkout the changes for review"
- echo " pull CHANGEID pull (and merge) the changes on current branch"
- echo " cherry-pick CHANGEID cherry-pick the change on current branch"
- echo " patch CHANGEID show the change as a patch"
- echo " review [CHANGEID] interactively review a change (current one if no changeid given)"
- echo " query .... query for changes for review on project core"
+ echo " test test your gerrit setup"
+ echo " --- for submitters:"
+ echo " submit [BRANCH] submit your change for review"
+ echo " resubmit [BRANCH] create a new Change-Id and submit your change for review"
+ echo " (yes, this modifies your last commit)"
+ echo " nextchange [BRANCH] reset branch to the remote to start with the next change"
+ echo " --- for reviewers:"
+ echo " checkout CHANGEID checkout the changes for review"
+ echo " pull CHANGEID pull (and merge) the changes on current branch"
+ echo " cherry-pick CHANGEID cherry-pick the change on current branch"
+ echo " patch CHANGEID show the change as a patch"
+ echo " review [CHANGEID] interactively review a change (current one if no changeid given)"
+ echo " query .... query for changes for review on project core"
echo " <any other gerrit command>"
+ echo "advanced users should consider using git review instead:"
+ echo "http://wiki.documentfoundation.org/Development/GitReview"
exit
;;
test)
@@ -58,20 +81,12 @@ case "$1" in
fi
;;
submit)
- BRANCH=$2
- if test -z "$BRANCH"
- then
- BRANCH=`git symbolic-ref HEAD 2> /dev/null`
- BRANCH="${BRANCH##refs/heads/}"
- if test -z "$BRANCH"
- then
- echo "no branch specified, and could not guess the current branch"
- exit 1
- fi
- echo "no branch specified, guessing current branch $BRANCH"
- fi
- git push $GERRITURL HEAD:refs/for/$BRANCH
+ submit $2
;;
+ resubmit)
+ git log -1 --pretty=%B | grep -v ^Change-Id: | git commit --amend -F -
+ submit $2
+ ;;
nextchange)
if test -n "`git status -s -uno`"
then
commit c2b467b84a81bd45ca9df1f7f07e2700fd6e396a
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Mon Jul 30 17:39:40 2012 +0200
fix concat-deps
* make concat-deps use absolute paths whereever possible
* collapse /../ _after_ making the path absolute otherwise it will break for
relative paths starting with ../
* substitude SRCDIR variable, so trees can be moved
* this fixes subsequentcheck as it does run gbuild from a different work
directory in a few non-tail_build modules, which are then complaining about
missing/unresolvable deps
* this should fix troubles from module rebuild as relative paths were different
between tail_build and the module dir
Change-Id: I5a25e1f55bdc2b475df2af04b711fd808d95cdaf
diff --git a/solenv/bin/concat-deps.c b/solenv/bin/concat-deps.c
index 28ac2ed..d2c1d7f 100644
--- a/solenv/bin/concat-deps.c
+++ b/solenv/bin/concat-deps.c
@@ -109,6 +109,12 @@
#define FALSE 0
#endif
+static char* base_dir_var = "$(SRCDIR)";
+#define kBASE_DIR_VAR_LENGTH 9
+static char* current_dir;
+static size_t current_dir_length;
+static char* base_dir;
+static size_t base_dir_length;
#ifdef __GNUC__
#define clz __builtin_clz
@@ -684,21 +690,65 @@ int fd;
return buffer;
}
-static void _cancel_relative(char* base, char** ref_cursor, char** ref_cursor_out, char* end)
+static inline void print_nodotdot(char* path)
{
- char* cursor = *ref_cursor;
- char* cursor_out = *ref_cursor_out;
+char* pathpart;
+char* lastnondotdot;
+ pathpart = path;
+ lastnondotdot = NULL;
+ while(pathpart != NULL)
+ {
+ if(strncmp(pathpart, "/../", 4) == 0)
+ {
+ if(!lastnondotdot)
+ break; /* this should never happen with abs. paths */
+ memmove(lastnondotdot, pathpart+4, strlen(pathpart)-3);
+ lastnondotdot = NULL;
+ pathpart = path;
+ }
+ else
+ {
+ lastnondotdot = pathpart+1;
+ pathpart = strchr(pathpart+1,'/');
+ }
+ }
+ fputs(path, stdout);
+}
- do
+static char* print_fullpaths_buffer = NULL;
+static size_t print_fullpaths_buffersize = 0;
+/* prefix paths to absolute */
+static inline void print_fullpaths(char* line)
+{
+char* token;
+size_t token_length;;
+
+ token = strtok(line," ");
+ while(token != NULL)
{
- cursor += 3;
- while(cursor_out > base && cursor_out[-1] == '/')
- cursor_out--;
- while(cursor_out > base && *--cursor_out != '/');
+ if(*token == ':' || *token == '\\' || *token == '/' || *token == '$')
+ {
+ fputs(token, stdout);
+ }
+ else
+ {
+ token_length=strlen(token);
+ if(print_fullpaths_buffersize < current_dir_length+token_length+2)
+ {
+ /* we really should avoid to get there more than once, so print a message to alert of the condition */
+ if(print_fullpaths_buffersize)
+ fprintf(stderr, "resize fullpaths buffer %d -> %d\n", ((int)print_fullpaths_buffersize), ((int)(current_dir_length+token_length))+1024);
+ print_fullpaths_buffersize = current_dir_length+token_length+1024;
+ print_fullpaths_buffer = realloc(print_fullpaths_buffer, print_fullpaths_buffersize);
+ }
+ memcpy(print_fullpaths_buffer, current_dir, current_dir_length);
+ *(print_fullpaths_buffer+current_dir_length) = '/';
+ memcpy(print_fullpaths_buffer+current_dir_length+1, token, token_length+1);
+ print_nodotdot(print_fullpaths_buffer);
+ }
+ fputc(' ', stdout);
+ token = strtok(NULL," ");
}
- while(cursor + 3 < end && !memcmp(cursor, "/../", 4));
- *ref_cursor = cursor;
- *ref_cursor_out = cursor_out;
}
static int _process(struct hash* dep_hash, char* fn)
@@ -732,13 +782,6 @@ off_t size;
}
else if(*cursor == '/')
{
- if(cursor + 3 < end)
- {
- if(!memcmp(cursor, "/../", 4))
- {
- _cancel_relative(base, &cursor, &cursor_out, end);
- }
- }
*cursor_out++ = *cursor++;
}
else if(*cursor == '\n')
@@ -757,14 +800,14 @@ off_t size;
*/
if(hash_store(dep_hash, base, (int)(cursor_out - base)))
{
- puts(base);
+ print_fullpaths(base);
putc('\n', stdout);
}
}
else
{
/* rule with dep, just write it */
- puts(base);
+ print_fullpaths(base);
putc('\n', stdout);
}
}
@@ -825,8 +868,8 @@ off_t in_list_size = 0;
char* in_list;
char* in_list_cursor;
char* in_list_base;
+char* buffer;
struct hash* dep_hash;
-char* base_dir;
if(argc < 2)
{
@@ -836,9 +879,29 @@ char* base_dir;
base_dir = getenv("SRCDIR");
if(!base_dir)
{
- fputs("Error: SRCDIR si missing in the environement\n", stderr);
+ fputs("Error: SRCDIR is missing in the environement\n", stderr);
return 1;
}
+ current_dir = getcwd(NULL, 0);
+ base_dir_length = strlen(base_dir);
+ current_dir_length = strlen(current_dir);
+ if(strncmp(base_dir, current_dir, base_dir_length) == 0)
+ {
+ if(current_dir_length == base_dir_length)
+ {
+ current_dir = base_dir_var;
+ }
+ else
+ {
+ buffer = malloc(kBASE_DIR_VAR_LENGTH+current_dir_length-base_dir_length+1);
+ memcpy(buffer, base_dir_var, kBASE_DIR_VAR_LENGTH);
+ memcpy(buffer+kBASE_DIR_VAR_LENGTH, current_dir+base_dir_length, current_dir_length-base_dir_length+1);
+ free(current_dir);
+ current_dir=buffer;
+ current_dir_length=kBASE_DIR_VAR_LENGTH+current_dir_length-base_dir_length;
+ }
+ }
+
in_list = file_load(argv[1], &in_list_size, &rc);
if(!rc)
{
More information about the Libreoffice-commits
mailing list