0

我有一个希望能够为其创建补丁的 Web 应用程序。具体来说,我想创建补丁以在 Web 服务器中启用特定功能。

JAVA_OPTS="-Xms128m -Xmx256m $JAVA_OPTS -Djava.awt.headless=true -Datlassian.standalone=JIRA -Dorg.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER=true "

# Perm Gen size needs to be increased if encountering OutOfMemoryError: PermGen problems. Specifying PermGen size is not valid on IBM JDKs
PRGDIR=`dirname $0`
JIRA_MAX_PERM_SIZE=128m
if [ -f "${PRGDIR}/permgen.sh" ]; then
    echo "Detecting JVM PermGen support..."
. ${PRGDIR}/permgen.sh
if [ $JAVA_PERMGEN_SUPPORTED = "true" ]; then
    echo "PermGen switch is supported. Setting to ${JIRA_MAX_PERM_SIZE}"
    JAVA_OPTS="-XX:MaxPermSize=${JIRA_MAX_PERM_SIZE} ${JAVA_OPTS}"
    else
        echo "PermGen switch is NOT supported and will NOT be set automatically."
    fi
fi

# use this if you want to import data without notifications
#JAVA_OPTS=" -Datlassian.mail.senddisabled=true -Datlassian.mail.fetchdisabled=true -Datlassian.mail.popdisabled=true $JAVA_OPTS "

export JAVA_OPTS

echo "If you encounter issues starting up JIRA Standalone Edition, please see the Troubleshooting guide at http://confluence.atlassian.com/display/JIRA/Installation+Troubleshooting+Guide"

我想要做的是为我需要对该文件进行的每个单独修改保存一个补丁,以便可以单独应用补丁(使用 qpush -move)或一起应用(qpush -a)

我首先使用文件的干净版本尝试了以下操作:

hg qnew jmx.patch

然后我修改了文件的第一行以包含以下内容

-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8089 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false

然后刷新了补丁

hg qrefresh

弹出补丁以从干净的基础开始进行第二次修改

hg qpop
hg qnew jelly.patch

我修改了文件的第一行以包含以下内容

-Djira.jelly.on=true

然后刷新了补丁

然后当我尝试 qpush 较旧的补丁时,它未能应用。然后我尝试了另一种方法,即首先创建一个基础补丁:

hg qpop -a
hg qnew base.patch

,将以下内容添加到文件中

JMX_OPTS=
JELLY_OPTS=
JAVA_OPTS=" ${JAVA_OPTS} ${JELLY_OPTS} ${JMX_OPTS} "

,然后刷新base.patch

hg qrefresh

然后在仍应用 base.patch 的同时为 jmx 创建一个新补丁:

hg qnew jmx.new

编辑文件如下:

JMX_OPTS=" -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8089 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false "

刷新补丁并弹出:

hg qrefresh
hg qpop

为果冻创建新补丁:

hg qnew jelly.patch

编辑文件如下:

JELLY_OPTS=" -Djira.jelly.on=true "

刷新了补丁:

hg qrefresh

但同样,当我尝试将 jmx.patch qpush 到新创建的 jelly.patch 之上时,出现了冲突。

我认为 Mercurial 的行为符合预期,但我想知道我是否可以以不同的方式构建我正在制作的补丁,以便它们可以单独应用或组合使用而不会被拒绝

4

1 回答 1

1

如果您在要更改的行之间插入至少 3 个空行,则第二种方法将起作用。

你也可以打乱你的队列(在 qpop 之后!),先应用 jmx,然后再应用 jelly。您将获得“偏移 x 行”,但该文件将被正确修补。

MQ 有一个硬编码的 fuzz 编号 3(参见 参考资料patchfile()patch.py。当您在相邻的行中有您的JMX_OPTSJELLY_OPTS时,MQ 无法在 jmx.patch 中找到上下文,因为它在 jelly.patch 中已更改。

于 2010-09-03T18:56:25.533 回答