No replies, so I've added a review request: 
http://reviews.review-board.org/r/841/

Colin

On Apr 26, 3:26 pm, ccaughie <c.caug...@googlemail.com> wrote:
> Hello again,
>
> I just read up some more on how git works and I think I now understand
> why the existing code works for git but not for Mercurial; git uses
> individual IDs for every file whereas Mercurial only has revision IDs
> for commits. So my original patch would fix Mercurial but probably
> break git.
>
> Here's a new patch that fixes Mercurial and shouldn't affect git.
> Please let me know if this seems like a reasonable approach; if so
> I'll submit it as a change.
>
> Thanks,
> Colin
>
> Index: diffviewer/forms.py
> ===================================================================
> --- diffviewer/forms.py (revision 1931)
> +++ diffviewer/forms.py (working copy)
> @@ -60,7 +60,7 @@
>
>          # Parse the diff
>          files = list(self._process_files(
> -            diff_file, basedir, check_existance=(parent_diff_file is
> not None)))
> +            diff_file, basedir, check_existance=(not
> parent_diff_file)))
>
>          if len(files) == 0:
>              raise EmptyDiffError(_("The diff file is empty"))
> @@ -70,6 +70,7 @@
>
>          # Parse the parent diff
>          parent_files = {}
> +        parent_rev = None
>
>          if parent_diff_file:
>              # If the user supplied a base diff, we need to parse it
> and
> @@ -77,6 +78,7 @@
>              for f in self._process_files(parent_diff_file, basedir,
>                                           check_existance=True):
>                  parent_files[f.origFile] = f
> +                parent_rev = f.origInfo
>
>          diffset = DiffSet(name=diff_file.name, revision=0,
>                            history=diffset_history,
> @@ -91,7 +93,11 @@
>                  source_rev = parent_file.origInfo
>              else:
>                  parent_content = ""
> -                source_rev = f.origInfo
> +                if not tool.get_uses_file_revision_ids() and
> parent_rev and \
> +                        f.origInfo != PRE_CREATION:
> +                    source_rev = parent_rev
> +                else:
> +                    source_rev = f.origInfo
>
>              dest_file = os.path.join(basedir, f.newFile).replace("\
> \", "/")
>
> Index: scmtools/core.py
> ===================================================================
> --- scmtools/core.py    (revision 1931)
> +++ scmtools/core.py    (working copy)
> @@ -58,6 +58,9 @@
>      def get_diffs_use_absolute_paths(self):
>          return False
>
> +    def get_uses_file_revision_ids(self):
> +        return True
> +
>      def get_changeset(self, changesetid):
>          raise NotImplementedError
>
> Index: scmtools/hg.py
> ===================================================================
> --- scmtools/hg.py      (revision 1931)
> +++ scmtools/hg.py      (working copy)
> @@ -30,6 +30,9 @@
>      def get_diffs_use_absolute_paths(self):
>          return True
>
> +    def get_uses_file_revision_ids(self):
> +        return False
> +
>      def get_fields(self):
>          return ['diff_path']
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"reviewboard" group.
To post to this group, send email to reviewboard@googlegroups.com
To unsubscribe from this group, send email to 
reviewboard+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/reviewboard?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to