[jhbuild] Add '-dirty' suffix to tree_id if dirty



commit e6590805cb9a12446545d3ac40942ec1dbfd2b27
Author: Dirk Wallenstein <halsmit t-online de>
Date:   Mon Jul 5 16:13:59 2010 +0200

    Add '-dirty' suffix to tree_id if dirty
    
    There has to be a way to identify a dirty git worktree in the tree_id. Otherwise
    the build_policy would falsely assume an up-to-date tree when returning to HEAD.
    A dirty tree is always build, no matter what the tree_id is.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=623662

 jhbuild/versioncontrol/git.py |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/jhbuild/versioncontrol/git.py b/jhbuild/versioncontrol/git.py
index 9c7001e..6162de9 100644
--- a/jhbuild/versioncontrol/git.py
+++ b/jhbuild/versioncontrol/git.py
@@ -123,6 +123,8 @@ class GitRepository(Repository):
 class GitBranch(Branch):
     """A class representing a GIT branch."""
 
+    dirty_branch_suffix = '-dirty'
+
     def __init__(self, repository, module, subdir, checkoutdir=None,
                  branch=None, tag=None, unmirrored_module=None):
         Branch.__init__(self, repository, module, checkoutdir)
@@ -439,7 +441,10 @@ class GitBranch(Branch):
             return None
         except GitUnknownBranchNameError:
             return None
-        return output.strip()
+        id_suffix = ''
+        if self.is_dirty():
+            id_suffix = self.dirty_branch_suffix
+        return output.strip() + id_suffix
 
     def to_sxml(self):
         attrs = {}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]