def fetch_and_merge_notes(self, remote): self.fetch_notes(remote) #local_changes = system("git rev-list --max-count=1 FETCH_HEAD..refs/notes/geocommit").strip('\n\r ') remote_changes = system("git rev-list --max-count=1 refs/notes/geocommit..FETCH_HEAD").strip('\n\r ') if remote_changes: print "Merging geocommit notes" system_exit_code("git update-ref refs/notes/geocommit-remote FETCH_HEAD") system_exit_code("git notes --ref geocommit merge --strategy=theirs geocommit-remote") else: print "Already up-to-date."
def fetch_notes(self, remote): print "Fetching geocommit notes" code, output = system_exit_code("git fetch " + remote + " refs/notes/geocommit") if code != 0: print >> sys.stderr, output if output.find("fatal: Couldn't find remote ref refs/notes/geocommit") == -1: sys.exit(code)
def get_location(self): ret, value = system_exit_code(EXECUTABLE) if ret != 0: return None try: parsed_value = json.loads(value) return self.location_from_dict(parsed_value) except ValueError as e: return None return None