SourceForge: gquilt/gquilt: changeset 213:c43142e9e3ea
Fix qfinish implementation to handle case where description has changed
authorPeter Williams <peter_ono@users.sourceforge.net>
Fri May 15 10:59:25 2009 +1000 (6 months ago)
changeset 213c43142e9e3ea
parent 2128d994252b9d8
child 214e3868d134197
Fix qfinish implementation to handle case where description has changed
since the last time the patch was refreshed

Signed-off-by: Peter Williams <peter_ono@users.sourceforge.net>
gquilt.py
gquilt_mq.py
gquilt_tool.py
     1.1 --- a/gquilt.py	Sun Apr 12 20:44:06 2009 +1000
     1.2 +++ b/gquilt.py	Fri May 15 10:59:25 2009 +1000
     1.3 @@ -368,10 +368,9 @@
     1.4                  break
     1.5              while True:
     1.6                  self._show_busy()
     1.7 -                res, so, se = ifce.get_patch_description(next)
     1.8 -                descr = so.strip()
     1.9 +                ok = ifce.get_description_is_finish_ready(next)
    1.10                  self._unshow_busy()
    1.11 -                if descr:
    1.12 +                if ok:
    1.13                      break
    1.14                  msg = os.linesep.join(
    1.15                      ['"%s" has an empty description.' % next,
     2.1 --- a/gquilt_mq.py	Sun Apr 12 20:44:06 2009 +1000
     2.2 +++ b/gquilt_mq.py	Fri May 15 10:59:25 2009 +1000
     2.3 @@ -271,6 +271,24 @@
     2.4          else:
     2.5              filelist = so.splitlines()
     2.6          return (res, filelist, se)
     2.7 +    def get_description_is_finish_ready(self, patch):
     2.8 +        pfn = self.patch_file_name(patch)
     2.9 +        res, pf_descr_lines = gquilt_pfuns.get_patch_descr_lines(pfn)
    2.10 +        pf_descr = os.linesep.join(pf_descr_lines).strip()
    2.11 +        if not pf_descr:
    2.12 +            return False
    2.13 +        res, rep_descr, sout = gquilt_utils.run_cmd('hg log --template "{desc}" --rev %s' % patch)
    2.14 +        if pf_descr != rep_descr.strip():
    2.15 +            top = self.top_patch()
    2.16 +            if top == patch:
    2.17 +                gquilt_utils.run_cmd('hg qrefresh')
    2.18 +            else:
    2.19 +                # let's hope the user doesn't mind having the top patch refreshed
    2.20 +                gquilt_utils.run_cmd('hg qrefresh')
    2.21 +                gquilt_utils.run_cmd('hg qgoto %s' % patch)
    2.22 +                gquilt_utils.run_cmd('hg qrefresh')
    2.23 +                gquilt_utils.run_cmd('hg qgoto %s' % top)
    2.24 +        return True
    2.25      def do_rename_patch(self, console, patch, newname):
    2.26          cmd = "hg qrename "
    2.27          if patch is not None:
     3.1 --- a/gquilt_tool.py	Sun Apr 12 20:44:06 2009 +1000
     3.2 +++ b/gquilt_tool.py	Fri May 15 10:59:25 2009 +1000
     3.3 @@ -68,6 +68,10 @@
     3.4      def has_finish_patch(self):
     3.5          # override in back end if the tool has a "qfinish patch" function
     3.6          return False
     3.7 +    def get_description_is_finish_ready(self, patch):
     3.8 +        # make sure we don't get into an infinite loop if this isn't defined
     3.9 +        # in the derived back end
    3.10 +        return True
    3.11      def display_files_diff_in_viewer(self, viewer, file, patch=None):
    3.12          assert 0, 'display_file_diff_in_viewer() must be provided in child class!!!'
    3.13      def get_playground_root(self, dir=None):