Returns (remote, branch) tuple, or None,None if there is no remote.

def get_tracking_branch(self):
        """Returns (remote, branch) tuple, or None,None if there is no remote.
        """
        try:
            remote_uri = self.git("rev-parse", "--abbrev-ref",
                                  "--symbolic-full-name", "@{u}")[0]
            return remote_uri.split('/', 1)
        except Exception as e:
            # capitalization of message changed sometime between git 1.8.3
            # and 2.12 - used to be "No upstream", now "no upstream"..
            errmsg = str(e).lower()
            if ("no upstream branch" not in errmsg
                    and "no upstream configured" not in errmsg):
                raise e
        return (None, None)