Announcement

Collapse
No announcement yet.

svn does not recognize pdf as binary file?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • svn does not recognize pdf as binary file?

    I see that svn does not recognize pdf as a binary file.

    Is that expected and any reason for that.


    How can I make sure that every pdf committed is marked as binary by default?

  • #2
    Re: svn does not recognize pdf as binary file?

    Hi,

    what version of subversion are you using?

    from the subversion book http://svnbook.red-bean.com/nightly/...nary-and-trans :

    To determine whether a contextual merge is possible, Subversion examines the svn:mime-type property. If the file has no svn:mime-type property, or has a MIME type that is textual (e.g., text/*), Subversion assumes it is text. Otherwise, Subversion assumes the file is binary. Subversion also helps users by running a binary-detection algorithm in the svn import and svn add commands. These commands will make a good guess and then (possibly) set a binary svn:mime-type property on the file being added. (If Subversion guesses wrong, the user can always remove or hand-edit the property.)
    You can therefore manually set the property on the file as follows:

    svn propset svn:mime-type 'binary' <pdf file>

    As to why it doesn't do this automatically, I'm not sure... it detects it automatically with svn 1.6.12 which I am using.

    Regards,
    Jon

    Comment


    • #3
      I am use 1.6.11 version.



      Is there a way to instruct svn to recognize every file with extension ".pdf" as a binary file from now on?

      Comment


      • #4
        Re: svn does not recognize pdf as binary file?

        Originally posted by jonathan.paul
        You can therefore manually set the property on the file as follows:

        svn propset svn:mime-type 'binary' <pdf file>
        The mime-type for PDFs should be application/pdf. For a generic/unknown/arbitrary binary, it should be application/octet-stream

        "binary" is not a valid mime-type.

        Comment


        • #5
          Originally posted by bool
          Is there a way to instruct svn to recognize every file with extension ".pdf" as a binary file from now on?
          Autoprops. Will only apply to newly-added files; you'll have to go back and correct the existing ones yourself.

          Comment


          • #6
            Thanks andyl.

            So basically, in the subversion config file (I am running Ubuntu with the latest subversion from the ubuntu repo - so for me this is in /etc/subversion/config), you would have to have the following lines:

            enable-auto-props = yes

            [auto-props]
            *.pdf = svn:mime-type=application/pdf

            But what is strang is that when I marked a pdf file for addition, it did know it was a binary file:

            $ svn add WANdisco_sv_ac_admin_guide-07-22.pdf
            A (bin) WANdisco_sv_ac_admin_guide-07-22.pdf
            $ svn propget svn:mime-type WANdisco_sv_ac_admin_guide-07-22.pdf
            application/octet-stream
            How comes this doesn't work for bool?

            Regards,
            Jon

            Comment


            • #7
              Originally posted by jonathan.paul
              Thanks andyl.

              So basically, in the subversion config file (I am running Ubuntu with the latest subversion from the ubuntu repo - so for me this is in /etc/subversion/config), you would have to have the following lines:

              enable-auto-props = yes

              [auto-props]
              *.pdf = svn:mime-type=application/pdf

              But what is strang is that when I marked a pdf file for addition, it did know it was a binary file:

              $ svn add WANdisco_sv_ac_admin_guide-07-22.pdf
              A (bin) WANdisco_sv_ac_admin_guide-07-22.pdf
              $ svn propget svn:mime-type WANdisco_sv_ac_admin_guide-07-22.pdf
              application/octet-stream
              You likely already had a ~/.subversion/config on your system. /etc/subversion/config is only used as a template to be copied to ~/.subversion/config the first time you execute the client.

              Rename ~/.subversion & perform your test again, I bet it'll work (and you'll find ~/.subversion/config re-created, with contents identical to /etc/subversion/config). Once you have ~/.subversion/config, you need to edit that file for any changes to take effect.

              Originally posted by jonathan.paul
              How comes this doesn't work for bool?
              Without more details, it's hard to know. It's also possible that the file contents are such that svn is guessing wrong - IIRC, it looks at the first X bytes of a file and then guesses binary vs. text based upon that.

              Comment


              • #8
                as for the pdf as binary file, I am little confused about what Andyl said.

                Comment

                Working...
                X