diff --git a/poky/meta/classes/metadata_scm.bbclass b/poky/meta/classes/metadata_scm.bbclass
index fa791f0..58bb4c5 100644
--- a/poky/meta/classes/metadata_scm.bbclass
+++ b/poky/meta/classes/metadata_scm.bbclass
@@ -3,55 +3,15 @@
 
 def base_detect_revision(d):
     path = base_get_scmbasepath(d)
-
-    scms = [base_get_metadata_git_revision]
-
-    for scm in scms:
-        rev = scm(path, d)
-        if rev != "<unknown>":
-            return rev
-
-    return "<unknown>"
+    return base_get_metadata_git_revision(path, d)
 
 def base_detect_branch(d):
     path = base_get_scmbasepath(d)
-
-    scms = [base_get_metadata_git_branch]
-
-    for scm in scms:
-        rev = scm(path, d)
-        if rev != "<unknown>":
-            return rev.strip()
-
-    return "<unknown>"
+    return base_get_metadata_git_branch(path, d)
 
 def base_get_scmbasepath(d):
     return os.path.join(d.getVar('COREBASE'), 'meta')
 
-def base_get_metadata_monotone_branch(path, d):
-    monotone_branch = "<unknown>"
-    try:
-        with open("%s/_MTN/options" % path) as f:
-            monotone_branch = f.read().strip()
-            if monotone_branch.startswith( "database" ):
-                monotone_branch_words = monotone_branch.split()
-                monotone_branch = monotone_branch_words[ monotone_branch_words.index( "branch" )+1][1:-1]
-    except:
-        pass
-    return monotone_branch
-
-def base_get_metadata_monotone_revision(path, d):
-    monotone_revision = "<unknown>"
-    try:
-        with open("%s/_MTN/revision" % path) as f:
-            monotone_revision = f.read().strip()
-            if monotone_revision.startswith( "format_version" ):
-                monotone_revision_words = monotone_revision.split()
-                monotone_revision = monotone_revision_words[ monotone_revision_words.index( "old_revision" )+1][1:-1]
-    except IOError:
-        pass
-    return monotone_revision
-
 def base_get_metadata_svn_revision(path, d):
     # This only works with older subversion. For newer versions 
     # this function will need to be fixed by someone interested
