All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] git-p4: remove "debug" and "rollback" verbs
@ 2021-12-17 14:05 Joel Holdsworth
  2021-12-17 14:05 ` [PATCH v2 1/2] git-p4: remove "delete" verb Joel Holdsworth
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Joel Holdsworth @ 2021-12-17 14:05 UTC (permalink / raw)
  To: git
  Cc: Tzadik Vanderhoof, Dorgon Chang, Joachim Kuebart, Daniel Levin,
	Johannes Schindelin, Luke Diamand, Ben Keene, Andrew Oakley,
	Joel Holdsworth

git-p4 contains a selection of verbs for various functions of the
script. The "debug" and "rollback" verbs appear to have been added early
in the development life of git-p4. They were once used as debugging
tools, but no longer serve any useful purpose either for developers or
users. Removing these verbs simplifies the script by removing dead code,
and increases usability by reducing complaexity.

Joel Holdsworth (2):
  git-p4: remove "delete" verb
  git-p4: remove "rollback" verb

 git-p4.py | 76 -------------------------------------------------------
 1 file changed, 76 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2 1/2] git-p4: remove "delete" verb
  2021-12-17 14:05 [PATCH v2 0/2] git-p4: remove "debug" and "rollback" verbs Joel Holdsworth
@ 2021-12-17 14:05 ` Joel Holdsworth
  2021-12-20 19:38   ` Junio C Hamano
  2021-12-17 14:05 ` [PATCH v2 2/2] git-p4: remove "rollback" verb Joel Holdsworth
  2021-12-20 21:19 ` [PATCH v2 0/2] git-p4: remove "debug" and "rollback" verbs Johannes Schindelin
  2 siblings, 1 reply; 7+ messages in thread
From: Joel Holdsworth @ 2021-12-17 14:05 UTC (permalink / raw)
  To: git
  Cc: Tzadik Vanderhoof, Dorgon Chang, Joachim Kuebart, Daniel Levin,
	Johannes Schindelin, Luke Diamand, Ben Keene, Andrew Oakley,
	Joel Holdsworth

The git-p4 "delete" verb is described as "A tool to debug the output of
p4 -G". However, the implementation provided is of no useful benefit to
either users or developers.

Signed-off-by: Joel Holdsworth <jholdsworth@nvidia.com>
---
Adds Signed-off-by tag

 git-p4.py | 16 ----------------
 1 file changed, 16 deletions(-)

diff --git a/git-p4.py b/git-p4.py
index 2b4500226a..b7ed8e41ff 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -1532,21 +1532,6 @@ def loadUserMapFromCache(self):
         except IOError:
             self.getUserMapFromPerforceServer()
 
-class P4Debug(Command):
-    def __init__(self):
-        Command.__init__(self)
-        self.options = []
-        self.description = "A tool to debug the output of p4 -G."
-        self.needsGit = False
-
-    def run(self, args):
-        j = 0
-        for output in p4CmdList(args):
-            print('Element: %d' % j)
-            j += 1
-            print(output)
-        return True
-
 class P4RollBack(Command):
     def __init__(self):
         Command.__init__(self)
@@ -4363,7 +4348,6 @@ def printUsage(commands):
     print("")
 
 commands = {
-    "debug" : P4Debug,
     "submit" : P4Submit,
     "commit" : P4Submit,
     "sync" : P4Sync,
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 2/2] git-p4: remove "rollback" verb
  2021-12-17 14:05 [PATCH v2 0/2] git-p4: remove "debug" and "rollback" verbs Joel Holdsworth
  2021-12-17 14:05 ` [PATCH v2 1/2] git-p4: remove "delete" verb Joel Holdsworth
@ 2021-12-17 14:05 ` Joel Holdsworth
  2021-12-20 19:32   ` Junio C Hamano
  2021-12-20 21:19 ` [PATCH v2 0/2] git-p4: remove "debug" and "rollback" verbs Johannes Schindelin
  2 siblings, 1 reply; 7+ messages in thread
From: Joel Holdsworth @ 2021-12-17 14:05 UTC (permalink / raw)
  To: git
  Cc: Tzadik Vanderhoof, Dorgon Chang, Joachim Kuebart, Daniel Levin,
	Johannes Schindelin, Luke Diamand, Ben Keene, Andrew Oakley,
	Joel Holdsworth

The git-p4 "rollback" verb is described as "A tool to debug the
multi-branch import. Don't use :)". The implementation provided is of no
useful benefit to either users or developers.

Signed-off-by: Joel Holdsworth <jholdsworth@nvidia.com>
---
Adds Signed-off-by tag

 git-p4.py | 60 -------------------------------------------------------
 1 file changed, 60 deletions(-)

diff --git a/git-p4.py b/git-p4.py
index b7ed8e41ff..a7cb321f75 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -1532,65 +1532,6 @@ def loadUserMapFromCache(self):
         except IOError:
             self.getUserMapFromPerforceServer()
 
-class P4RollBack(Command):
-    def __init__(self):
-        Command.__init__(self)
-        self.options = [
-            optparse.make_option("--local", dest="rollbackLocalBranches", action="store_true")
-        ]
-        self.description = "A tool to debug the multi-branch import. Don't use :)"
-        self.rollbackLocalBranches = False
-
-    def run(self, args):
-        if len(args) != 1:
-            return False
-        maxChange = int(args[0])
-
-        if "p4ExitCode" in p4Cmd("changes -m 1"):
-            die("Problems executing p4");
-
-        if self.rollbackLocalBranches:
-            refPrefix = "refs/heads/"
-            lines = read_pipe_lines("git rev-parse --symbolic --branches")
-        else:
-            refPrefix = "refs/remotes/"
-            lines = read_pipe_lines("git rev-parse --symbolic --remotes")
-
-        for line in lines:
-            if self.rollbackLocalBranches or (line.startswith("p4/") and line != "p4/HEAD\n"):
-                line = line.strip()
-                ref = refPrefix + line
-                log = extractLogMessageFromGitCommit(ref)
-                settings = extractSettingsGitLog(log)
-
-                depotPaths = settings['depot-paths']
-                change = settings['change']
-
-                changed = False
-
-                if len(p4Cmd("changes -m 1 "  + ' '.join (['%s...@%s' % (p, maxChange)
-                                                           for p in depotPaths]))) == 0:
-                    print("Branch %s did not exist at change %s, deleting." % (ref, maxChange))
-                    system("git update-ref -d %s `git rev-parse %s`" % (ref, ref))
-                    continue
-
-                while change and int(change) > maxChange:
-                    changed = True
-                    if self.verbose:
-                        print("%s is at %s ; rewinding towards %s" % (ref, change, maxChange))
-                    system("git update-ref %s \"%s^\"" % (ref, ref))
-                    log = extractLogMessageFromGitCommit(ref)
-                    settings =  extractSettingsGitLog(log)
-
-
-                    depotPaths = settings['depot-paths']
-                    change = settings['change']
-
-                if changed:
-                    print("%s rewound to %s" % (ref, change))
-
-        return True
-
 class P4Submit(Command, P4UserMap):
 
     conflict_behavior_choices = ("ask", "skip", "quit")
@@ -4353,7 +4294,6 @@ def printUsage(commands):
     "sync" : P4Sync,
     "rebase" : P4Rebase,
     "clone" : P4Clone,
-    "rollback" : P4RollBack,
     "branches" : P4Branches,
     "unshelve" : P4Unshelve,
 }
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 2/2] git-p4: remove "rollback" verb
  2021-12-17 14:05 ` [PATCH v2 2/2] git-p4: remove "rollback" verb Joel Holdsworth
@ 2021-12-20 19:32   ` Junio C Hamano
  0 siblings, 0 replies; 7+ messages in thread
From: Junio C Hamano @ 2021-12-20 19:32 UTC (permalink / raw)
  To: Joel Holdsworth
  Cc: git, Tzadik Vanderhoof, Dorgon Chang, Joachim Kuebart,
	Daniel Levin, Johannes Schindelin, Luke Diamand, Ben Keene,
	Andrew Oakley

Joel Holdsworth <jholdsworth@nvidia.com> writes:

> The git-p4 "rollback" verb is described as "A tool to debug the
> multi-branch import. Don't use :)".

;-).

> The implementation provided is of no
> useful benefit to either users or developers.

It is hard to make such a broad "no useful benefit" claim without
giving a bit more analysis [*].  With only that single sentence, it
is far worse justification than saying that "The author tells us not
to use it, and it is not even documented" to convince others why
removal is a good idea.

I'd suggest dropping that sentence (replace it with something we can
objectively verify, like "it is not even documented", if you want to).

Thanks.

[Footnote]

 * what the code tried to do, how it didn't do it well that it was
   clear that it couldn't possibly be useful, etc. etc.


> Signed-off-by: Joel Holdsworth <jholdsworth@nvidia.com>
> ---
> Adds Signed-off-by tag
>
>  git-p4.py | 60 -------------------------------------------------------
>  1 file changed, 60 deletions(-)
>
> diff --git a/git-p4.py b/git-p4.py
> index b7ed8e41ff..a7cb321f75 100755
> --- a/git-p4.py
> +++ b/git-p4.py
> @@ -1532,65 +1532,6 @@ def loadUserMapFromCache(self):
>          except IOError:
>              self.getUserMapFromPerforceServer()
>  
> -class P4RollBack(Command):
> -    def __init__(self):
> -        Command.__init__(self)
> -        self.options = [
> -            optparse.make_option("--local", dest="rollbackLocalBranches", action="store_true")
> -        ]
> -        self.description = "A tool to debug the multi-branch import. Don't use :)"
> -        self.rollbackLocalBranches = False
> -
> -    def run(self, args):
> -        if len(args) != 1:
> -            return False
> -        maxChange = int(args[0])
> -
> -        if "p4ExitCode" in p4Cmd("changes -m 1"):
> -            die("Problems executing p4");
> -
> -        if self.rollbackLocalBranches:
> -            refPrefix = "refs/heads/"
> -            lines = read_pipe_lines("git rev-parse --symbolic --branches")
> -        else:
> -            refPrefix = "refs/remotes/"
> -            lines = read_pipe_lines("git rev-parse --symbolic --remotes")
> -
> -        for line in lines:
> -            if self.rollbackLocalBranches or (line.startswith("p4/") and line != "p4/HEAD\n"):
> -                line = line.strip()
> -                ref = refPrefix + line
> -                log = extractLogMessageFromGitCommit(ref)
> -                settings = extractSettingsGitLog(log)
> -
> -                depotPaths = settings['depot-paths']
> -                change = settings['change']
> -
> -                changed = False
> -
> -                if len(p4Cmd("changes -m 1 "  + ' '.join (['%s...@%s' % (p, maxChange)
> -                                                           for p in depotPaths]))) == 0:
> -                    print("Branch %s did not exist at change %s, deleting." % (ref, maxChange))
> -                    system("git update-ref -d %s `git rev-parse %s`" % (ref, ref))
> -                    continue
> -
> -                while change and int(change) > maxChange:
> -                    changed = True
> -                    if self.verbose:
> -                        print("%s is at %s ; rewinding towards %s" % (ref, change, maxChange))
> -                    system("git update-ref %s \"%s^\"" % (ref, ref))
> -                    log = extractLogMessageFromGitCommit(ref)
> -                    settings =  extractSettingsGitLog(log)
> -
> -
> -                    depotPaths = settings['depot-paths']
> -                    change = settings['change']
> -
> -                if changed:
> -                    print("%s rewound to %s" % (ref, change))
> -
> -        return True
> -
>  class P4Submit(Command, P4UserMap):
>  
>      conflict_behavior_choices = ("ask", "skip", "quit")
> @@ -4353,7 +4294,6 @@ def printUsage(commands):
>      "sync" : P4Sync,
>      "rebase" : P4Rebase,
>      "clone" : P4Clone,
> -    "rollback" : P4RollBack,
>      "branches" : P4Branches,
>      "unshelve" : P4Unshelve,
>  }

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 1/2] git-p4: remove "delete" verb
  2021-12-17 14:05 ` [PATCH v2 1/2] git-p4: remove "delete" verb Joel Holdsworth
@ 2021-12-20 19:38   ` Junio C Hamano
  2021-12-21 10:32     ` Luke Diamand
  0 siblings, 1 reply; 7+ messages in thread
From: Junio C Hamano @ 2021-12-20 19:38 UTC (permalink / raw)
  To: Joel Holdsworth
  Cc: git, Tzadik Vanderhoof, Dorgon Chang, Joachim Kuebart,
	Daniel Levin, Johannes Schindelin, Luke Diamand, Ben Keene,
	Andrew Oakley

Joel Holdsworth <jholdsworth@nvidia.com> writes:

> The git-p4 "delete" verb is described as "A tool to debug the output of
> p4 -G". However, the implementation provided is of no useful benefit to
> either users or developers.

The same comment as 2/2 applies here, too.  This time, however, I
think it would be much easier to give a proper analysis of what it
is designed to do and what it does, to convince readers why it is
too trivial to be worth having the code (compared to the PATCH 2/2).

Also, this is not about the "delete" verb, but the "debug" verb, no?


> Signed-off-by: Joel Holdsworth <jholdsworth@nvidia.com>
> ---
> Adds Signed-off-by tag
>
>  git-p4.py | 16 ----------------
>  1 file changed, 16 deletions(-)
>
> diff --git a/git-p4.py b/git-p4.py
> index 2b4500226a..b7ed8e41ff 100755
> --- a/git-p4.py
> +++ b/git-p4.py
> @@ -1532,21 +1532,6 @@ def loadUserMapFromCache(self):
>          except IOError:
>              self.getUserMapFromPerforceServer()
>  
> -class P4Debug(Command):
> -    def __init__(self):
> -        Command.__init__(self)
> -        self.options = []
> -        self.description = "A tool to debug the output of p4 -G."
> -        self.needsGit = False
> -
> -    def run(self, args):
> -        j = 0
> -        for output in p4CmdList(args):
> -            print('Element: %d' % j)
> -            j += 1
> -            print(output)
> -        return True
> -
>  class P4RollBack(Command):
>      def __init__(self):
>          Command.__init__(self)
> @@ -4363,7 +4348,6 @@ def printUsage(commands):
>      print("")
>  
>  commands = {
> -    "debug" : P4Debug,
>      "submit" : P4Submit,
>      "commit" : P4Submit,
>      "sync" : P4Sync,

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 0/2] git-p4: remove "debug" and "rollback" verbs
  2021-12-17 14:05 [PATCH v2 0/2] git-p4: remove "debug" and "rollback" verbs Joel Holdsworth
  2021-12-17 14:05 ` [PATCH v2 1/2] git-p4: remove "delete" verb Joel Holdsworth
  2021-12-17 14:05 ` [PATCH v2 2/2] git-p4: remove "rollback" verb Joel Holdsworth
@ 2021-12-20 21:19 ` Johannes Schindelin
  2 siblings, 0 replies; 7+ messages in thread
From: Johannes Schindelin @ 2021-12-20 21:19 UTC (permalink / raw)
  To: Joel Holdsworth
  Cc: git, Tzadik Vanderhoof, Dorgon Chang, Joachim Kuebart,
	Daniel Levin, Luke Diamand, Ben Keene, Andrew Oakley

Hi Joel,

On Fri, 17 Dec 2021, Joel Holdsworth wrote:

> git-p4 contains a selection of verbs for various functions of the
> script. The "debug" and "rollback" verbs appear to have been added early
> in the development life of git-p4. They were once used as debugging
> tools, but no longer serve any useful purpose either for developers or
> users. Removing these verbs simplifies the script by removing dead code,
> and increases usability by reducing complaexity.

Thank you for Cc:ing me, but I am not really familiar with Perforce. All
my modifications in the git-p4 area stem from trying to let the CI/PR
builds pass... So I don't feel that I am competent enough a reviewer for
this patch series.

Ciao,
Johannes

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 1/2] git-p4: remove "delete" verb
  2021-12-20 19:38   ` Junio C Hamano
@ 2021-12-21 10:32     ` Luke Diamand
  0 siblings, 0 replies; 7+ messages in thread
From: Luke Diamand @ 2021-12-21 10:32 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Joel Holdsworth, Git Users, Tzadik Vanderhoof, Dorgon Chang,
	Joachim Kuebart, Daniel Levin, Johannes Schindelin, Ben Keene,
	Andrew Oakley

On Mon, 20 Dec 2021 at 19:38, Junio C Hamano <gitster@pobox.com> wrote:
>
> Joel Holdsworth <jholdsworth@nvidia.com> writes:
>
> > The git-p4 "delete" verb is described as "A tool to debug the output of
> > p4 -G". However, the implementation provided is of no useful benefit to
> > either users or developers.
>
> The same comment as 2/2 applies here, too.  This time, however, I
> think it would be much easier to give a proper analysis of what it
> is designed to do and what it does, to convince readers why it is
> too trivial to be worth having the code (compared to the PATCH 2/2).
>
> Also, this is not about the "delete" verb, but the "debug" verb, no?

I have never used the P4Debug subcommand for debugging git-p4, and I'm
not sure what I would use it for. Removing it seems sensible.

As noted by Junio, s/delete/debug/.

Luke

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-12-21 10:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-17 14:05 [PATCH v2 0/2] git-p4: remove "debug" and "rollback" verbs Joel Holdsworth
2021-12-17 14:05 ` [PATCH v2 1/2] git-p4: remove "delete" verb Joel Holdsworth
2021-12-20 19:38   ` Junio C Hamano
2021-12-21 10:32     ` Luke Diamand
2021-12-17 14:05 ` [PATCH v2 2/2] git-p4: remove "rollback" verb Joel Holdsworth
2021-12-20 19:32   ` Junio C Hamano
2021-12-20 21:19 ` [PATCH v2 0/2] git-p4: remove "debug" and "rollback" verbs Johannes Schindelin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.