~ubuntu-branches/debian/sid/subversion/sid

« back to all changes in this revision

Viewing changes to subversion/mod_dav_svn/repos.c

  • Committer: Package Import Robot
  • Author(s): James McCoy
  • Date: 2014-05-20 22:45:32 UTC
  • mfrom: (0.2.12)
  • Revision ID: package-import@ubuntu.com-20140520224532-4fec3gohdzyy692g
Tags: 1.8.9-1
* New upstream release
* Merge changes from Ubuntu:
  - Add DEB-8 test for Apache functionality
  - debian/rules: Create pot file on build.
  - debian/rules: Ensure the doxygen output directory exists
  - Move svn2cl to subversion-tools' Suggests on Ubuntu.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1790
1790
                                "Could not get created rev of "
1791
1791
                                "resource", r->pool);
1792
1792
 
1793
 
  if (comb->priv.version_name < created_rev)
1794
 
    {
1795
 
      serr = svn_error_createf(SVN_ERR_RA_OUT_OF_DATE, NULL,
1796
 
                               "Item '%s' is out of date",
1797
 
                               comb->priv.repos_path);
1798
 
      return dav_svn__convert_err(serr, HTTP_CONFLICT,
1799
 
                                  "Attempting to modify out-of-date resource.",
1800
 
                                  r->pool);
 
1793
  if (SVN_IS_VALID_REVNUM(created_rev))
 
1794
    {
 
1795
      if (comb->priv.version_name < created_rev)
 
1796
        {
 
1797
          serr = svn_error_createf(SVN_ERR_RA_OUT_OF_DATE, NULL,
 
1798
                                   comb->res.collection
 
1799
                                    ? "Directory '%s' is out of date"
 
1800
                                    : (comb->res.exists
 
1801
                                        ? "File '%s' is out of date"
 
1802
                                        : "'%s' is out of date"),
 
1803
                                   comb->priv.repos_path);
 
1804
          return dav_svn__convert_err(serr, HTTP_CONFLICT,
 
1805
                                      "Attempting to modify out-of-date resource.",
 
1806
                                      r->pool);
 
1807
        }
 
1808
    }
 
1809
  else if (SVN_IS_VALID_REVNUM(comb->priv.version_name)
 
1810
           && comb->res.collection)
 
1811
    {
 
1812
      /* Issue #4480: With HTTPv2 we can receive the first change for a
 
1813
         directory after it has been made mutable, because one of its
 
1814
         descendants was changed before changing the directory.
 
1815
 
 
1816
         We have to check if whatever the node is in HEAD is equivalent
 
1817
         to what it was in the provided BASE revision.
 
1818
 
 
1819
         If the node was copied, we would process it before its decendants
 
1820
         and we already performed quite a few checks when making it mutable
 
1821
         via its descendant, so what we should really check here is if the
 
1822
         properties changed since the BASE version.
 
1823
 
 
1824
         ### I think svn_fs_node_relation() checks for more changes than we
 
1825
             should check for here. Needs further review. But it looks like\
 
1826
             this check matches the checks in the libsvn_fs commit editor.
 
1827
 
 
1828
             For now I would say reporting out of date in a few too many
 
1829
             cases is safer than not reporting out of date when we should.
 
1830
       */
 
1831
      svn_revnum_t txn_base_rev;
 
1832
      svn_fs_root_t *txn_base_root;
 
1833
      svn_fs_root_t *rev_root;
 
1834
      const svn_fs_id_t *txn_base_id;
 
1835
      const svn_fs_id_t *rev_id;
 
1836
 
 
1837
      txn_base_rev = svn_fs_txn_base_revision(comb->res.info->root.txn);
 
1838
 
 
1839
      if (comb->priv.version_name == txn_base_rev)
 
1840
        return NULL; /* Easy out: Nothing changed */
 
1841
 
 
1842
      serr = svn_fs_revision_root(&txn_base_root, comb->res.info->repos->fs,
 
1843
                                  txn_base_rev, r->pool);
 
1844
                                  
 
1845
      if (!serr)
 
1846
        serr = svn_fs_node_id(&txn_base_id, txn_base_root,
 
1847
                              comb->priv.repos_path, r->pool);
 
1848
 
 
1849
      if (serr != NULL)
 
1850
        {
 
1851
          return dav_svn__convert_err(serr, HTTP_INTERNAL_SERVER_ERROR,
 
1852
                                      "Could not open youngest revision root "
 
1853
                                      "for verification against the base "
 
1854
                                      "revision", r->pool);
 
1855
        }
 
1856
 
 
1857
      serr = svn_fs_revision_root(&rev_root, comb->res.info->repos->fs,
 
1858
                                  comb->priv.version_name, r->pool);
 
1859
 
 
1860
      if (!serr)
 
1861
        serr = svn_fs_node_id(&rev_id, rev_root,
 
1862
                              comb->priv.repos_path, r->pool);
 
1863
 
 
1864
      if (serr != NULL)
 
1865
        {
 
1866
          return dav_svn__convert_err(serr, HTTP_INTERNAL_SERVER_ERROR,
 
1867
                                      "Could not open the base revision"
 
1868
                                      "for verification against the youngest "
 
1869
                                      "revision", r->pool);
 
1870
        }
 
1871
 
 
1872
      svn_fs_close_root(rev_root);
 
1873
      svn_fs_close_root(txn_base_root);
 
1874
 
 
1875
      if (0 != svn_fs_compare_ids(txn_base_id, rev_id))
 
1876
        {
 
1877
          serr = svn_error_createf(SVN_ERR_RA_OUT_OF_DATE, NULL,
 
1878
                                   "Directory '%s' is out of date",
 
1879
                                   comb->priv.repos_path);
 
1880
          return dav_svn__convert_err(serr, HTTP_CONFLICT,
 
1881
                                      "Attempting to modify out-of-date resource.",
 
1882
                                      r->pool);
 
1883
        }
1801
1884
    }
1802
1885
 
1803
1886
  return NULL;