From dd7f18aaf2f1cb85e0782541256c3ff6ddb71f31 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Thu, 17 Dec 2015 20:00:48 +0100 Subject: [PATCH] lib: Always use "branch" not "version" in API "version" is really confusin --- lib/test-lib.c | 14 +++++++------- lib/xdg-app-installation.c | 32 ++++++++++++++++---------------- lib/xdg-app-installation.h | 8 ++++---- lib/xdg-app-installed-ref.c | 4 ++-- lib/xdg-app-ref.c | 24 ++++++++++++------------ lib/xdg-app-ref.h | 2 +- lib/xdg-app-remote-ref.c | 2 +- lib/xdg-app-remote.c | 12 ++++++------ lib/xdg-app-remote.h | 2 +- 9 files changed, 50 insertions(+), 50 deletions(-) diff --git a/lib/test-lib.c b/lib/test-lib.c index 2e4448796..7464a2692 100644 --- a/lib/test-lib.c +++ b/lib/test-lib.c @@ -76,7 +76,7 @@ main (int argc, char *argv[]) xdg_app_ref_get_kind (XDG_APP_REF(ref)), xdg_app_ref_get_name (XDG_APP_REF(ref)), xdg_app_ref_get_arch (XDG_APP_REF(ref)), - xdg_app_ref_get_version (XDG_APP_REF(ref)), + xdg_app_ref_get_branch (XDG_APP_REF(ref)), xdg_app_ref_get_commit (XDG_APP_REF(ref)), xdg_app_installed_ref_get_origin (ref), xdg_app_installed_ref_get_deploy_dir (ref), @@ -100,7 +100,7 @@ main (int argc, char *argv[]) xdg_app_ref_get_kind (XDG_APP_REF(app)), xdg_app_ref_get_name (XDG_APP_REF(app)), xdg_app_ref_get_arch (XDG_APP_REF(app)), - xdg_app_ref_get_version (XDG_APP_REF(app)), + xdg_app_ref_get_branch (XDG_APP_REF(app)), xdg_app_ref_get_commit (XDG_APP_REF(app)), xdg_app_installed_ref_get_origin (app), xdg_app_installed_ref_get_deploy_dir (app), @@ -124,7 +124,7 @@ main (int argc, char *argv[]) xdg_app_ref_get_kind (XDG_APP_REF(runtime)), xdg_app_ref_get_name (XDG_APP_REF(runtime)), xdg_app_ref_get_arch (XDG_APP_REF(runtime)), - xdg_app_ref_get_version (XDG_APP_REF(runtime)), + xdg_app_ref_get_branch (XDG_APP_REF(runtime)), xdg_app_ref_get_commit (XDG_APP_REF(runtime)), xdg_app_installed_ref_get_origin (runtime), xdg_app_installed_ref_get_deploy_dir (runtime), @@ -143,7 +143,7 @@ main (int argc, char *argv[]) xdg_app_ref_get_kind (XDG_APP_REF(app1)), xdg_app_ref_get_name (XDG_APP_REF(app1)), xdg_app_ref_get_arch (XDG_APP_REF(app1)), - xdg_app_ref_get_version (XDG_APP_REF(app1)), + xdg_app_ref_get_branch (XDG_APP_REF(app1)), xdg_app_ref_get_commit (XDG_APP_REF(app1)), xdg_app_installed_ref_get_origin (app1), xdg_app_installed_ref_get_deploy_dir (app1), @@ -160,7 +160,7 @@ main (int argc, char *argv[]) xdg_app_ref_get_kind (XDG_APP_REF(app2)), xdg_app_ref_get_name (XDG_APP_REF(app2)), xdg_app_ref_get_arch (XDG_APP_REF(app2)), - xdg_app_ref_get_version (XDG_APP_REF(app2)), + xdg_app_ref_get_branch (XDG_APP_REF(app2)), xdg_app_ref_get_commit (XDG_APP_REF(app2)), xdg_app_installed_ref_get_origin (app2), xdg_app_installed_ref_get_deploy_dir (app2), @@ -192,7 +192,7 @@ main (int argc, char *argv[]) xdg_app_ref_get_kind (XDG_APP_REF(ref)), xdg_app_ref_get_name (XDG_APP_REF(ref)), xdg_app_ref_get_arch (XDG_APP_REF(ref)), - xdg_app_ref_get_version (XDG_APP_REF(ref)), + xdg_app_ref_get_branch (XDG_APP_REF(ref)), xdg_app_ref_get_commit (XDG_APP_REF(ref)), xdg_app_remote_ref_get_remote_name (ref)); } @@ -212,7 +212,7 @@ main (int argc, char *argv[]) xdg_app_ref_get_kind (XDG_APP_REF(remote_ref)), xdg_app_ref_get_name (XDG_APP_REF(remote_ref)), xdg_app_ref_get_arch (XDG_APP_REF(remote_ref)), - xdg_app_ref_get_version (XDG_APP_REF(remote_ref)), + xdg_app_ref_get_branch (XDG_APP_REF(remote_ref)), xdg_app_ref_get_commit (XDG_APP_REF(remote_ref)), xdg_app_remote_ref_get_remote_name (remote_ref)); diff --git a/lib/xdg-app-installation.c b/lib/xdg-app-installation.c index ee0b29ffa..f8f04847f 100644 --- a/lib/xdg-app-installation.c +++ b/lib/xdg-app-installation.c @@ -182,7 +182,7 @@ get_ref (XdgAppInstallation *self, * @kind: ... * @name: ... * @arch: ... - * @version: ... + * @branch: ... * @cancellable: (nullable): a #GCancellable * @error: return location for a #GError * @@ -195,7 +195,7 @@ xdg_app_installation_get_installed_ref (XdgAppInstallation *self, XdgAppRefKind kind, const char *name, const char *arch, - const char *version, + const char *branch, GCancellable *cancellable, GError **error) { @@ -207,9 +207,9 @@ xdg_app_installation_get_installed_ref (XdgAppInstallation *self, arch = xdg_app_get_arch (); if (kind == XDG_APP_REF_KIND_APP) - ref = xdg_app_build_app_ref (name, version, arch); + ref = xdg_app_build_app_ref (name, branch, arch); else - ref = xdg_app_build_runtime_ref (name, version, arch); + ref = xdg_app_build_runtime_ref (name, branch, arch); deploy = xdg_app_dir_get_if_deployed (priv->dir, @@ -513,7 +513,7 @@ xdg_app_installation_install (XdgAppInstallation *self, XdgAppRefKind kind, const char *name, const char *arch, - const char *version, + const char *branch, XdgAppProgressCallback progress, gpointer progress_data, GCancellable *cancellable, @@ -530,7 +530,7 @@ xdg_app_installation_install (XdgAppInstallation *self, g_autoptr(GError) local_error = NULL; g_auto(GLnxLockFile) lock = GLNX_LOCK_FILE_INIT; - ref = xdg_app_compose_ref (kind == XDG_APP_REF_KIND_APP, name, version, arch, error); + ref = xdg_app_compose_ref (kind == XDG_APP_REF_KIND_APP, name, branch, arch, error); if (ref == NULL) return NULL; @@ -539,7 +539,7 @@ xdg_app_installation_install (XdgAppInstallation *self, { g_set_error (error, XDG_APP_ERROR, XDG_APP_ERROR_ALREADY_INSTALLED, - "%s branch %s already installed", name, version ? version : "master"); + "%s branch %s already installed", name, branch ? branch : "master"); goto out; } @@ -570,7 +570,7 @@ xdg_app_installation_install (XdgAppInstallation *self, if (g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_EXISTS)) g_set_error (error, XDG_APP_ERROR, XDG_APP_ERROR_ALREADY_INSTALLED, - "%s branch %s already installed", name, version ? version : "master"); + "%s branch %s already installed", name, branch ? branch : "master"); else g_propagate_error (error, g_steal_pointer (&local_error)); goto out; @@ -624,7 +624,7 @@ xdg_app_installation_update (XdgAppInstallation *self, XdgAppRefKind kind, const char *name, const char *arch, - const char *version, + const char *branch, XdgAppProgressCallback progress, gpointer progress_data, GCancellable *cancellable, @@ -641,7 +641,7 @@ xdg_app_installation_update (XdgAppInstallation *self, gboolean was_updated; g_auto(GLnxLockFile) lock = GLNX_LOCK_FILE_INIT; - ref = xdg_app_compose_ref (kind == XDG_APP_REF_KIND_APP, name, version, arch, error); + ref = xdg_app_compose_ref (kind == XDG_APP_REF_KIND_APP, name, branch, arch, error); if (ref == NULL) return NULL; @@ -650,7 +650,7 @@ xdg_app_installation_update (XdgAppInstallation *self, { g_set_error (error, XDG_APP_ERROR, XDG_APP_ERROR_NOT_INSTALLED, - "%s branch %s is not installed", name, version ? version : "master"); + "%s branch %s is not installed", name, branch ? branch : "master"); return NULL; } @@ -684,7 +684,7 @@ xdg_app_installation_update (XdgAppInstallation *self, { g_set_error (error, XDG_APP_ERROR, XDG_APP_ERROR_NOT_INSTALLED, - "%s branch %s is not installed", name, version ? version : "master"); + "%s branch %s is not installed", name, branch ? branch : "master"); return NULL; } @@ -732,7 +732,7 @@ xdg_app_installation_uninstall (XdgAppInstallation *self, XdgAppRefKind kind, const char *name, const char *arch, - const char *version, + const char *branch, XdgAppProgressCallback progress, gpointer progress_data, GCancellable *cancellable, @@ -747,7 +747,7 @@ xdg_app_installation_uninstall (XdgAppInstallation *self, gboolean was_deployed = FALSE; g_auto(GLnxLockFile) lock = GLNX_LOCK_FILE_INIT; - ref = xdg_app_compose_ref (kind == XDG_APP_REF_KIND_APP, name, version, arch, error); + ref = xdg_app_compose_ref (kind == XDG_APP_REF_KIND_APP, name, branch, arch, error); if (ref == NULL) return FALSE; @@ -760,7 +760,7 @@ xdg_app_installation_uninstall (XdgAppInstallation *self, { g_set_error (error, XDG_APP_ERROR, XDG_APP_ERROR_NOT_INSTALLED, - "%s branch %s is not installed", name, version ? version : "master"); + "%s branch %s is not installed", name, branch ? branch : "master"); return FALSE; } @@ -803,7 +803,7 @@ xdg_app_installation_uninstall (XdgAppInstallation *self, { g_set_error (error, XDG_APP_ERROR, XDG_APP_ERROR_NOT_INSTALLED, - "%s branch %s is not installed", name, version ? version : "master"); + "%s branch %s is not installed", name, branch ? branch : "master"); return FALSE; } diff --git a/lib/xdg-app-installation.h b/lib/xdg-app-installation.h index 249234b97..46ca68432 100644 --- a/lib/xdg-app-installation.h +++ b/lib/xdg-app-installation.h @@ -72,7 +72,7 @@ XDG_APP_EXTERN XdgAppInstalledRef * xdg_app_installation_get_installed_ref XdgAppRefKind kind, const char *name, const char *arch, - const char *version, + const char *branch, GCancellable *cancellable, GError **error); XDG_APP_EXTERN XdgAppInstalledRef * xdg_app_installation_get_current_installed_app (XdgAppInstallation *self, @@ -91,7 +91,7 @@ XDG_APP_EXTERN XdgAppInstalledRef * xdg_app_installation_install XdgAppRefKind kind, const char *name, const char *arch, - const char *version, + const char *branch, XdgAppProgressCallback progress, gpointer progress_data, GCancellable *cancellable, @@ -100,7 +100,7 @@ XDG_APP_EXTERN XdgAppInstalledRef * xdg_app_installation_update XdgAppRefKind kind, const char *name, const char *arch, - const char *version, + const char *branch, XdgAppProgressCallback progress, gpointer progress_data, GCancellable *cancellable, @@ -109,7 +109,7 @@ XDG_APP_EXTERN gboolean xdg_app_installation_uninstall XdgAppRefKind kind, const char *name, const char *arch, - const char *version, + const char *branch, XdgAppProgressCallback progress, gpointer progress_data, GCancellable *cancellable, diff --git a/lib/xdg-app-installed-ref.c b/lib/xdg-app-installed-ref.c index 494ac9542..63e6cf31d 100644 --- a/lib/xdg-app-installed-ref.c +++ b/lib/xdg-app-installed-ref.c @@ -217,7 +217,7 @@ xdg_app_installed_ref_launch (XdgAppInstalledRef *self, app_ref = xdg_app_build_app_ref (xdg_app_ref_get_name (XDG_APP_REF (self)), - xdg_app_ref_get_version (XDG_APP_REF (self)), + xdg_app_ref_get_branch (XDG_APP_REF (self)), xdg_app_ref_get_arch (XDG_APP_REF (self))); @@ -261,7 +261,7 @@ xdg_app_installed_ref_new (const char *full_ref, "kind", kind, "name", parts[1], "arch", parts[2], - "version", parts[3], + "branch", parts[3], "commit", commit, "origin", origin, "current", current, diff --git a/lib/xdg-app-ref.c b/lib/xdg-app-ref.c index 392d7f697..05282c54a 100644 --- a/lib/xdg-app-ref.c +++ b/lib/xdg-app-ref.c @@ -30,7 +30,7 @@ struct _XdgAppRefPrivate { char *name; char *arch; - char *version; + char *branch; char *commit; XdgAppRefKind kind; }; @@ -42,7 +42,7 @@ enum { PROP_NAME, PROP_ARCH, - PROP_VERSION, + PROP_BRANCH, PROP_COMMIT, PROP_KIND }; @@ -55,7 +55,7 @@ xdg_app_ref_finalize (GObject *object) g_free (priv->name); g_free (priv->arch); - g_free (priv->version); + g_free (priv->branch); g_free (priv->commit); G_OBJECT_CLASS (xdg_app_ref_parent_class)->finalize (object); @@ -82,9 +82,9 @@ xdg_app_ref_set_property (GObject *object, priv->arch = g_value_dup_string (value); break; - case PROP_VERSION: - g_clear_pointer (&priv->version, g_free); - priv->version = g_value_dup_string (value); + case PROP_BRANCH: + g_clear_pointer (&priv->branch, g_free); + priv->branch = g_value_dup_string (value); break; case PROP_COMMIT: @@ -121,8 +121,8 @@ xdg_app_ref_get_property (GObject *object, g_value_set_string (value, priv->arch); break; - case PROP_VERSION: - g_value_set_string (value, priv->version); + case PROP_BRANCH: + g_value_set_string (value, priv->branch); break; case PROP_COMMIT: @@ -163,8 +163,8 @@ xdg_app_ref_class_init (XdgAppRefClass *klass) NULL, G_PARAM_READWRITE)); g_object_class_install_property (object_class, - PROP_VERSION, - g_param_spec_string ("version", + PROP_BRANCH, + g_param_spec_string ("branch", "", "", NULL, @@ -211,11 +211,11 @@ xdg_app_ref_get_arch (XdgAppRef *self) } const char * -xdg_app_ref_get_version (XdgAppRef *self) +xdg_app_ref_get_branch (XdgAppRef *self) { XdgAppRefPrivate *priv = xdg_app_ref_get_instance_private (self); - return priv->version; + return priv->branch; } const char * diff --git a/lib/xdg-app-ref.h b/lib/xdg-app-ref.h index 59c417154..1d160b187 100644 --- a/lib/xdg-app-ref.h +++ b/lib/xdg-app-ref.h @@ -55,7 +55,7 @@ typedef enum { XDG_APP_EXTERN const char * xdg_app_ref_get_name (XdgAppRef *self); XDG_APP_EXTERN const char * xdg_app_ref_get_arch (XdgAppRef *self); -XDG_APP_EXTERN const char * xdg_app_ref_get_version (XdgAppRef *self); +XDG_APP_EXTERN const char * xdg_app_ref_get_branch (XdgAppRef *self); XDG_APP_EXTERN const char * xdg_app_ref_get_commit (XdgAppRef *self); XDG_APP_EXTERN XdgAppRefKind xdg_app_ref_get_kind (XdgAppRef *self); diff --git a/lib/xdg-app-remote-ref.c b/lib/xdg-app-remote-ref.c index 51d0ec698..c175d6d39 100644 --- a/lib/xdg-app-remote-ref.c +++ b/lib/xdg-app-remote-ref.c @@ -171,7 +171,7 @@ xdg_app_remote_ref_new (const char *full_ref, "kind", kind, "name", parts[1], "arch", parts[2], - "version", parts[3], + "branch", parts[3], "commit", commit, "remote-name", remote_name, NULL); diff --git a/lib/xdg-app-remote.c b/lib/xdg-app-remote.c index a2faf1ff9..99591a121 100644 --- a/lib/xdg-app-remote.c +++ b/lib/xdg-app-remote.c @@ -220,7 +220,7 @@ xdg_app_remote_list_refs_sync (XdgAppRemote *self, * @cancellable: (nullable): a #GCancellable * @error: return location for a #GError * - * Gets the current remote version of a ref in the #XdgAppRemote. + * Gets the current remote branch of a ref in the #XdgAppRemote. * * Returns: (transfer full): a #XdgAppRemoteRef instance, or %NULL */ @@ -229,7 +229,7 @@ xdg_app_remote_fetch_ref_sync (XdgAppRemote *self, XdgAppRefKind kind, const char *name, const char *arch, - const char *version, + const char *branch, GCancellable *cancellable, GError **error) { @@ -238,8 +238,8 @@ xdg_app_remote_fetch_ref_sync (XdgAppRemote *self, g_autofree char *ref = NULL; const char *checksum; - if (version == NULL) - version = "master"; + if (branch == NULL) + branch = "master"; if (!xdg_app_dir_list_remote_refs (priv->dir, priv->name, @@ -250,11 +250,11 @@ xdg_app_remote_fetch_ref_sync (XdgAppRemote *self, if (kind == XDG_APP_REF_KIND_APP) ref = xdg_app_build_app_ref (name, - version, + branch, arch); else ref = xdg_app_build_runtime_ref (name, - version, + branch, arch); checksum = g_hash_table_lookup (ht, ref); diff --git a/lib/xdg-app-remote.h b/lib/xdg-app-remote.h index 61186db08..4af9d24c5 100644 --- a/lib/xdg-app-remote.h +++ b/lib/xdg-app-remote.h @@ -61,7 +61,7 @@ XDG_APP_EXTERN XdgAppRemoteRef *xdg_app_remote_fetch_ref_sync (XdgAppRemote * XdgAppRefKind kind, const char *name, const char *arch, - const char *version, + const char *branch, GCancellable *cancellable, GError **error);