Re: [PATCH] git-p4.py: Make submit working on bare repository

2016-06-07 Thread Amadeusz Żołnowski
Junio C Hamano <gits...@pobox.com> writes:

> Amadeusz Żołnowski <aide...@aidecoe.name> writes:
>
>>> Has anything happened to this topic after this?  I am wondering if I
>>> should discard the topic az/p4-bare-no-rebase without prejudice.

I think you can discard the topic, because we're moving away from
Perforce and while I have tested my original patch I haven't found time
to change it to --skip-rebase option as suggested and test it.

Thanks,
-- 
Amadeusz Żołnowski


signature.asc
Description: PGP signature


Re: [PATCH] git-p4.py: Make submit working on bare repository

2016-04-13 Thread Amadeusz Żołnowski
Hi,

Junio C Hamano <gits...@pobox.com> writes:
> Has anything happened to this topic after this?  I am wondering if I
> should discard the topic az/p4-bare-no-rebase without prejudice.

Sorry, I haven't got time to take a loot at this, but I'll return to
that soon, OK? I'll prepare a patch with an option to skip rebase rather
than do it only for bare repos.

-- 
Amadeusz Żołnowski


signature.asc
Description: PGP signature


Re: [PATCH] git-p4.py: Make submit working on bare repository

2016-02-28 Thread Amadeusz Żołnowski
Luke Diamand <l...@diamand.org> writes:

> On 23 February 2016 at 20:56, Amadeusz Żołnowski <aide...@aidecoe.name> wrote:
>>
>> To simplify things, why not just update ref during submit from bare
>> repository? As you have pointed out, if user invokes submit in this
>> context he/she actually wants to submit from bare repo and probably
>> knows what he/she is doing - especially if he/she reads man page. (-:
>
> Will it do something sensible if anything goes wrong?
>
> I'm thinking about what happens if you submit and one of the commits
> fails to go to P4 due to a merge conflict.

Handling failures in this case is a bit tricky, indeed.


> But I guess just doing an update-ref could be an OK thing to do.
> Without actually trying it out for real though I can't be sure. It
> might make sense to get some practical experience of how this works
> out.

True. For now I have these cases covered by wrapper scripts. The minimum
I need from git-p4 is just not to fail on git submit from bare
repository which is covered by patch I have submitted. If I get my
solution enough testing, I'd think of transforming it into patch for
git-p4.py as well.

-- 
Amadeusz Żołnowski


signature.asc
Description: PGP signature


Re: [PATCH] git-p4.py: Make submit working on bare repository

2016-02-23 Thread Amadeusz Żołnowski
Hi Luke,

Luke Diamand <l...@diamand.org> writes:
> I'm guessing that the reason for using a bare repo is so that changes
> can be pushed to it from several different git repos. This then saves
> doing the initial git-p4 clone multiple times.

I have created a Git repository acting as a bridge between Perforce and
pure Git repos. Changes pushed to master branch on this bridge repo get
submitted to Perforce repository (referenced via remote p4/master).


> If this had actually worked, I think the next thing I would want to do
> is to rebase one or more branches in the bare repo against p4/master.
> I don't think there's any way that git-p4 can work out which branches
> would be rebased, and nor should it.

It actually has all information needed. It submits commits from a given
branch to a branch specified with --branch option (or default p4
remote). When submitting from a non-bare repo git-p4 has the same set of
information: the current branch and a branch specified with --branch (or
default p4 remote).


> I think the approach of using a submitFromBare config variable to
> force the user to make a choice feels a bit bogus, since they clearly
> *want* to submit from this bare repo, as otherwise they wouldn't have
> done "git-p4 submit" in the first place.

I agree, a good point.


> It might make sense to have a command-line or config option
> ("--skip-rebase" ?) to tell "submit" to only do the submit part, and
> skip the rebase stage (and get the rebase stage to give a more useful
> error message on a bare repo when the option isn't used). That would
> then mean that git-p4 does not have to know if it's running in a bare
> repo or not, and the submit-without-rebase functionality is available
> to people doing other different things not involving bare repos (which
> we haven't though of yet) but still requiring submit without rebase.

While having additional --skip-rebase is a good idea, having git-p4
doing rebase would be more elegant for those who actually use GitP4 in
bare repository. In message 87fuwnd4u7@freja.aidecoe.name I have
described how state of branches changes during submit. It clearly shows
that in case of a bare repository it ends up in undesired state.

To simplify things, why not just update ref during submit from bare
repository? As you have pointed out, if user invokes submit in this
context he/she actually wants to submit from bare repo and probably
knows what he/she is doing - especially if he/she reads man page. (-:


Kind regards,

-- 
Amadeusz Żołnowski


signature.asc
Description: PGP signature


Re: [PATCH] git-p4.py: Make submit working on bare repository

2016-02-22 Thread Amadeusz Żołnowski
Junio C Hamano <gits...@pobox.com> writes:
> I wonder if it makes sense to just silently allowing submit without
> rebasing, and without telling the user how to clean it up.

It is a good point. Maybe submit shouldn't be allowed by default at all
From bare repository. What do you think about following approach?  If
core.base is true, then if git-p4.submitFromBare is also true then
submit without performing proper rebase, but update master ref from
p4/master. If core.base is true, but git-p4.submitFromBare is false,
abort immediately. Submitting from bare repository would require aware
decision from a user.

Kind regards,

-- 
Amadeusz Żołnowski


signature.asc
Description: PGP signature


Re: [PATCH] git-p4.py: Make submit working on bare repository

2016-02-20 Thread Amadeusz Żołnowski
Hi Junio,

To submit changes from master branch to Perforce, new commits should be
based on a remote branch p4/master:

(1)
  E'---F' master
 /
A---B---C---D p4/master

Commits from A to D map to Perforce changelists. These commits include
additional metadata in commit message which most important is changelist
number.

On submit git-p4 prepares changelists for commits E'-F' and submits
these to Perforce repository. After this operation it syncs back remote
branch p4/master. This is the common part for both bare and non-bare
repository.

(2)
  E'---F' master
 /
A---B---C---D---E---F p4/master

In non-bare repository git rebase is performed and it results in
following state:

(3)
A---B---C---D---E---F p4/master, master

In bare repository this operation cannot be performed, so it remains in
state (2).

With special care state (2) can be transformed to state (3) with manual
update of refs/heads/master with refs/remotes/p4/master.

I understand that implementing rebase for bare repository is unsafe and
it wouldn't be appreciated. Therefore we have to resort to such a
barbarity and git-p4 submit shouldn't attempt to perform a rebase
operation itself. Especially because it performs other operations before
and we end up in the intermediate state (2) anyway.

Is this explanation satisfactory? If yes, I'll include it in patch
description.


Kind regards,

-- 
Amadeusz Żołnowski


signature.asc
Description: PGP signature


[PATCH] git-p4.py: Make submit working on bare repository

2016-02-19 Thread Amadeusz Żołnowski
git-p4 can be successfully used from bare repository (which may act as a
bridge between Perforce repository and pure Git repositories). After
submitting changelist to Perforce, git-p4 performs unconditional rebase
which obviously fails.

Perform rebase only on non-bare repositories, so submit command can be
successful on bare repository.

Signed-off-by: Amadeusz Żołnowski <aide...@aidecoe.name>
---
 git-p4.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/git-p4.py b/git-p4.py
index c33dece..e00cd02 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -2059,8 +2059,9 @@ class P4Submit(Command, P4UserMap):
 sync.branch = self.branch
 sync.run([])
 
-rebase = P4Rebase()
-rebase.rebase()
+if not gitConfigBool("core.bare"):
+rebase = P4Rebase()
+rebase.rebase()
 
 else:
 if len(applied) == 0:
-- 
2.7.0

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] git-p4.py: Don't try to rebase on submit from bare repository

2016-02-19 Thread Amadeusz Żołnowski
git-p4 can be successfully used from bare repository (which acts as a
bridge between Perforce repository and pure Git repositories). On submit
git-p4 performs unconditional rebase. Do rebase only on non-bare
repositories.

Signed-off-by: Amadeusz Żołnowski <aide...@aidecoe.name>
---
 git-p4.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/git-p4.py b/git-p4.py
index c33dece..e00cd02 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -2059,8 +2059,9 @@ class P4Submit(Command, P4UserMap):
 sync.branch = self.branch
 sync.run([])
 
-rebase = P4Rebase()
-rebase.rebase()
+if not gitConfigBool("core.bare"):
+rebase = P4Rebase()
+rebase.rebase()
 
 else:
 if len(applied) == 0:
-- 
2.7.0

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[PATCH] git-p4.py: Don't try to rebase on submit from bare repository

2016-02-18 Thread Amadeusz Żołnowski
git-p4 can be successfully used from bare repository (which acts as a
bridge between Perforce repository and pure Git repositories). On submit
git-p4 performs unconditional rebase. Do rebase only on non-bare
repositories.
---
 git-p4.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/git-p4.py b/git-p4.py
index c33dece..e00cd02 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -2059,8 +2059,9 @@ class P4Submit(Command, P4UserMap):
 sync.branch = self.branch
 sync.run([])
 
-rebase = P4Rebase()
-rebase.rebase()
+if not gitConfigBool("core.bare"):
+rebase = P4Rebase()
+rebase.rebase()
 
 else:
 if len(applied) == 0:
-- 
2.7.0

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html