[gnome-continuous] vcs.js: Create revParse helper API
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-continuous] vcs.js: Create revParse helper API
- Date: Sun, 5 Jan 2014 20:11:26 +0000 (UTC)
commit 21cead73ca66df6db325942cf30f691073124d25
Author: Colin Walters <walters verbum org>
Date: Sun Jan 5 14:47:50 2014 -0500
vcs.js: Create revParse helper API
To unify some code.
src/js/vcs.js | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/src/js/vcs.js b/src/js/vcs.js
index 8ce104f..49a814d 100644
--- a/src/js/vcs.js
+++ b/src/js/vcs.js
@@ -232,6 +232,12 @@ function ensureVcsMirror(mirrordir, component, cancellable,
}
}
+function revParse(dirpath, branch, cancellable) {
+ let args = ['git', 'rev-parse', branch]
+ return ProcUtil.runSyncGetOutputUTF8(args, cancellable,
+ {cwd: dirpath}).replace(/[ \n]/g, '');
+}
+
function _ensureVcsMirrorGit(mirrordir, uri, branch, cancellable, params) {
let keytype = 'git';
let fetch = params.fetch;
@@ -277,9 +283,7 @@ function _ensureVcsMirrorGit(mirrordir, uri, branch, cancellable, params) {
}
}
- let currentVcsVersion = ProcUtil.runSyncGetOutputUTF8(['git', 'rev-parse', branch], cancellable,
- {cwd: mirror}).replace(/[ \n]/g, '');
-
+ let currentVcsVersion = revParse(mirror, branch, cancellable);
let changed = currentVcsVersion != lastFetchContents;
if (changed) {
print(Format.vprintf("last fetch %s differs from branch %s", [lastFetchContents,
currentVcsVersion]));
@@ -317,8 +321,7 @@ function _ensureVcsMirrorTarball(mirrordir, name, uri, checksum, cancellable, pa
}
let importTag = 'tarball-import-' + checksum;
- let gitRevision = ProcUtil.runSyncGetOutputUTF8StrippedOrNull(['git', 'rev-parse', importTag],
- cancellable, { cwd: mirror });
+ let gitRevision = revParse(mirror, importTag, cancellable);
if (gitRevision != null) {
return mirror;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]