コード例 #1
0
ファイル: sync.py プロジェクト: josephwinston/gitfs
    def sync(self):
        log.debug("Check if I'm ahead")
        need_to_push = self.repository.ahead(self.upstream, self.branch)
        sync_done.clear()

        if self.repository.behind:
            log.debug("I'm behind so I start merging")
            try:
                self.merge()
                need_to_push = True
            except:
                log.exception("Merge failed")
                return

        if need_to_push:
            try:
                with remote_operation:
                    log.debug("Start pushing")
                    self.repository.push(self.upstream, self.branch)
                    self.repository.behind = False
                    log.info("Push done")
                log.debug("Clear syncing")
                syncing.clear()
                log.debug("Set sync_done")
                sync_done.set()
                log.debug("Set push_successful")
                push_successful.set()
            except:
                push_successful.clear()
                fetch.set()
                log.exception("Push failed")
        else:
            sync_done.set()
            syncing.clear()
コード例 #2
0
ファイル: sync.py プロジェクト: shaded-enmity/gitfs
    def sync(self):
        log.debug("Check if I'm ahead")
        need_to_push = self.repository.ahead(self.upstream, self.branch)
        sync_done.clear()

        if self.repository.behind:
            log.debug("I'm behind so I start merging")
            try:
                self.merge()
                need_to_push = True
            except:
                log.exception("Merge failed")
                return

        if need_to_push:
            try:
                with remote_operation:
                    log.debug("Start pushing")
                    self.repository.push(self.upstream, self.branch)
                    self.repository.behind = False
                    log.info("Push done")
                log.debug("Clear syncing")
                syncing.clear()
                log.debug("Set sync_done")
                sync_done.set()
                log.debug("Set push_successful")
                push_successful.set()
            except:
                push_successful.clear()
                fetch.set()
                log.exception("Push failed")
        else:
            sync_done.set()
            syncing.clear()
コード例 #3
0
ファイル: sync.py プロジェクト: zaoqi-clone/gitfs
    def sync(self):
        log.debug("Check if I'm ahead")
        need_to_push = self.repository.ahead(self.upstream, self.branch)
        sync_done.clear()

        if self.repository.behind:
            log.debug("I'm behind so I start merging")
            try:
                log.debug("Start fetching")
                self.repository.fetch(self.upstream, self.branch,
                                      self.credentials)
                log.debug("Done fetching")
                log.debug("Start merging")
                self.merge()
                log.debug("Merge done with success, ready to push")
                need_to_push = True
            except:
                log.exception("Merge failed")
                return False

        if need_to_push:
            try:
                with remote_operation:
                    log.debug("Start pushing")
                    self.repository.push(self.upstream, self.branch,
                                         self.credentials)
                    self.repository.behind = False
                    log.info("Push done")
                log.debug("Clear syncing")
                syncing.clear()
                log.debug("Set sync_done")
                sync_done.set()
                log.debug("Set push_successful")
                push_successful.set()
            except Exception as error:
                push_successful.clear()
                fetch.set()
                log.debug("Push failed because of %s", error)
                return False
        else:
            log.debug("Sync done, clearing")
            sync_done.set()
            syncing.clear()

        return True
コード例 #4
0
ファイル: sync.py プロジェクト: PressLabs/gitfs
    def sync(self):
        log.debug("Check if I'm ahead")
        need_to_push = self.repository.ahead(self.upstream, self.branch)
        sync_done.clear()

        if self.repository.behind:
            log.debug("I'm behind so I start merging")
            try:
                log.debug("Start fetching")
                self.repository.fetch(self.upstream, self.branch,
                                      self.credentials)
                log.debug("Done fetching")
                log.debug("Start merging")
                self.merge()
                log.debug("Merge done with success, ready to push")
                need_to_push = True
            except:
                log.exception("Merge failed")
                return False

        if need_to_push:
            try:
                with remote_operation:
                    log.debug("Start pushing")
                    self.repository.push(self.upstream, self.branch,
                                         self.credentials)
                    self.repository.behind = False
                    log.info("Push done")
                log.debug("Clear syncing")
                syncing.clear()
                log.debug("Set sync_done")
                sync_done.set()
                log.debug("Set push_successful")
                push_successful.set()
            except Exception as error:
                push_successful.clear()
                fetch.set()
                log.debug("Push failed because of %s", error)
                return False
        else:
            log.debug("Sync done, clearing")
            sync_done.set()
            syncing.clear()

        return True