]> git.scottworley.com Git - pinch/blobdiff - pinch.py
Formatting
[pinch] / pinch.py
index 80e631b9b4001574693887a13a40b022969ff333..b3f65c69b9f8c9a943f150c3d99b61e90e465fa5 100644 (file)
--- a/pinch.py
+++ b/pinch.py
@@ -243,7 +243,9 @@ def git_fetch(v: Verification, channel: Channel) -> None:
         have_rev = process.returncode == 0
 
     if not have_rev:
         have_rev = process.returncode == 0
 
     if not have_rev:
-        v.status('Fetching ref "%s" from %s' % (channel.git_ref, channel.git_repo))
+        v.status(
+            'Fetching ref "%s" from %s' %
+            (channel.git_ref, channel.git_repo))
         # We don't use --force here because we want to abort and freak out if forced
         # updates are happening.
         process = subprocess.run(['git',
         # We don't use --force here because we want to abort and freak out if forced
         # updates are happening.
         process = subprocess.run(['git',
@@ -278,6 +280,19 @@ def git_fetch(v: Verification, channel: Channel) -> None:
                               channel.git_ref])
     v.result(process.returncode == 0)
 
                               channel.git_ref])
     v.result(process.returncode == 0)
 
+    if hasattr(channel, 'old_git_revision'):
+        v.status(
+            'Verifying rev is an ancestor of previous rev %s' %
+            channel.old_git_revision)
+        process = subprocess.run(['git',
+                                  '-C',
+                                  channel.git_cachedir,
+                                  'merge-base',
+                                  '--is-ancestor',
+                                  channel.old_git_revision,
+                                  channel.git_revision])
+        v.result(process.returncode == 0)
+
 
 def compare_tarball_and_git(
         v: Verification,
 
 def compare_tarball_and_git(
         v: Verification,