mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 07:17:55 +03:00
41b41de101
Summary: Makes help text (e.g. the output of `hg help`) and strings that use the `_()` function use the identity of the current binary instead of using hardcoded strings for the name of the binary and the product. For the sake of clarity, replacements for `helptext.py` are done in D40165740 Most of the rename was done using sed + some manual edits. The regex strings for the rename were: - `"s/\(_(\".*\)\([^.]+\)hg\([^[:alpha:]\/]\)\(.*\")\)/\1\2@prog@\3\4/g"` - `"s/\(_(\".*\) hg \(.*\")\)/\1 prog@ \2/g"` - `"s/\(_(\".*\)\([^.]\)hg\([^\/[:alpha:]]\)\(.*\")\)/\1\2@prog@\3\4/g"` - `"s/\(_(\".*\)\([^.]\)hg\([^\/[:alpha:]]\)\(.*\")\)/\1\2@prog@\3\4/g"` - `"s/\(_(\".*\)\([^.]\)hg\([^\/[:alpha:]]\)\(.*\")\)/\1\2@prog@\3\4/g"` Reviewed By: bolinfest Differential Revision: D40162909 fbshipit-source-id: 34d92ef3e667caad278643690e69bd608fc9fdf9
38 lines
1.2 KiB
Python
38 lines
1.2 KiB
Python
# Portions Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
#
|
|
# This software may be used and distributed according to the terms of the
|
|
# GNU General Public License version 2.
|
|
|
|
# rewriteutil.py - utility functions for rewriting changesets
|
|
#
|
|
# Copyright 2017 Octobus <contact@octobus.net>
|
|
#
|
|
# This software may be used and distributed according to the terms of the
|
|
# GNU General Public License version 2 or any later version.
|
|
|
|
from __future__ import absolute_import
|
|
|
|
from . import error, node
|
|
from .i18n import _
|
|
|
|
|
|
def precheck(repo, revs, action="rewrite"):
|
|
"""check if revs can be rewritten
|
|
action is used to control the error message.
|
|
|
|
Make sure this function is called after taking the lock.
|
|
"""
|
|
if node.nullrev in revs:
|
|
msg = _("cannot %s null changeset") % action
|
|
hint = _("no changeset checked out")
|
|
raise error.Abort(msg, hint=hint)
|
|
|
|
publicrevs = repo.revs("%ld and public()", revs)
|
|
if len(repo[None].parents()) > 1:
|
|
raise error.Abort(_("cannot %s while merging") % action)
|
|
|
|
if publicrevs:
|
|
msg = _("cannot %s public changesets") % action
|
|
hint = _("see '@prog@ help phases' for details")
|
|
raise error.Abort(msg, hint=hint)
|