* Re: [StGit PATCH 2/4] Add automatic git-mergetool invocation to the new infrastructure
From: Karl Hasselström @ 2009-03-17 15:30 UTC (permalink / raw)
To: Catalin Marinas; +Cc: git
In-Reply-To: <20090317110858.27748.21534.stgit@pc1117.cambridge.arm.com>
On 2009-03-17 11:08:58 +0000, Catalin Marinas wrote:
> This patch adds the IndexAndWorktree.mergetool() function
> responsible for calling 'git mergetool' to interactively solve
> conflicts. The function may also be called from
> IndexAndWorktree.merge() if the standard 'git merge-recursive' fails
> and 'interactive == True'. The 'allow_interactive' parameter is
> passed to Transaction.push_patch() from the functions allowing
> interactive merging.
Acked-by: Karl Hasselström <kha@treskal.com>
--
Karl Hasselström, kha@treskal.com
www.treskal.com/kalle
^ permalink raw reply
* Re: [StGit PATCH 1/4] Add mergetool support to the classic StGit infrastructure
From: Karl Hasselström @ 2009-03-17 15:29 UTC (permalink / raw)
To: Catalin Marinas; +Cc: git
In-Reply-To: <20090317110853.27748.70157.stgit@pc1117.cambridge.arm.com>
On 2009-03-17 11:08:53 +0000, Catalin Marinas wrote:
> Since Git already has a tool for interactively solving conflicts
> which is highly customisable, there is no need to duplicate this
> feature via the i3merge and i2merge configuration options. The
> user-visible change is that now mergetool is invoked rather than the
> previously customised interactive merging tool.
>
> The stgit.keeporig option is no longer available to be more
> consistent with the Git behaviour.
Acked-by: Karl Hasselström <kha@treskal.com>
--
Karl Hasselström, kha@treskal.com
www.treskal.com/kalle
^ permalink raw reply
* Generate version file by hooks
From: Björn Hendriks @ 2009-03-17 15:26 UTC (permalink / raw)
To: git
Hello,
I'd like to put the SHA1 of the current commit into a source file so that my
program can further process it -- put it into a log file for example.
My idea is to write a script which reads the SHA1 of the current commit with
the call
git log -1 --pretty=format:"%H"
(git-describe is not suitable for me) and then generates the wanted source
file. To avoid accidentally committing that file I will put its name
into .git/info/exclude.
I already put the call to my experimental generator script into the hooks
post-checkout and post-commit, so it will be called if I do a commit or a
checkout of another branch.
My problem is, that my script won't be called if I do a git-pull, a git-reset
or a git-merge without conflicts resulting in workfiles of a new commit.
Maybe there are more git calls which change the current commit I haven't
thought of yet?
So my question: How to make git call my script automatically in all cases
where git changes the currently checked out commit?
Maybe there are different solutions to put the current SHA1 into a source
file?
Of course I know that it's still possible to change the working files without
git's notice resulting in an inconsistent commit SHA1. But before doing any
test runs I normally check with git-status that all files are in a committed
state but that won't reveal if my generated version file is not up to date.
I use git version 1.5.4.3 and would like to stick to it for some reason if
possible.
Thanks for your help
Björn
^ permalink raw reply
* Mirroring repository state, with branches and submodules.
From: Toby White @ 2009-03-17 15:21 UTC (permalink / raw)
To: git
I have a short script which does the following for a remote git
rpository:
Clones it (checking out a working tree)
Makes tracking local branches for all remote branches
Init/updates all submodules.
This gives me an up-to-date mirror of a remote repository. I treat
this as essentially read-only.
What I now want to do is have some command which will update this
local mirror to reflect exactly the state of the remote mirror;
even when the remote mirror may have rebased history.
So far, I'm doing the following:
git fetch
for BRANCH in $(git branch -r | cut -d / -f 2); do
git checkout $BRANCH
git reset --hard origin/$BRANCH
done
git submodule update --init
but I'm not sure if that's actually the right way to do it, or if I'm
missing any corner cases. Am I safe to use it?
Thanks,
Toby
^ permalink raw reply
* Re: git-p4 workflow suggestions?
From: Pete Wyckoff @ 2009-03-17 15:18 UTC (permalink / raw)
To: Sam Hocevar; +Cc: git
In-Reply-To: <20090316180108.GE27280@zoy.org>
sam@zoy.org wrote on Mon, 16 Mar 2009 19:01 +0100:
> Yes, like this. More precisely:
>
> //work/framework/example/... //client/...
> //work/project1/src/... //client/src/...
> //work/project1/include/... //client/include/...
[..]
> My changes are extremely messy but I will refactor them as time goes.
> There is at least one other important thing my git-p4 does, which is not
> storing the whole commit in memory. Combined with the patches I sent
> last week to this list, it's the only way I can import the p4 repository
> we have at work. (See http://zoy.org/~sam/git/clumsily-hacked-git-p4)
Oh, that is, ahem, a bit site-specific. The looping over chunks in
the import phase is important, and other people have been thinking
about that. I'll ignore that aspect for now, though, and we'll see
if we can get the client-spec part worked out.
Can you take a look at the attached. Its goal is purely to allow
you to clone a complex spec like yours above. You may have to merge
this in with your perrformance changes.
Edit your ~/.gitconfig to add a section:
[git-p4]
useClientSpec = true
Then copy a good P4ENV from a p4 client that has a client spec
checked out as you like. git-p4 clone will do "p4 client -o",
reading that spec, and use the results to import, hopefully as
you have things laid out in the spec.
If this seems to work for you, we can figure out how to clean up
the patch so it can be used generally by people with and without
client specs.
-- Pete
---------
From 4a922efcef18e3bb740f88c31ed4d00fa66f4cce Mon Sep 17 00:00:00 2001
From: Pete Wyckoff <petew@netapp.com>
Date: Wed, 26 Nov 2008 12:28:09 -0500
Subject: [PATCH] honor git client spec
Destination directories for parts of the depot are specified in the
client spec. Use them as given. Also read the entire client spec to
figure out what to do.
---
contrib/fast-import/git-p4 | 110 ++++++++++++++++++++++++++++++++++---------
1 files changed, 87 insertions(+), 23 deletions(-)
diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4
index 332c7f8..d953a1e 100755
--- a/contrib/fast-import/git-p4
+++ b/contrib/fast-import/git-p4
@@ -451,6 +451,26 @@ def p4ChangesForPaths(depotPaths, changeRange):
changelist.sort()
return changelist
+#
+# Sort by number of slashes first: more specific at the top. Then
+# sort by alpha within a given number of path components.
+#
+def clientSortFunc(a, b):
+ asrc = a[0]
+ bsrc = b[0]
+ asrclen = asrc.count("/")
+ bsrclen = bsrc.count("/")
+ if asrclen > bsrclen:
+ return -1
+ elif asrclen < bsrclen:
+ return 1
+ elif asrc > bsrc:
+ return 1
+ elif asrc < bsrc:
+ return -1
+ else:
+ return 0
+
class Command:
def __init__(self):
self.usage = "usage: %prog [options]"
@@ -959,8 +979,9 @@ class P4Sync(Command):
includeFile = True
for val in self.clientSpecDirs:
if f['path'].startswith(val[0]):
- if val[1] <= 0:
+ if val[1] == '-':
includeFile = False
+ f['pathmap'] = val
break
if includeFile:
@@ -1056,7 +1077,12 @@ class P4Sync(Command):
print "\nfile %s is a strange apple file that forks. Ignoring!" % file['path']
continue
- relPath = self.stripRepoPath(file['path'], branchPrefixes)
+ if 'pathmap' in file:
+ relPath = file['pathmap'][1] + file['path'][len(file['pathmap'][0]):]
+ else:
+ relPath = self.stripRepoPath(file['path'], branchPrefixes)
+
+ print "path", file['path'], "->", relPath
if file["action"] in ("delete", "purge"):
self.gitStream.write("D %s\n" % relPath)
else:
@@ -1439,24 +1465,54 @@ class P4Sync(Command):
def getClientSpec(self):
- specList = p4CmdList( "client -o" )
+ specList = p4CmdList("client -o")
temp = {}
+ client = ""
+ for entry in specList:
+ for k,v in entry.iteritems():
+ if k.startswith("Client"):
+ client = v
+ print "client is", client
+ if not client:
+ sys.stderr.write("no client found\n")
+ sys.exit(1)
+ client = "//" + client + "/"
for entry in specList:
for k,v in entry.iteritems():
if k.startswith("View"):
- if v.startswith('"'):
- start = 1
- else:
- start = 0
- index = v.find("...")
- v = v[start:index]
- if v.startswith("-"):
- v = v[1:]
- temp[v] = -len(v)
- else:
- temp[v] = len(v)
- self.clientSpecDirs = temp.items()
- self.clientSpecDirs.sort( lambda x, y: abs( y[1] ) - abs( x[1] ) )
+ if v.startswith('"'):
+ v = v[1:]
+ if v.endswith('"'):
+ v = v[:-1]
+ d = v.split(" ");
+ if len(d) != 2:
+ sys.stderr.write( \
+ "expecting two fields in view, got: %s\n" % v)
+ sys.exit(1)
+ if not d[0].endswith("..."):
+ sys.stderr.write(\
+ "expecting trailing ..., got: %s\n" % d[0])
+ sys.exit(1)
+ d[0] = d[0][:-3]
+ if not d[1].endswith("..."):
+ sys.stderr.write(\
+ "expecting trailing ..., got: %s\n" % d[1])
+ sys.exit(1)
+ d[1] = d[1][:-3]
+ if not d[1].startswith(client):
+ sys.stderr.write(\
+ "expecting dest to start with %s, got: %s\n" % \
+ (client, d[1]))
+ sys.exit(1)
+ d[1] = d[1][len(client):]
+ # negated items do not appear in tree
+ if d[0].startswith("-"):
+ d[0] = d[0][1:]
+ d[1] = ""
+ temp[d[0]] = d[1]
+
+ self.clientSpecDirs = temp.items()
+ self.clientSpecDirs.sort(clientSortFunc)
def run(self, args):
self.depotPaths = []
@@ -1718,7 +1774,7 @@ class P4Clone(P4Sync):
def __init__(self):
P4Sync.__init__(self)
self.description = "Creates a new git repository and imports from Perforce into it"
- self.usage = "usage: %prog [options] //depot/path[@revRange]"
+ self.usage = "usage: %prog [options] [//depot/path[@revRange]]"
self.options += [
optparse.make_option("--destination", dest="cloneDestination",
action='store', default=None,
@@ -1746,18 +1802,26 @@ class P4Clone(P4Sync):
return os.path.split(depotDir)[1]
def run(self, args):
- if len(args) < 1:
- return False
-
if self.keepRepoPath and not self.cloneDestination:
sys.stderr.write("Must specify destination for --keep-path\n")
sys.exit(1)
depotPaths = args
- if not self.cloneDestination and len(depotPaths) > 1:
- self.cloneDestination = depotPaths[-1]
- depotPaths = depotPaths[:-1]
+ if gitConfig("git-p4.useclientspec") == "true":
+ if not os.path.exists("P4ENV"):
+ sys.stderr.write("Must copy P4ENV file from a valid client\n")
+ sys.exit(1)
+ self.getClientSpec()
+ if not depotPaths:
+ depotPaths = [p[0] for p in self.clientSpecDirs]
+ else:
+ if not depotPaths:
+ sys.stderr.write("Must specify depot path if no client spec\n")
+ sys.exit(1)
+
+ if not self.cloneDestination:
+ self.cloneDestination = "."
self.cloneExclude = ["/"+p for p in self.cloneExclude]
for p in depotPaths:
--
1.6.0.6
^ permalink raw reply related
* RE: undoing something
From: John Dlugosz @ 2009-03-17 15:08 UTC (permalink / raw)
To: Junio C Hamano, Nanako Shiraishi; +Cc: git, Paolo Bonzini, Jay Soffian
In-Reply-To: <7vtz5ssk0s.fsf@gitster.siamese.dyndns.org>
> The documentation is indeed wrong. It is more like "create a new
> branch,
> or if the named branch already exists, reset the tip of it".
Awesome. Then git branch -f name newpos is exactly what I need.
I wondered why something that should be so simple, and is available from
every GUI, is not easy from the command line.
--John
TradeStation Group, Inc. is a publicly-traded holding company (NASDAQ GS: TRAD) of three operating subsidiaries, TradeStation Securities, Inc. (Member NYSE, FINRA, SIPC and NFA), TradeStation Technologies, Inc., a trading software and subscription company, and TradeStation Europe Limited, a United Kingdom, FSA-authorized introducing brokerage firm. None of these companies provides trading or investment advice, recommendations or endorsements of any kind. The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited.
If you received this in error, please contact the sender and delete the material from any computer.
^ permalink raw reply
* RE: fetch and pull
From: John Dlugosz @ 2009-03-17 14:58 UTC (permalink / raw)
To: Jay Soffian; +Cc: git, Junio C Hamano
In-Reply-To: <76718490903161709v6d8d09f6k17d2fe1a5e56fb03@mail.gmail.com>
> $ git clone git://central/repo.git
> $ cd repo
> $ git checkout -b topic origin/master
> $ edit, commit, edit, commit, looks good
> $ git checkout master
> $ git pull
You checkout master before updating it?
> $ git merge topic
> $ compile, test, etc
> $ git push origin master (2)
> $ git branch -d topic
> So this way git://central/repo.git/refs/heads/master is never reset.
> But, if you do have a valid reason for resetting, then what I said in
> my previous message still applies.
The developers may not non-ff the dev when they push it. But the repository maintainer may reset dev for some reason, and since topic branches are pushed, he can see that it either doesn't bother anyone that way or knows who to help out. But, it means that in general the pull _could_ be arbitrary and not a ff from his last pull.
For example, developer A checks in a finished topic, then B checks in a finished topic. But A doesn't use a spell checker even though he *really* should, and doesn't proof read even though he **really** should let a native English speaker look at it first. So the repository maintainer rewrites the tip of the dev branch. Next morning, everyone pulls, and both A and B are non-ff even though they have not branched anything from the old A or B.
> Rarely, I'll base a topic on origin/pu. And origin/pu might get reset.
> But even if it were, I wouldn't want to blindly reset my local branch
> to match, thus losing my local changes. Instead I'd do this:
The local changes are all on a topic. Daily routine is to fetch and probably rebase topics each morning. Nobody checks out dev except to post a completed topic.
--John
TradeStation Group, Inc. is a publicly-traded holding company (NASDAQ GS: TRAD) of three operating subsidiaries, TradeStation Securities, Inc. (Member NYSE, FINRA, SIPC and NFA), TradeStation Technologies, Inc., a trading software and subscription company, and TradeStation Europe Limited, a United Kingdom, FSA-authorized introducing brokerage firm. None of these companies provides trading or investment advice, recommendations or endorsements of any kind. The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.
^ permalink raw reply
* [PATCH] builtin-tag.c: remove global variable to use the callback data of git-config.
From: Carlos Rica @ 2009-03-17 14:43 UTC (permalink / raw)
To: gitster, git, johannes.schindelin
By using strbuf to save the signing-key id, it also imposes no limit
to the length of the string obtained from the config or command-line.
This string is then passed to gpg to sign the tag, when appropriate.
Signed-off-by: Carlos Rica <jasampler@gmail.com>
---
QUESTION: Is it safe to remove this limit?
builtin-tag.c | 39 ++++++++++++++++-----------------------
1 files changed, 16 insertions(+), 23 deletions(-)
diff --git a/builtin-tag.c b/builtin-tag.c
index 01e7374..ed8b24f 100644
--- a/builtin-tag.c
+++ b/builtin-tag.c
@@ -21,8 +21,6 @@ static const char * const git_tag_usage[] = {
NULL
};
-static char signingkey[1000];
-
struct tag_filter {
const char *pattern;
int lines;
@@ -156,7 +154,7 @@ static int verify_tag(const char *name, const char *ref,
return 0;
}
-static int do_sign(struct strbuf *buffer)
+static int do_sign(struct strbuf *signingkey, struct strbuf *buffer)
{
struct child_process gpg;
const char *args[4];
@@ -164,11 +162,10 @@ static int do_sign(struct strbuf *buffer)
int len;
int i, j;
- if (!*signingkey) {
- if (strlcpy(signingkey, git_committer_info(IDENT_ERROR_ON_NO_NAME),
- sizeof(signingkey)) > sizeof(signingkey) - 1)
- return error("committer info too long.");
- bracket = strchr(signingkey, '>');
+ if (!signingkey->buf[0]) {
+ strbuf_addstr(signingkey,
+ git_committer_info(IDENT_ERROR_ON_NO_NAME));
+ bracket = strchr(signingkey->buf, '>');
if (bracket)
bracket[1] = '\0';
}
@@ -183,7 +180,7 @@ static int do_sign(struct strbuf *buffer)
gpg.out = -1;
args[0] = "gpg";
args[1] = "-bsau";
- args[2] = signingkey;
+ args[2] = signingkey->buf;
args[3] = NULL;
if (start_command(&gpg))
@@ -220,18 +217,12 @@ static const char tag_template[] =
"# Write a tag message\n"
"#\n";
-static void set_signingkey(const char *value)
-{
- if (strlcpy(signingkey, value, sizeof(signingkey)) >= sizeof(signingkey))
- die("signing key value too long (%.10s...)", value);
-}
-
static int git_tag_config(const char *var, const char *value, void *cb)
{
if (!strcmp(var, "user.signingkey")) {
if (!value)
return config_error_nonbool(var);
- set_signingkey(value);
+ strbuf_addstr((struct strbuf *) cb, value);
return 0;
}
@@ -266,9 +257,10 @@ static void write_tag_body(int fd, const unsigned char *sha1)
free(buf);
}
-static int build_tag_object(struct strbuf *buf, int sign, unsigned char *result)
+static int build_tag_object(struct strbuf *buf, int sign,
+ struct strbuf *signingkey, unsigned char *result)
{
- if (sign && do_sign(buf) < 0)
+ if (sign && do_sign(signingkey, buf) < 0)
return error("unable to sign the tag");
if (write_sha1_file(buf->buf, buf->len, tag_type, result) < 0)
return error("unable to write tag file");
@@ -277,6 +269,7 @@ static int build_tag_object(struct strbuf *buf, int sign, unsigned char *result)
static void create_tag(const unsigned char *object, const char *tag,
struct strbuf *buf, int message, int sign,
+ struct strbuf *signingkey,
unsigned char *prev, unsigned char *result)
{
enum object_type type;
@@ -331,7 +324,7 @@ static void create_tag(const unsigned char *object, const char *tag,
strbuf_insert(buf, 0, header_buf, header_len);
- if (build_tag_object(buf, sign, result) < 0) {
+ if (build_tag_object(buf, sign, signingkey, result) < 0) {
if (path)
fprintf(stderr, "The tag message has been left in %s\n",
path);
@@ -363,7 +356,7 @@ static int parse_msg_arg(const struct option *opt, const char *arg, int unset)
int cmd_tag(int argc, const char **argv, const char *prefix)
{
- struct strbuf buf = STRBUF_INIT;
+ struct strbuf buf = STRBUF_INIT, signingkey = STRBUF_INIT;
unsigned char object[20], prev[20];
char ref[PATH_MAX];
const char *object_ref, *tag;
@@ -403,14 +396,14 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
OPT_END()
};
- git_config(git_tag_config, NULL);
+ git_config(git_tag_config, &signingkey);
argc = parse_options(argc, argv, options, git_tag_usage, 0);
msgfile = parse_options_fix_filename(prefix, msgfile);
if (keyid) {
sign = 1;
- set_signingkey(keyid);
+ strbuf_addstr(&signingkey, keyid);
}
if (sign)
annotate = 1;
@@ -474,7 +467,7 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
if (annotate)
create_tag(object, tag, &buf, msg.given || msgfile,
- sign, prev, object);
+ sign, &signingkey, prev, object);
lock = lock_any_ref_for_update(ref, prev, 0);
if (!lock)
--
1.6.0.5
^ permalink raw reply related
* Re: git-svn: creating tags from a subdirectory of trunk
From: Michael J Gruber @ 2009-03-17 14:43 UTC (permalink / raw)
To: Tom Huybrechts; +Cc: git, Eric Wong
In-Reply-To: <632a37a0903151418u483ca6cal1582518b9120da8e@mail.gmail.com>
Tom Huybrechts venit, vidit, dixit 15.03.2009 22:18:
> Hi,
>
> I'm trying to setup a git mirror of a svn repository. The tags in
> this repository are not created trunk it self, but from subdirectories
> of trunk. The tags and branches are in the standard places.
> e.g:
> /trunk/main -> tags/main-1
> /trunk/plugins/foo -> tags/foo-1
> /trunk/plugins/bar -> tags/bar-1
>
> I run 'git svn clone -s svn-url target'. It starts going over the
> history nicely until it reaches the first branch. It calls this branch
> something like tags/tag-name@revision, and starts retrieving the
> entire project history again from r1. This is repeated for every
> branch.
And I thought *I* had produced sick repos by abusing svn...
There are also such niceties as
/trunk/trunk/
in there.
The problem is that svn tags are branches (to the same extent that svn
branches are branches...) and git svn treats them as such, but the
hudson tags contain only subtrees. I think you have two options:
- Convert without tags, and try to assign real git tags later on based
on the output of svn log. (This assumes svn tags have not been abused as
branches.)
- Setup git svn configs for each subproject individually, since the tags
contain only subproject tags.
It seems as though hudson's tags have not been abused as branches,
except for some messing with deletes and recreations. So the first
approach may be worthwhile.
Michael
^ permalink raw reply
* Re: [JGIT] Pushing the HEAD ref?
From: Shawn O. Pearce @ 2009-03-17 14:28 UTC (permalink / raw)
To: Daniel Cheng; +Cc: git
In-Reply-To: <ff6a9c820903162104v2ca62437ua3da6bafba3ea101@mail.gmail.com>
Daniel Cheng <j16sdiz+freenet@gmail.com> wrote:
>
> When I develop the freenet transport, I found the refWriter in
> WalkPushConnection never write the HEAD refs, even if this is a new
> repository.
> Is this the expected behaviour? This cause error when I clone the repository.
Nope.
Check WalkPushConnection's createNewRepository(). The method is
called from line 162 where we try to create a new HEAD symbolic
ref to one of the refs/heads/$name being pushed, and we also put
a tiny config file. This way a repository pushed over sftp://
is a valid repository if you later get shell access to it.
Sounds like you didn't push a refs/heads/$name when you created
the repository, or you something is broken in this section.
--
Shawn.
^ permalink raw reply
* [PATCH] git-branch.txt: document -f correctly
From: Michael J Gruber @ 2009-03-17 14:06 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano
In-Reply-To: <7vtz5ssk0s.fsf@gitster.siamese.dyndns.org>
'git branch -f a b' resets a to b when a exists, rather then deleting a.
Say so in the documentation.
Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
---
Something like this?
BTW, I noticed that 'git-subcmd' is used everywhere in here which does
not feel right, but I followed the existing style, leaving a consistent
clean-up for a later patch. Also, typesetting is inconsistent:
We have <branch> as well as `<branch>` when the text talks about the
options. Do we have a style guide or such?
Documentation/git-branch.txt | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/Documentation/git-branch.txt b/Documentation/git-branch.txt
index 6103d62..27b73bc 100644
--- a/Documentation/git-branch.txt
+++ b/Documentation/git-branch.txt
@@ -76,8 +76,8 @@ OPTIONS
based sha1 expressions such as "<branchname>@\{yesterday}".
-f::
- Force the creation of a new branch even if it means deleting
- a branch that already exists with the same name.
+ Reset <branchname> to <startpoint> if <branchname> exists
+ already. Without `-f` 'git-branch' refuses to change an existing branch.
-m::
Move/rename a branch and the corresponding reflog.
--
1.6.2.149.g6462
^ permalink raw reply related
* .gitk should created hidden in windows
From: Steve Wagner @ 2009-03-17 13:45 UTC (permalink / raw)
To: Paul Mackerras; +Cc: git
Hi Paul, i write this to the git mailing list because of the advice from
Johannes Schindelin in the MSysGit Issue:
http://code.google.com/p/msysgit/issues/detail?id=143
The problem is that windows dose not hides files beginning with a dot as
it is in unix. So the .gitk file is created as visible in the windows
user profile. Problematic too is that i can no set the hidden attribute
to this file, because it is recreated every time i start gitk, so the
hidden attribute gets lost.
Can you control this and create the file with the hidden attribute on
windows?
Steve
^ permalink raw reply
* Re: [PATCH 0/2] git checkout: one bugfix and one cosmetic change
From: Michael J Gruber @ 2009-03-17 13:39 UTC (permalink / raw)
To: Jeff King; +Cc: Kris Shannon, Kjetil Barvik, Git Mailing List
In-Reply-To: <20090317084352.GL18475@coredump.intra.peff.net>
Jeff King venit, vidit, dixit 17.03.2009 09:43:
> On Tue, Mar 17, 2009 at 03:56:12PM +1100, Kris Shannon wrote:
>
>> I was rather surprised to see my name on that list. A quick git log
>> showed my one contribution to git-parse-remote way pack in
>> August 2005.
>>
>> I'd forgotten about that and was feeling all warm and fuzzy until I did:
>> git log -- git-parse-remote
>>
>> and saw that it was deleted a week later :(
>
> Heh. The current list just counts commits, which is nice and fast. But
> one could also "git blame" all of the content from master and credit
> people based either on:
>
> - number of surviving lines in the current codebase (which obviously
> would give very rankings for people, as the number of lines added
> in a commit is not constant)
>
> - number of commits which have surviving lines
>
> Doing such a calculation would be pretty slow, though, I imagine. And it
> would of course remove you from the list. :)
>
> -Peff
Maybe we can forge a statement by Canonical, claiming they were among
the top contributors to git? Then GKH would do all the statistics for us ;)
Michael
^ permalink raw reply
* Re: [StGit PATCH 1/5] Check for local changes with "goto"
From: Karl Hasselström @ 2009-03-17 13:36 UTC (permalink / raw)
To: Catalin Marinas; +Cc: git
In-Reply-To: <b0943d9e0903170351p319bad36icf8252610e5c4f05@mail.gmail.com>
On 2009-03-17 10:51:08 +0000, Catalin Marinas wrote:
> 2009/3/17 Karl Hasselström <kha@treskal.com>:
>
> > On 2009-03-16 14:56:11 +0000, Catalin Marinas wrote:
> >
> > > if not iw.worktree_clean():
> > > self.__halt('Worktree not clean. Use "refresh" or "status --reset"')
> > > if not iw.index.is_clean(self.stack.head):
> > > self.__halt('Index not clean. Use "refresh" or "status --reset"')
> [...]
> > Your version doesn't generate the "Your index and worktree are
> > both dirty" warning, but I guess that's OK.
>
> The iw.worktree_clean() only checks whether the worktree is clean
> relative to the index (I just tried "git update-index --refresh"
> after "git add <modified file>" and it returns 0).
Yes, I know. The point I was trying to make was that your code doesn't
make a difference between
(iw.worktree_clean(), iw.index.is_clean(self.stack.head)) == (False, True)
and
(iw.worktree_clean(), iw.index.is_clean(self.stack.head)) == (False, False)
But as I said, it's not really important.
--
Karl Hasselström, kha@treskal.com
www.treskal.com/kalle
^ permalink raw reply
* Re: [PATCH] Tests: use test_cmp instead of diff where possible
From: Miklos Vajna @ 2009-03-17 13:21 UTC (permalink / raw)
To: Carlos Rica; +Cc: Junio C Hamano, git
In-Reply-To: <1b46aba20903170602j79735631uf20e0a729e69c4b@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 420 bytes --]
On Tue, Mar 17, 2009 at 02:02:37PM +0100, Carlos Rica <jasampler@gmail.com> wrote:
> What about the current other calls to cmp? I don't know if they should
> be changed too. Are they just the subject of another future change or
> have a different purpose? I recently used test_cmp in a test full of
> cmp calls (t1300-repo-config.sh).
I think that would be the next step, my patch only converts diff calls
to test_cmp.
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply
* Re: [PATCH] Tests: use test_cmp instead of diff where possible
From: Carlos Rica @ 2009-03-17 13:02 UTC (permalink / raw)
To: Miklos Vajna; +Cc: Junio C Hamano, git
In-Reply-To: <1237124036-1348-1-git-send-email-vmiklos@frugalware.org>
On Sun, Mar 15, 2009 at 2:33 PM, Miklos Vajna <vmiklos@frugalware.org> wrote:
> Several old tests were written before test_cmp was introduced, convert
> these to test_cmp.
What about the current other calls to cmp? I don't know if they should
be changed too. Are they just the subject of another future change or
have a different purpose? I recently used test_cmp in a test full of
cmp calls (t1300-repo-config.sh).
^ permalink raw reply
* Preemptive EOF when pushing (using Msys git and PuTTY)
From: Gustaf Hendeby @ 2009-03-17 12:25 UTC (permalink / raw)
To: Git Mailing List
Hello everyone, and thanks for all your dedicated work with git.
I have used git for quite some time now, mainly on different Linux
platforms, without any problems. Recently we convert the office's pet
project from svn to git. Many people at the office use Windows (Msys
git 1.6.2 and plink), and I have stared to see (only from Windows
people) problems when pushing similar to the following:
Counting objects: 422, done.
Compressing objects: 422, done.
Writing objects: 100% (379/379), 77.77 KiB, done.
Total 379 (delta 310), reused 371 (delta 303)
fatal: early EOF
error: unpack failed: index-pack abnormal exit
To jkoehler@serv-4100:/git/argos.git
![remote rejected] jk/ellipseFit -> jk/ellipseFit (n/a (unpacker error))
error: failed to push some refs to
'jkoehler@serv-4100:/git/argos.git'
There seems to be no problem with the repo, neither local nor remote,
but for a specific setup the problem is reproducible on several Windows
machines, but if I move the whole local repo to a Linux machine instead
the problem is gone.
I suspect the problem is that a ^Z EOF gets embedded in the pack to be
transported, and that somehow interacts poorly with PuTTY, but that is
just my guessing. And if so I don't know how to handle it.
Has anyone experienced anything similar? If so, is there any simple fix
to the problem? How would I go about to try to debug this?
Unfortunately, this seems to happen on a regular basis and affects the
git experience in a negative way, so I would be really happy to be able
to resolve the problem.
I'm thankful for any help that I can get.
/Gustaf
^ permalink raw reply
* Re: [PATCH] config: test for --replace-all with one argument and fix documentation.
From: Carlos Rica @ 2009-03-17 11:12 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: felipe.contreras, gitster, git
In-Reply-To: <alpine.DEB.1.00.0903171123530.6393@intel-tinevez-2-302>
On Tue, Mar 17, 2009 at 11:24 AM, Johannes Schindelin
<Johannes.Schindelin@gmx.de> wrote:
> Hi,
>
> On Tue, 17 Mar 2009, Carlos Rica wrote:
>
>> Option --replace-all only allows at least two arguments, so
>> documentation was needing to be updated accordingly. A test showing
>> that the command fails with only one parameter is also provided.
>>
>> Signed-off-by: Carlos Rica <jasampler@gmail.com>
>
> Looks obviously correct to me. I am actually unsure if I can ACK this
> patch, as most of builtin-config.c does not look all that familiar to me
> anymore ;-)
Thank you Johannes, I think that you don't need to do it in this
patch, I talked before with Junio and Felipe for this, and I think
that Junio is also following the whole change (my change here is not
comparable with the work of Felipe).
I just added you because Felipe Contreras said that you made some
suggestions to make this use of parse options possible.
See you!
^ permalink raw reply
* [StGit PATCH 4/4] Use a default "hidden" argument in StackTransaction.reorder_patches
From: Catalin Marinas @ 2009-03-17 11:09 UTC (permalink / raw)
To: git, Karl Hasselström
In-Reply-To: <20090317110721.27748.10295.stgit@pc1117.cambridge.arm.com>
This argument is rarely used so adding a default value simplifies the
calling code.
Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
---
stgit/commands/float.py | 3 +--
stgit/commands/sink.py | 4 +---
stgit/lib/transaction.py | 4 +++-
3 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/stgit/commands/float.py b/stgit/commands/float.py
index 8410675..e561c39 100644
--- a/stgit/commands/float.py
+++ b/stgit/commands/float.py
@@ -71,7 +71,6 @@ def func(parser, options, args):
applied = [p for p in stack.patchorder.applied if p not in patches] + \
patches
unapplied = [p for p in stack.patchorder.unapplied if not p in patches]
- hidden = list(stack.patchorder.hidden)
iw = stack.repository.default_iw
clean_iw = (not options.keep and iw) or None
@@ -79,7 +78,7 @@ def func(parser, options, args):
check_clean_iw = clean_iw)
try:
- trans.reorder_patches(applied, unapplied, hidden, iw)
+ trans.reorder_patches(applied, unapplied, iw = iw)
except transaction.TransactionHalted:
pass
return trans.run(iw)
diff --git a/stgit/commands/sink.py b/stgit/commands/sink.py
index 641ab7b..63be461 100644
--- a/stgit/commands/sink.py
+++ b/stgit/commands/sink.py
@@ -81,9 +81,7 @@ def func(parser, options, args):
else:
insert_idx = 0
applied = applied[:insert_idx] + patches + applied[insert_idx:]
-
unapplied = [p for p in stack.patchorder.unapplied if p not in patches]
- hidden = list(stack.patchorder.hidden)
iw = stack.repository.default_iw
clean_iw = (not options.keep and iw) or None
@@ -91,7 +89,7 @@ def func(parser, options, args):
check_clean_iw = clean_iw)
try:
- trans.reorder_patches(applied, unapplied, hidden, iw)
+ trans.reorder_patches(applied, unapplied, iw = iw)
except transaction.TransactionHalted:
pass
return trans.run(iw)
diff --git a/stgit/lib/transaction.py b/stgit/lib/transaction.py
index 4b5398a..b146648 100644
--- a/stgit/lib/transaction.py
+++ b/stgit/lib/transaction.py
@@ -365,8 +365,10 @@ class StackTransaction(object):
# Update immediately.
update()
- def reorder_patches(self, applied, unapplied, hidden, iw = None):
+ def reorder_patches(self, applied, unapplied, hidden = None, iw = None):
"""Push and pop patches to attain the given ordering."""
+ if hidden is None:
+ hidden = self.hidden
common = len(list(it.takewhile(lambda (a, b): a == b,
zip(self.applied, applied))))
to_pop = set(self.applied[common:])
^ permalink raw reply related
* [StGit PATCH 3/4] Convert "float" to the lib infrastructure
From: Catalin Marinas @ 2009-03-17 11:09 UTC (permalink / raw)
To: git, Karl Hasselström
In-Reply-To: <20090317110721.27748.10295.stgit@pc1117.cambridge.arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
---
stgit/commands/float.py | 89 +++++++++++++++++++----------------------------
1 files changed, 36 insertions(+), 53 deletions(-)
diff --git a/stgit/commands/float.py b/stgit/commands/float.py
index 7c3dcdf..8410675 100644
--- a/stgit/commands/float.py
+++ b/stgit/commands/float.py
@@ -16,11 +16,11 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
"""
-import sys, os
+import sys
from stgit.argparse import opt
-from stgit.commands.common import *
-from stgit.utils import *
-from stgit import argparse, stack, git
+from stgit.commands import common
+from stgit.lib import transaction
+from stgit import argparse
help = 'Push patches to the top, even if applied'
kind = 'stack'
@@ -35,32 +35,27 @@ as specified by the given series file (or the standard input)."""
args = [argparse.patch_range(argparse.applied_patches,
argparse.unapplied_patches)]
options = [
- opt('-s', '--series', action = 'store_true',
- short = 'Rearrange according to a series file')]
+ opt('-s', '--series', metavar = 'FILE',
+ short = 'Rearrange according to the series FILE')
+ ] + argparse.keep_option()
-directory = DirectoryGotoToplevel(log = True)
+directory = common.DirectoryHasRepositoryLib()
def func(parser, options, args):
- """Pops and pushed to make the named patch the topmost patch
+ """Reorder patches to make the named patch the topmost one.
"""
- args_nr = len(args)
- if (options.series and args_nr > 1) \
- or (not options.series and args_nr == 0):
+ if options.series and args:
+ parser.error('<patches> cannot be used with --series')
+ elif not options.series and not args:
parser.error('incorrect number of arguments')
- check_local_changes()
- check_conflicts()
- check_head_top_equal(crt_series)
-
- unapplied = crt_series.get_unapplied()
- applied = crt_series.get_applied()
- all = unapplied + applied
+ stack = directory.repository.current_stack
if options.series:
- if args_nr:
- f = file(args[0])
- else:
+ if options.series == '-':
f = sys.stdin
+ else:
+ f = file(args[0])
patches = []
for line in f:
@@ -68,35 +63,23 @@ def func(parser, options, args):
if patch:
patches.append(patch)
else:
- patches = parse_patches(args, all)
-
- # working with "topush" patches in reverse order might be a bit
- # more efficient for large series but the main reason is for the
- # "topop != topush" comparison to work
- patches.reverse()
-
- topush = []
- topop = []
-
- for p in patches:
- while p in applied:
- top = applied.pop()
- if not top in patches:
- topush.append(top)
- topop.append(top)
- topush = patches + topush
-
- # remove common patches to avoid unnecessary pop/push
- while topush and topop:
- if topush[-1] != topop[-1]:
- break
- topush.pop()
- topop.pop()
-
- # check whether the operation is really needed
- if topop != topush:
- if topop:
- pop_patches(crt_series, topop)
- if topush:
- topush.reverse()
- push_patches(crt_series, topush)
+ patches = common.parse_patches(args, stack.patchorder.all)
+
+ if not patches:
+ raise common.CmdException('No patches to float')
+
+ applied = [p for p in stack.patchorder.applied if p not in patches] + \
+ patches
+ unapplied = [p for p in stack.patchorder.unapplied if not p in patches]
+ hidden = list(stack.patchorder.hidden)
+
+ iw = stack.repository.default_iw
+ clean_iw = (not options.keep and iw) or None
+ trans = transaction.StackTransaction(stack, 'sink',
+ check_clean_iw = clean_iw)
+
+ try:
+ trans.reorder_patches(applied, unapplied, hidden, iw)
+ except transaction.TransactionHalted:
+ pass
+ return trans.run(iw)
^ permalink raw reply related
* [StGit PATCH 2/4] Add automatic git-mergetool invocation to the new infrastructure
From: Catalin Marinas @ 2009-03-17 11:08 UTC (permalink / raw)
To: git, Karl Hasselström
In-Reply-To: <20090317110721.27748.10295.stgit@pc1117.cambridge.arm.com>
This patch adds the IndexAndWorktree.mergetool() function responsible
for calling 'git mergetool' to interactively solve conflicts. The
function may also be called from IndexAndWorktree.merge() if the
standard 'git merge-recursive' fails and 'interactive == True'. The
'allow_interactive' parameter is passed to Transaction.push_patch() from
the functions allowing interactive merging.
Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
---
stgit/commands/edit.py | 2 +-
stgit/commands/goto.py | 2 +-
stgit/lib/git.py | 19 ++++++++++++++++---
stgit/lib/transaction.py | 7 +++++--
4 files changed, 23 insertions(+), 7 deletions(-)
diff --git a/stgit/commands/edit.py b/stgit/commands/edit.py
index ed785aa..42eb792 100644
--- a/stgit/commands/edit.py
+++ b/stgit/commands/edit.py
@@ -128,7 +128,7 @@ def func(parser, options, args):
trans.patches[patchname] = stack.repository.commit(cd)
try:
for pn in popped:
- trans.push_patch(pn, iw)
+ trans.push_patch(pn, iw, allow_interactive = True)
except transaction.TransactionHalted:
pass
try:
diff --git a/stgit/commands/goto.py b/stgit/commands/goto.py
index 480266a..66f49df 100644
--- a/stgit/commands/goto.py
+++ b/stgit/commands/goto.py
@@ -48,7 +48,7 @@ def func(parser, options, args):
elif patch in trans.unapplied:
try:
for pn in trans.unapplied[:trans.unapplied.index(patch)+1]:
- trans.push_patch(pn, iw)
+ trans.push_patch(pn, iw, allow_interactive = True)
except transaction.TransactionHalted:
pass
elif patch in trans.hidden:
diff --git a/stgit/lib/git.py b/stgit/lib/git.py
index 07079b8..e0a3c96 100644
--- a/stgit/lib/git.py
+++ b/stgit/lib/git.py
@@ -824,7 +824,7 @@ class IndexAndWorktree(RunWithEnvCwd):
).discard_output()
except run.RunException:
raise CheckoutException('Index/workdir dirty')
- def merge(self, base, ours, theirs):
+ def merge(self, base, ours, theirs, interactive = False):
assert isinstance(base, Tree)
assert isinstance(ours, Tree)
assert isinstance(theirs, Tree)
@@ -838,10 +838,23 @@ class IndexAndWorktree(RunWithEnvCwd):
output = r.output_lines()
if r.exitcode:
# There were conflicts
- conflicts = [l for l in output if l.startswith('CONFLICT')]
- raise MergeConflictException(conflicts)
+ if interactive:
+ self.mergetool()
+ else:
+ conflicts = [l for l in output if l.startswith('CONFLICT')]
+ raise MergeConflictException(conflicts)
except run.RunException, e:
raise MergeException('Index/worktree dirty')
+ def mergetool(self, files = ()):
+ """Invoke 'git mergetool' on the current IndexAndWorktree to resolve
+ any outstanding conflicts. If 'not files', all the files in an
+ unmerged state will be processed."""
+ run.Run(['git', 'mergetool'] + list(files)).returns([0, 1]).run()
+ # check for unmerged entries (prepend 'CONFLICT ' for consistency with
+ # merge())
+ conflicts = ['CONFLICT ' + f for f in self.index.conflicts()]
+ if conflicts:
+ raise MergeConflictException(conflicts)
def changed_files(self, tree, pathlimits = []):
"""Return the set of files in the worktree that have changed with
respect to C{tree}. The listing is optionally restricted to
diff --git a/stgit/lib/transaction.py b/stgit/lib/transaction.py
index a88d289..4b5398a 100644
--- a/stgit/lib/transaction.py
+++ b/stgit/lib/transaction.py
@@ -8,6 +8,7 @@ from stgit import exception, utils
from stgit.utils import any, all
from stgit.out import *
from stgit.lib import git, log
+from stgit.config import config
class TransactionException(exception.StgException):
"""Exception raised when something goes wrong with a
@@ -296,7 +297,7 @@ class StackTransaction(object):
out.info('Deleted %s%s' % (pn, s))
return popped
- def push_patch(self, pn, iw = None):
+ def push_patch(self, pn, iw = None, allow_interactive = False):
"""Attempt to push the named patch. If this results in conflicts,
halts the transaction. If index+worktree are given, spill any
conflicts to them."""
@@ -319,7 +320,9 @@ class StackTransaction(object):
except git.CheckoutException:
self.__halt('Index/worktree dirty')
try:
- iw.merge(base, ours, theirs)
+ interactive = (allow_interactive and
+ config.get('stgit.autoimerge') == 'yes')
+ iw.merge(base, ours, theirs, interactive = interactive)
tree = iw.index.write_tree()
self.__current_tree = tree
s = ' (modified)'
^ permalink raw reply related
* [StGit PATCH 1/4] Add mergetool support to the classic StGit infrastructure
From: Catalin Marinas @ 2009-03-17 11:08 UTC (permalink / raw)
To: git, Karl Hasselström
In-Reply-To: <20090317110721.27748.10295.stgit@pc1117.cambridge.arm.com>
Since Git already has a tool for interactively solving conflicts which
is highly customisable, there is no need to duplicate this feature via
the i3merge and i2merge configuration options. The user-visible change
is that now mergetool is invoked rather than the previously customised
interactive merging tool.
The stgit.keeporig option is no longer available to be more consistent
with the Git behaviour.
Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
---
examples/gitconfig | 21 +-----
stgit/commands/resolved.py | 5 -
stgit/config.py | 1
stgit/git.py | 31 +++++----
stgit/gitmergeonefile.py | 150 --------------------------------------------
t/t0002-status.sh | 3 -
6 files changed, 20 insertions(+), 191 deletions(-)
delete mode 100644 stgit/gitmergeonefile.py
diff --git a/examples/gitconfig b/examples/gitconfig
index 2fc5f52..f6e3a79 100644
--- a/examples/gitconfig
+++ b/examples/gitconfig
@@ -64,27 +64,10 @@
# To support local parent branches:
#pull-policy = rebase
- # Interactive two/three-way merge tool. It is executed by the
- # 'resolved --interactive' command
- #i3merge = xxdiff --title1 current --title2 ancestor --title3 patched \
- # --show-merged-pane -m -E -O -X -M \"%(output)s\" \
- # \"%(branch1)s\" \"%(ancestor)s\" \"%(branch2)s\"
- #i2merge = xxdiff --title1 current --title2 patched \
- # --show-merged-pane -m -E -O -X -M \"%(output)s\" \
- # \"%(branch1)s\" \"%(branch2)s\"
- #i3merge = emacs --eval '(ediff-merge-files-with-ancestor \
- # \"%(branch1)s\" \"%(branch2)s\" \"%(ancestor)s\" nil \
- # \"%(output)s\")'
- #i2merge = emacs --eval '(ediff-merge-files \
- # \"%(branch1)s\" \"%(branch2)s\" nil \"%(output)s\")'
-
- # Automatically invoke the interactive merger in case of conflicts
+ # Automatically invoke the interactive merger (git mergetool) in case
+ # of conflicts
#autoimerge = no
- # Leave the original files in the working tree in case of a
- # merge conflict
- #keeporig = yes
-
# Optimize (repack) the object store after every pull
#keepoptimized = yes
diff --git a/stgit/commands/resolved.py b/stgit/commands/resolved.py
index 2ce7ec3..eba778d 100644
--- a/stgit/commands/resolved.py
+++ b/stgit/commands/resolved.py
@@ -22,7 +22,6 @@ from stgit.commands.common import *
from stgit.utils import *
from stgit import argparse, stack, git, basedir
from stgit.config import config, file_extensions
-from stgit.gitmergeonefile import interactive_merge
help = 'Mark a file conflict as solved'
kind = 'wc'
@@ -78,8 +77,6 @@ def func(parser, options, args):
# resolved
if options.interactive:
- for filename in files:
- interactive_merge(filename)
- git.resolved([filename])
+ git.mergetool(files)
else:
git.resolved(files, options.reset)
diff --git a/stgit/config.py b/stgit/config.py
index 05ef624..efce097 100644
--- a/stgit/config.py
+++ b/stgit/config.py
@@ -35,7 +35,6 @@ class GitConfig:
'stgit.fetchcmd': 'git fetch',
'stgit.pull-policy': 'pull',
'stgit.autoimerge': 'no',
- 'stgit.keeporig': 'yes',
'stgit.keepoptimized': 'no',
'stgit.extensions': '.ancestor .current .patched',
'stgit.shortnr': '5'
diff --git a/stgit/git.py b/stgit/git.py
index 4d01fc2..cbdefe8 100644
--- a/stgit/git.py
+++ b/stgit/git.py
@@ -18,7 +18,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
"""
-import sys, os, re, gitmergeonefile
+import sys, os, re
from shutil import copyfile
from stgit.exception import *
@@ -632,19 +632,23 @@ def merge_recursive(base, head1, head2):
output = p.output_lines()
if p.exitcode:
# There were conflicts
- conflicts = [l.strip() for l in output if l.startswith('CONFLICT')]
+ if config.get('stgit.autoimerge') == 'yes':
+ mergetool()
+ else:
+ conflicts = [l for l in output if l.startswith('CONFLICT')]
+ out.info(*conflicts)
+ raise GitException, "%d conflict(s)" % len(conflicts)
+
+def mergetool(files = ()):
+ """Invoke 'git mergetool' to resolve any outstanding conflicts. If 'not
+ files', all the files in an unmerged state will be processed."""
+ GRun('mergetool', *list(files)).returns([0, 1]).run()
+ # check for unmerged entries (prepend 'CONFLICT ' for consistency with
+ # merge_recursive())
+ conflicts = ['CONFLICT ' + f for f in get_conflicts()]
+ if conflicts:
out.info(*conflicts)
-
- # try the interactive merge or stage checkout (if enabled)
- for filename in get_conflicts():
- if (gitmergeonefile.merge(filename)):
- # interactive merge succeeded
- resolved([filename])
-
- # any conflicts left unsolved?
- cn = len(get_conflicts())
- if cn:
- raise GitException, "%d conflict(s)" % cn
+ raise GitException, "%d conflict(s)" % len(conflicts)
def diff(files = None, rev1 = 'HEAD', rev2 = None, diff_flags = [],
binary = True):
@@ -754,7 +758,6 @@ def resolved(filenames, reset = None):
'--stdin', '-z').input_nulterm(filenames).no_output()
GRun('update-index', '--add', '--').xargs(filenames)
for filename in filenames:
- gitmergeonefile.clean_up(filename)
# update the access and modificatied times
os.utime(filename, None)
diff --git a/stgit/gitmergeonefile.py b/stgit/gitmergeonefile.py
deleted file mode 100644
index 1fe226e..0000000
--- a/stgit/gitmergeonefile.py
+++ /dev/null
@@ -1,150 +0,0 @@
-"""Performs a 3-way merge for GIT files
-"""
-
-__copyright__ = """
-Copyright (C) 2006, Catalin Marinas <catalin.marinas@gmail.com>
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License version 2 as
-published by the Free Software Foundation.
-
-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. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-"""
-
-import sys, os
-from stgit.exception import *
-from stgit import basedir
-from stgit.config import config, file_extensions, ConfigOption
-from stgit.utils import append_string
-from stgit.out import *
-from stgit.run import *
-
-class GitMergeException(StgException):
- pass
-
-
-#
-# Options
-#
-autoimerge = ConfigOption('stgit', 'autoimerge')
-keeporig = ConfigOption('stgit', 'keeporig')
-
-#
-# Utility functions
-#
-def __str2none(x):
- if x == '':
- return None
- else:
- return x
-
-class MRun(Run):
- exc = GitMergeException # use a custom exception class on errors
-
-def __checkout_stages(filename):
- """Check-out the merge stages in the index for the give file
- """
- extensions = file_extensions()
- line = MRun('git', 'checkout-index', '--stage=all', '--', filename
- ).output_one_line()
- stages, path = line.split('\t')
- stages = dict(zip(['ancestor', 'current', 'patched'],
- stages.split(' ')))
-
- for stage, fn in stages.iteritems():
- if stages[stage] == '.':
- stages[stage] = None
- else:
- newname = filename + extensions[stage]
- if os.path.exists(newname):
- # remove the stage if it is already checked out
- os.remove(newname)
- os.rename(stages[stage], newname)
- stages[stage] = newname
-
- return stages
-
-def __remove_stages(filename):
- """Remove the merge stages from the working directory
- """
- extensions = file_extensions()
- for ext in extensions.itervalues():
- fn = filename + ext
- if os.path.isfile(fn):
- os.remove(fn)
-
-def interactive_merge(filename):
- """Run the interactive merger on the given file. Stages will be
- removed according to stgit.keeporig. If successful and stages
- kept, they will be removed via git.resolved().
- """
- stages = __checkout_stages(filename)
-
- try:
- # Check whether we have all the files for the merge.
- if not (stages['current'] and stages['patched']):
- raise GitMergeException('Cannot run the interactive merge')
-
- if stages['ancestor']:
- three_way = True
- files_dict = {'branch1': stages['current'],
- 'ancestor': stages['ancestor'],
- 'branch2': stages['patched'],
- 'output': filename}
- imerger = config.get('stgit.i3merge')
- else:
- three_way = False
- files_dict = {'branch1': stages['current'],
- 'branch2': stages['patched'],
- 'output': filename}
- imerger = config.get('stgit.i2merge')
-
- if not imerger:
- raise GitMergeException, 'No interactive merge command configured'
-
- mtime = os.path.getmtime(filename)
-
- out.start('Trying the interactive %s merge'
- % (three_way and 'three-way' or 'two-way'))
- err = os.system(imerger % files_dict)
- out.done()
- if err != 0:
- raise GitMergeException, 'The interactive merge failed'
- if not os.path.isfile(filename):
- raise GitMergeException, 'The "%s" file is missing' % filename
- if mtime == os.path.getmtime(filename):
- raise GitMergeException, 'The "%s" file was not modified' % filename
- finally:
- # keep the merge stages?
- if str(keeporig) != 'yes':
- __remove_stages(filename)
-
-def clean_up(filename):
- """Remove merge conflict stages if they were generated.
- """
- if str(keeporig) == 'yes':
- __remove_stages(filename)
-
-def merge(filename):
- """Merge one file if interactive is allowed or check out the stages
- if keeporig is set.
- """
- if str(autoimerge) == 'yes':
- try:
- interactive_merge(filename)
- except GitMergeException, ex:
- out.error(str(ex))
- return False
- return True
-
- if str(keeporig) == 'yes':
- __checkout_stages(filename)
-
- return False
diff --git a/t/t0002-status.sh b/t/t0002-status.sh
index ac92aa8..d95a83b 100755
--- a/t/t0002-status.sh
+++ b/t/t0002-status.sh
@@ -107,9 +107,6 @@ test_expect_success 'Make a conflicting patch' '
'
cat > expected.txt <<EOF
-? foo/bar.ancestor
-? foo/bar.current
-? foo/bar.patched
A fie
C foo/bar
EOF
^ permalink raw reply related
* [StGit PATCH 0/4] Reposting udpated patches
From: Catalin Marinas @ 2009-03-17 11:08 UTC (permalink / raw)
To: git, Karl Hasselström
There are three patches which were updated after discussions and the
recommendation for the hidden argument to reorder_patches(). I haven't
reposted the acked patches.
Catalin Marinas (4):
Use a default "hidden" argument in StackTransaction.reorder_patches
Convert "float" to the lib infrastructure
Add automatic git-mergetool invocation to the new infrastructure
Add mergetool support to the classic StGit infrastructure
examples/gitconfig | 21 +-----
stgit/commands/edit.py | 2 -
stgit/commands/float.py | 80 +++++++++--------------
stgit/commands/goto.py | 2 -
stgit/commands/resolved.py | 5 -
stgit/commands/sink.py | 84 +++++++++++--------------
stgit/config.py | 1
stgit/git.py | 31 +++++----
stgit/gitmergeonefile.py | 150 --------------------------------------------
stgit/lib/git.py | 19 +++++-
stgit/lib/transaction.py | 11 ++-
t/t0002-status.sh | 3 -
t/t1501-sink.sh | 2 -
13 files changed, 114 insertions(+), 297 deletions(-)
delete mode 100644 stgit/gitmergeonefile.py
--
Catalin
^ permalink raw reply
* Re: [PATCH] config: test for --replace-all with one argument and fix documentation.
From: Uwe Kleine-König @ 2009-03-17 11:02 UTC (permalink / raw)
To: Felipe Contreras; +Cc: Johannes Schindelin, Carlos Rica, gitster, git
In-Reply-To: <94a0d4530903170341g27f215d4t8c3ad25e7f362590@mail.gmail.com>
Hello,
On Tue, Mar 17, 2009 at 12:41:29PM +0200, Felipe Contreras wrote:
> On Tue, Mar 17, 2009 at 12:24 PM, Johannes Schindelin
> <Johannes.Schindelin@gmx.de> wrote:
> > Hi,
> >
> > On Tue, 17 Mar 2009, Carlos Rica wrote:
> >
> >> Option --replace-all only allows at least two arguments, so
> >> documentation was needing to be updated accordingly. A test showing
> >> that the command fails with only one parameter is also provided.
> >>
> >> Signed-off-by: Carlos Rica <jasampler@gmail.com>
> >
> > Looks obviously correct to me. I am actually unsure if I can ACK this
> > patch, as most of builtin-config.c does not look all that familiar to me
> > anymore ;-)
>
> Hehe... interesting, my first possibility of ack'ing :D (I guess)
>
> Acked-by: Felipe Contreras <felipe.contreras@gmail.com>
It's not nice to ack in public that someone else doesn't know something
anymore. :-)
SCNR
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
^ permalink raw reply
* Re: [PATCH] Give error when no remote is configured
From: Giovanni Bajo @ 2009-03-17 0:12 UTC (permalink / raw)
To: Jay Soffian; +Cc: Daniel Barkalow, Junio C Hamano, bernie, git
In-Reply-To: <76718490903161301qca2214cta87411bad1b0b8b5@mail.gmail.com>
On 3/16/2009 9:01 PM, Jay Soffian wrote:
> On Mon, Mar 16, 2009 at 12:55 PM, Daniel Barkalow <barkalow@iabervon.org> wrote:
>> No default remote is configured for your current branch, and the default
>> remote "origin" is not configured either.
>
> The use of "default" twice is slightly confusing. Perhaps:
>
> No remote is configured for the current branch, and the default
> remote "origin" is not configured either.
I'm a total newbie with git. I must say that the above sentence means
absolutely nothing to me (in either version) because of the confusing
usage of the word "remote" (twice, one as a substantive, one as an
adjective) and the word "origin" which is git jargon which I don't
master yet.
My suggestion is that you should at least add a sentence that points to
a likely solution. Something like:
(use "git remote add" to configure a remote URL)
Note that I don't have any clue if this sentece is correct and/or is the
correct solution. The above is just an example of a helpful error message.
--
Giovanni Bajo
Develer S.r.l.
http://www.develer.com
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox