git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2 2/2] git-p4: remove "rollback" verb

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 20, 2021, 19:32 UTC
Message-ID
<xmqqlf0fvzrf.fsf@gitster.g>
In-Reply-To
<20211217140547.2115095-3-jholdsworth@nvidia.com>
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.
Show 85 quoted lines
> 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,
>  }
Previous: Joel HoldsworthNext: Johannes Schindelin
Message 6 of 7 in “git-p4: remove "debug" and "rollback" verbs”
  1. 0/2 git-p4: remove "debug" and "rollback" verbsJoel Holdsworth, Dec 17, 2021
  2. 1/2 git-p4: remove "delete" verbJoel Holdsworth, Dec 17, 2021
  3. Junio C HamanoDec 20, 2021
  4. Luke DiamandDec 21, 2021
  5. 2/2 git-p4: remove "rollback" verbJoel Holdsworth, Dec 17, 2021
  6. Junio C HamanoDec 20, 2021
  7. Johannes SchindelinDec 20, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.