* [PATCHv1 0/2] git-p4: disable sync after submit
@ 2018-06-05 8:28 Luke Diamand
2018-06-05 8:28 ` [PATCHv1 1/2] git-p4: disable-rebase: allow setting this via configuration Luke Diamand
2018-06-05 8:28 ` [PATCHv1 2/2] git-p4: add option to disable syncing of p4/master with p4 Luke Diamand
0 siblings, 2 replies; 4+ messages in thread
From: Luke Diamand @ 2018-06-05 8:28 UTC (permalink / raw)
To: git
Cc: SZEDER Gábor, Romain Merland, Miguel Torroja,
viniciusalexandre, Lars Schneider, Luke Diamand
This is a small patch to git-p4 to disable the automatic sync after
submit.
In my day-to-day work, I have a central git-p4 repo which is
automatically kept up-to-date, so the repos where I actually work and
submit from don't even need the sync. I usually end up hitting Ctrl-C
partway through the sync.
I imagine other people with large git-p4 projects do something similar
and have the same problem.
This also updates Merland's recent submit-selection change so that both
options can be set via configuration rather than being set on the
command line.
Luke Diamand (2):
git-p4: disable-rebase: allow setting this via configuration
git-p4: add option to disable syncing of p4/master with p4
Documentation/git-p4.txt | 13 ++++++++++++-
git-p4.py | 33 +++++++++++++++++++++------------
2 files changed, 33 insertions(+), 13 deletions(-)
--
2.17.0.392.gdeb1a6e9b7
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCHv1 1/2] git-p4: disable-rebase: allow setting this via configuration
2018-06-05 8:28 [PATCHv1 0/2] git-p4: disable sync after submit Luke Diamand
@ 2018-06-05 8:28 ` Luke Diamand
2018-06-05 8:28 ` [PATCHv1 2/2] git-p4: add option to disable syncing of p4/master with p4 Luke Diamand
1 sibling, 0 replies; 4+ messages in thread
From: Luke Diamand @ 2018-06-05 8:28 UTC (permalink / raw)
To: git
Cc: SZEDER Gábor, Romain Merland, Miguel Torroja,
viniciusalexandre, Lars Schneider, Luke Diamand
This just lets you set the --disable-rebase option with the
git configuration options git-p4.disableRebase. If you're
using this option, you probably want to set it all the time
for a given repo.
Signed-off-by: Luke Diamand <luke@diamand.org>
---
Documentation/git-p4.txt | 5 ++++-
git-p4.py | 2 +-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/Documentation/git-p4.txt b/Documentation/git-p4.txt
index e8452528fc..3d83842e47 100644
--- a/Documentation/git-p4.txt
+++ b/Documentation/git-p4.txt
@@ -367,7 +367,7 @@ These options can be used to modify 'git p4 submit' behavior.
--disable-rebase::
Disable the automatic rebase after all commits have been successfully
- submitted.
+ submitted. Can also be set with git-p4.disableRebase.
Rebase options
~~~~~~~~~~~~~~
@@ -690,6 +690,9 @@ git-p4.conflict::
Specify submit behavior when a conflict with p4 is found, as per
--conflict. The default behavior is 'ask'.
+git-p4.disableRebase::
+ Do not rebase the tree against p4/master following a submit.
+
IMPLEMENTATION DETAILS
----------------------
* Changesets from p4 are imported using Git fast-import.
diff --git a/git-p4.py b/git-p4.py
index c4581d20a6..5ab9421af8 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -1379,7 +1379,7 @@ def __init__(self):
self.shelve = False
self.update_shelve = list()
self.commit = ""
- self.disable_rebase = False
+ self.disable_rebase = gitConfigBool("git-p4.disableRebase")
self.prepare_p4_only = False
self.conflict_behavior = None
self.isWindows = (platform.system() == "Windows")
--
2.17.0.392.gdeb1a6e9b7
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCHv1 2/2] git-p4: add option to disable syncing of p4/master with p4
2018-06-05 8:28 [PATCHv1 0/2] git-p4: disable sync after submit Luke Diamand
2018-06-05 8:28 ` [PATCHv1 1/2] git-p4: disable-rebase: allow setting this via configuration Luke Diamand
@ 2018-06-05 8:28 ` Luke Diamand
2018-06-05 8:47 ` Eric Sunshine
1 sibling, 1 reply; 4+ messages in thread
From: Luke Diamand @ 2018-06-05 8:28 UTC (permalink / raw)
To: git
Cc: SZEDER Gábor, Romain Merland, Miguel Torroja,
viniciusalexandre, Lars Schneider, Luke Diamand
Add an option to the git-p4 submit command to disable syncing
with Perforce.
This is useful for the case where a git-p4 mirror has been setup
on a server somewhere, running from (e.g.) cron, and developers
then clone from this. Having the local cloned copy also sync
from Perforce just isn't useful.
Signed-off-by: Luke Diamand <luke@diamand.org>
---
Documentation/git-p4.txt | 8 ++++++++
git-p4.py | 31 ++++++++++++++++++++-----------
2 files changed, 28 insertions(+), 11 deletions(-)
diff --git a/Documentation/git-p4.txt b/Documentation/git-p4.txt
index 3d83842e47..8f6a7543fd 100644
--- a/Documentation/git-p4.txt
+++ b/Documentation/git-p4.txt
@@ -369,6 +369,11 @@ These options can be used to modify 'git p4 submit' behavior.
Disable the automatic rebase after all commits have been successfully
submitted. Can also be set with git-p4.disableRebase.
+--disable-p4sync::
+ Disable the automatic sync of p4/master from Perforce after commit have
+ been submitted. Implies --disable-rebase. Can also be set with
+ git-p4.disableP4Sync. Sync with origin/master still goes ahead if possible.
+
Rebase options
~~~~~~~~~~~~~~
These options can be used to modify 'git p4 rebase' behavior.
@@ -693,6 +698,9 @@ git-p4.conflict::
git-p4.disableRebase::
Do not rebase the tree against p4/master following a submit.
+git-p4.disableP4Sync::
+ Do not sync p4/master with Perforce following a submit. Implies git-p4.disableRebase.
+
IMPLEMENTATION DETAILS
----------------------
* Changesets from p4 are imported using Git fast-import.
diff --git a/git-p4.py b/git-p4.py
index 5ab9421af8..b9e79f1d8b 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -1368,7 +1368,9 @@ def __init__(self):
help="submit only the specified commit(s), one commit or xxx..xxx"),
optparse.make_option("--disable-rebase", dest="disable_rebase", action="store_true",
help="Disable rebase after submit is completed. Can be useful if you "
- "work from a local git branch that is not master")
+ "work from a local git branch that is not master"),
+ optparse.make_option("--disable-p4sync", dest="disable_p4sync", action="store_true",
+ help="Skip perforce sync of p4/master after submit or shelve"),
]
self.description = "Submit changes from git to the perforce depot."
self.usage += " [name of git branch to submit into perforce depot]"
@@ -1380,6 +1382,7 @@ def __init__(self):
self.update_shelve = list()
self.commit = ""
self.disable_rebase = gitConfigBool("git-p4.disableRebase")
+ self.disable_p4sync = gitConfigBool("git-p4.disableP4Sync")
self.prepare_p4_only = False
self.conflict_behavior = None
self.isWindows = (platform.system() == "Windows")
@@ -2240,11 +2243,14 @@ def run(self, args):
sync = P4Sync()
if self.branch:
sync.branch = self.branch
- sync.run([])
+ if self.disable_p4sync:
+ sync.sync_origin_only()
+ else:
+ sync.run([])
- if self.disable_rebase is False:
- rebase = P4Rebase()
- rebase.rebase()
+ if not self.disable_rebase:
+ rebase = P4Rebase()
+ rebase.rebase()
else:
if len(applied) == 0:
@@ -3324,6 +3330,14 @@ def importChanges(self, changes, shelved=False, origin_revision=0):
print self.gitError.read()
sys.exit(1)
+ def sync_origin_only(self):
+ if self.syncWithOrigin:
+ self.hasOrigin = originP4BranchesExist()
+ if self.hasOrigin:
+ if not self.silent:
+ print 'Syncing with origin first, using "git fetch origin"'
+ system("git fetch origin")
+
def importHeadRevision(self, revision):
print "Doing initial import of %s from revision %s into %s" % (' '.join(self.depotPaths), revision, self.branch)
@@ -3402,12 +3416,7 @@ def run(self, args):
else:
self.refPrefix = "refs/heads/p4/"
- if self.syncWithOrigin:
- self.hasOrigin = originP4BranchesExist()
- if self.hasOrigin:
- if not self.silent:
- print 'Syncing with origin first, using "git fetch origin"'
- system("git fetch origin")
+ self.sync_origin_only()
branch_arg_given = bool(self.branch)
if len(self.branch) == 0:
--
2.17.0.392.gdeb1a6e9b7
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCHv1 2/2] git-p4: add option to disable syncing of p4/master with p4
2018-06-05 8:28 ` [PATCHv1 2/2] git-p4: add option to disable syncing of p4/master with p4 Luke Diamand
@ 2018-06-05 8:47 ` Eric Sunshine
0 siblings, 0 replies; 4+ messages in thread
From: Eric Sunshine @ 2018-06-05 8:47 UTC (permalink / raw)
To: Luke Diamand
Cc: Git List, SZEDER Gábor, merlorom, Miguel Torroja,
viniciusalexandre, Lars Schneider
On Tue, Jun 5, 2018 at 4:29 AM Luke Diamand <luke@diamand.org> wrote:
> Add an option to the git-p4 submit command to disable syncing
> with Perforce.
>
> This is useful for the case where a git-p4 mirror has been setup
> on a server somewhere, running from (e.g.) cron, and developers
> then clone from this. Having the local cloned copy also sync
> from Perforce just isn't useful.
>
> Signed-off-by: Luke Diamand <luke@diamand.org>
> ---
> diff --git a/Documentation/git-p4.txt b/Documentation/git-p4.txt
> @@ -369,6 +369,11 @@ These options can be used to modify 'git p4 submit' behavior.
> +--disable-p4sync::
> + Disable the automatic sync of p4/master from Perforce after commit have
s/commit/commits/
> + been submitted. Implies --disable-rebase. Can also be set with
> + git-p4.disableP4Sync. Sync with origin/master still goes ahead if possible.
> diff --git a/git-p4.py b/git-p4.py
> @@ -1368,7 +1368,9 @@ def __init__(self):
> + optparse.make_option("--disable-p4sync", dest="disable_p4sync", action="store_true",
> + help="Skip perforce sync of p4/master after submit or shelve"),
s/perforce/Perforce/
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-06-05 8:47 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-05 8:28 [PATCHv1 0/2] git-p4: disable sync after submit Luke Diamand
2018-06-05 8:28 ` [PATCHv1 1/2] git-p4: disable-rebase: allow setting this via configuration Luke Diamand
2018-06-05 8:28 ` [PATCHv1 2/2] git-p4: add option to disable syncing of p4/master with p4 Luke Diamand
2018-06-05 8:47 ` Eric Sunshine
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).