Determine the current revision identifier for the working directory
        of this Repository

        Returns:
            str: revision identifier (``hg -q id -i``)
970836
def current_id(self):
        
        cmd = ['hg', '-q', 'id', '-i']
        return self.sh(cmd, shell=False).rstrip().rstrip('+')
536161
def get_changeset(self, revision=None):
        
        revision = self._get_revision(revision)
        changeset = MercurialChangeset(repository=self, revision=revision)
        return changeset
1370568
def pi_revision():
    """"""
    # Revision list available at: http://elinux.org/RPi_HardwareHistory#Board_Revision_History
    with open('/proc/cpuinfo', 'r') as infile:
        for line in infile:
            # Match a line of the form "Revision : 0002" while ignoring extra
            # info in front of the revsion (like 1000 when the Pi was over-volted).
            match = re.match('Revision\s+:\s+.*(\w{4})$', line, flags=re.IGNORECASE)
            if match and match.group(1) in ['0000', '0002', '0003']:
                # Return revision 1 if revision ends with 0000, 0002 or 0003.
                return 1
            elif match:
                # Assume revision 2 if revision ends with any other 4 chars.
                return 2
        # Couldn't find the revision, throw an exception.
        raise RuntimeError('Could not determine Raspberry Pi revision.')
61239
def threadid(self):
        
        current = self.thread.ident
        main = get_main_thread()
        if main is None:
            return current
        else:
            return current if current != main.ident else None
1217799
def get_kgXref_hg19(self):
        
        if self._kgXref_hg19 is None:
            self._kgXref_hg19 = self._load_kgXref(self._get_path_kgXref_hg19())

        return self._kgXref_hg19
673003
function() {

        var _this = this,
            base = this.__base();

        if (this.revision === 'HEAD') return base;

        return Q.all(this.paths.map(function(path) {
                return QFS.exists(PATH.resolve(_this.root, _this.target, path))
                    .then(function(exists) {
                        return exists && _this.getInfo(path)
                            .then(function(info) {
                                return String(info.revision) === String(_this.revision);
                            });
                });

            }))
            .then(function(checks) {

                return checks.reduce(function(cur, prev) {
                    return cur && prev;
                }, true) || base;

            });

    }
127378
def restore_revision(id, revision_number)
      revision_record = revision(id, revision_number)
      return revision_record.restore if revision_record
    end
203016
def find_revision_id(self, revision=None):
        """"""
        # Make sure the local repository exists.
        self.create()
        # Try to find the revision id of the specified revision.
        revision = revision or self.default_revision
        output = self.context.capture(
            'bzr', 'version-info', '--revision=%s' % revision,
            '--custom', '--template={revision_id}',
        )
        # Validate the `bzr version-info' output.
        if not output:
            msg = "Failed to find global revision id! ('bzr version-info' gave unexpected output)"
            raise ValueError(msg)
        return output
679427
def identify(directory)
      raw = json(directory)

      dependencies = raw['dependencies'].to_h

      dependency_sources =
        raw['dependency-sources']
        .to_h
        .merge(@dependency_sources)

      dependencies.map do |package, constraint|
        constraints = Utils.transform_constraint constraint

        type =
          if dependency_sources.key?(package)
            source = dependency_sources[package]
            case source
            when Hash
              uri_type source['url'], Branch::Just(source['ref'])
            when String
              if File.exist?(source)
                Type::Directory(Pathname.new(source))
              else
                uri_type source, Branch::Just('master')
              end
            end
          else
            Type::Git(Uri::Github(package), Branch::Nothing())
          end

        type.source.identifier = self
        type.source.options = @options

        Dependency.new(package, type.source, constraints)
      end
    end
676992
def get_review_sh(self, revision, item):
        

        identity = self.get_sh_identity(revision)
        update = parser.parse(item[self.get_field_date()])
        erevision = self.get_item_sh_fields(identity, update)

        return erevision
1013612
def identify_repo(repo_url):
    
    repo_url_values = repo_url.split('+')
    if len(repo_url_values) == 2:
        repo_type = repo_url_values[0]
        if repo_type in ["git", "hg"]:
            return repo_type, repo_url_values[1]
        else:
            raise UnknownRepoType
    else:
        if 'git' in repo_url:
            return 'git', repo_url
        elif 'bitbucket' in repo_url:
            return 'hg', repo_url
        else:
            raise UnknownRepoType
1368225
def from_git_rev_read(path):
    """"""
    if ":" not in path:
        raise ValueError("Path identifier must start with a revision hash.")

    cmd = "git", "show", "-t", path
    try:
        return subprocess.check_output(cmd).rstrip().decode("utf-8")
    except subprocess.CalledProcessError:
        raise ValueError
747470
def _svn_revision(filename):
  
  p = subprocess.Popen(['svn', 'status', '-v', filename],
             stdout=subprocess.PIPE,
             stderr=subprocess.PIPE)
  (stdout, stderr) = p.communicate()
  if p.returncode != 0 or stderr or not stdout:
    raise ValueError('Error determining svn_revision for %s: %s' %
             (os.path.split(filename)[1], textwrap.fill(stderr)))
  return stdout.split()[2]
375617
def get_jpp_revision(via_command='JPrint'):
    """"""
    try:
        output = subprocess.check_output([via_command, '-v'],
                                         stderr=subprocess.STDOUT)
    except subprocess.CalledProcessError as e:
        if e.returncode == 1:
            output = e.output
        else:
            return None
    except OSError:
        return None
    revision = output.decode().split('\n')[0].split()[1].strip()
    return revision
1174647
def version_str(self):
        
        vs = str(self.release)
        if self.tag is not None:
            vs += '@{t}'.format(t=self.tag)
        elif self.commit is not None:
            vs += '@{c}'.format(c=self.commit)
        return vs
135658
public static long getRevisionNumber(ModuleIdentifier revisionId) {
        int revision;
        try {
            revision = Integer.parseInt(revisionId.getSlot());
        } catch (NumberFormatException nf) {
            revision = -1;
        }
        return revision;
    }
1222656
def _isRepositoryReady(self):
        """"""
        return os.path.exists(os.path.join(self._absWorkdir(), '.hg'))