Skip to content

Commit 6607a8e

Browse files
committed
fix status display when on PR
1 parent e3a8243 commit 6607a8e

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

GSASII/GSASIIpath.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,7 @@ def getG2VersionInfo():
313313
delta = now - commit.committed_datetime
314314
age = delta.total_seconds()/(60*60*24.)
315315
msg = ''
316+
rc = None
316317
if g2repo.head.is_detached:
317318
msg = ("\n" +
318319
"**** You have reverted to a past version of GSAS-II. Please \n"
@@ -322,10 +323,10 @@ def getG2VersionInfo():
322323
else:
323324
msg = ''
324325
rc,lc,_ = gitCheckForUpdates(False,g2repo)
325-
if rc is None:
326-
msg += f"\n\tNo history found. On development branch? ({g2repo.active_branch})"
327-
elif str(g2repo.active_branch) != 'main':
328-
msg += f'\n\tUsing development branch: {g2repo.active_branch}'
326+
if str(g2repo.active_branch) != 'main':
327+
msg += f'\n\tUsing development branch: "{g2repo.active_branch}"'
328+
elif rc is None:
329+
msg += f"\n\tNo history found. On a development branch? ({g2repo.active_branch})"
329330
elif age > 60 and len(rc) > 0:
330331
msg += f"\n\t**** This version is really old ({age:.1f} days). Please update.\n\t**** At least {len(rc)} updates have been posted ****"
331332
elif (age > 5 and len(rc) > 0) or len(rc) > 5:
@@ -334,7 +335,9 @@ def getG2VersionInfo():
334335
# msg += f"\n\tThis GSAS-II version is ~{len(rc)} updates behind current."
335336
# could consider getting version & tag from gv if not None (see below)
336337
gversion = f"{GetVersionNumber()}/{GetVersionTag()}"
337-
if len(rc) > 0:
338+
if rc is None:
339+
return f" GSAS-II: {gversion} posted {ctim} (updates unknown) [{commit.hexsha[:8]}]{msg}"
340+
elif len(rc) > 0:
338341
return f" GSAS-II: {gversion} posted {ctim} (\u2265{len(rc)} new updates) [{commit.hexsha[:8]}]{msg}"
339342
else:
340343
return f" GSAS-II: {gversion} posted {ctim} (no new updates) [{commit.hexsha[:8]}]{msg}"

0 commit comments

Comments
 (0)