rebase: allow rebasing to a local branch
This is a follow-up to commit 77acf62
. There, we added support for
rebasing from a local branch to another local branch. But in testing,
it's also really useful to be able to rebase from a remote-based refspec
to a local branch. We allow this here by slightly expanding the syntax
of allowed refspecs.
Now, we can use rpm-ostree all the time rather than fallback to `ostree
admin deploy`, which isn't pkg-aware.
Closes: #764
Approved by: cgwalters
This commit is contained in:
parent
a54efdff8a
commit
752368eb5b
@ -247,9 +247,11 @@ Boston, MA 02111-1307, USA.
|
|||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
The full syntax is <literal>rebase REMOTENAME:BRANCHNAME</literal>.
|
The full syntax is <literal>rebase REMOTENAME:BRANCHNAME</literal>.
|
||||||
It is also possible to specify just <literal>BRANCHNAME</literal>,
|
Specifying just <literal>BRANCHNAME</literal> will reuse the same
|
||||||
reusing the same remote, as well as using <literal>REMOTENAME:</literal>,
|
remote. You may also omit one of <literal>REMOTENAME</literal> or
|
||||||
which will use the same branch on a different remote.
|
<literal>BRANCHNAME</literal> (keeping the colon). In the former
|
||||||
|
case, the branch refers to a local branch; in the latter case, the
|
||||||
|
same branch will be used on a different remote.
|
||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
@ -137,12 +137,19 @@ rpmostreed_refspec_parse_partial (const gchar *new_provided_refspec,
|
|||||||
|
|
||||||
g_autofree gchar *ref = NULL;
|
g_autofree gchar *ref = NULL;
|
||||||
g_autofree gchar *remote = NULL;
|
g_autofree gchar *remote = NULL;
|
||||||
|
gboolean infer_remote = TRUE;;
|
||||||
|
|
||||||
/* Allow just switching remotes */
|
/* Allow just switching remotes */
|
||||||
if (g_str_has_suffix (new_provided_refspec, ":"))
|
if (g_str_has_suffix (new_provided_refspec, ":"))
|
||||||
{
|
{
|
||||||
remote = g_strndup (new_provided_refspec, strlen(new_provided_refspec)-1);
|
remote = g_strndup (new_provided_refspec, strlen(new_provided_refspec)-1);
|
||||||
}
|
}
|
||||||
|
/* Allow switching to a local branch */
|
||||||
|
else if (g_str_has_prefix (new_provided_refspec, ":"))
|
||||||
|
{
|
||||||
|
infer_remote = FALSE;
|
||||||
|
ref = g_strdup (new_provided_refspec + 1);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_autoptr(GError) parse_error = NULL;
|
g_autoptr(GError) parse_error = NULL;
|
||||||
@ -186,7 +193,7 @@ rpmostreed_refspec_parse_partial (const gchar *new_provided_refspec,
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (remote == NULL)
|
else if (infer_remote && remote == NULL)
|
||||||
{
|
{
|
||||||
if (origin_remote)
|
if (origin_remote)
|
||||||
{
|
{
|
||||||
|
@ -24,7 +24,7 @@ export RPMOSTREE_SUPPRESS_REQUIRES_ROOT_CHECK=yes
|
|||||||
|
|
||||||
ensure_dbus
|
ensure_dbus
|
||||||
|
|
||||||
echo "1..19"
|
echo "1..21"
|
||||||
|
|
||||||
setup_os_repository "archive-z2" "syslinux"
|
setup_os_repository "archive-z2" "syslinux"
|
||||||
|
|
||||||
@ -148,6 +148,15 @@ $OSTREE remote add secureos file://$(pwd)/testos-repo
|
|||||||
rpm-ostree rebase --os=testos secureos:$branch gpg-signed
|
rpm-ostree rebase --os=testos secureos:$branch gpg-signed
|
||||||
echo "ok deploy from remote with unsigned and signed commits"
|
echo "ok deploy from remote with unsigned and signed commits"
|
||||||
|
|
||||||
|
rpm-ostree rebase --os=testos :$branch
|
||||||
|
assert_status_jq '.deployments[0].origin|startswith("testos/")'
|
||||||
|
echo "ok rebase from refspec with remote to local branch"
|
||||||
|
|
||||||
|
$OSTREE commit -b another-branch --tree=ref=$branch
|
||||||
|
rpm-ostree rebase --os=testos another-branch
|
||||||
|
assert_status_jq '.deployments[0].origin == "another-branch"'
|
||||||
|
echo "ok rebase from local branch to local branch"
|
||||||
|
|
||||||
originpath=$(ostree admin --sysroot=sysroot --print-current-dir).origin
|
originpath=$(ostree admin --sysroot=sysroot --print-current-dir).origin
|
||||||
echo "unconfigured-state=Access to TestOS requires ONE BILLION DOLLARS" >> ${originpath}
|
echo "unconfigured-state=Access to TestOS requires ONE BILLION DOLLARS" >> ${originpath}
|
||||||
rpm-ostree reload
|
rpm-ostree reload
|
||||||
|
Loading…
Reference in New Issue
Block a user