Alien-SVN
view release on metacpan or search on metacpan
src/subversion/subversion/libsvn_wc/questions.c view on Meta::CPAN
else if (need_translation)
{
/* Wrap base stream to translate into working copy form, and
* arrange to throw an error if its EOL style is inconsistent. */
pristine_stream = svn_subst_stream_translated(pristine_stream,
eol_str, FALSE,
keywords, TRUE,
scratch_pool);
}
}
SVN_ERR(svn_stream_contents_same2(&same, pristine_stream, v_stream,
scratch_pool));
}
else
{
/* Translation would be a no-op, so compare the original file. */
svn_stream_t *v_stream; /* versioned_file */
SVN_ERR(svn_stream_open_readonly(&v_stream, versioned_file_abspath,
scratch_pool, scratch_pool));
SVN_ERR(svn_stream_contents_same2(&same, pristine_stream, v_stream,
scratch_pool));
}
*modified_p = (! same);
return SVN_NO_ERROR;
}
svn_error_t *
svn_wc__internal_file_modified_p(svn_boolean_t *modified_p,
svn_wc__db_t *db,
const char *local_abspath,
svn_boolean_t exact_comparison,
apr_pool_t *scratch_pool)
{
svn_stream_t *pristine_stream;
svn_filesize_t pristine_size;
svn_wc__db_status_t status;
svn_node_kind_t kind;
const svn_checksum_t *checksum;
svn_filesize_t recorded_size;
apr_time_t recorded_mod_time;
svn_boolean_t has_props;
svn_boolean_t props_mod;
const svn_io_dirent2_t *dirent;
/* Read the relevant info */
SVN_ERR(svn_wc__db_read_info(&status, &kind, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, &checksum, NULL, NULL, NULL,
NULL, NULL, NULL,
&recorded_size, &recorded_mod_time,
NULL, NULL, NULL, &has_props, &props_mod,
NULL, NULL, NULL,
db, local_abspath,
scratch_pool, scratch_pool));
/* If we don't have a pristine or the node has a status that allows a
pristine, just say that the node is modified */
if (!checksum
|| (kind != svn_node_file)
|| ((status != svn_wc__db_status_normal)
&& (status != svn_wc__db_status_added)))
{
*modified_p = TRUE;
return SVN_NO_ERROR;
}
SVN_ERR(svn_io_stat_dirent2(&dirent, local_abspath, FALSE, TRUE,
scratch_pool, scratch_pool));
if (dirent->kind != svn_node_file)
{
/* There is no file on disk, so the text is missing, not modified. */
*modified_p = FALSE;
return SVN_NO_ERROR;
}
if (! exact_comparison)
{
/* We're allowed to use a heuristic to determine whether files may
have changed. The heuristic has these steps:
1. Compare the working file's size
with the size cached in the entries file
2. If they differ, do a full file compare
3. Compare the working file's timestamp
with the timestamp cached in the entries file
4. If they differ, do a full file compare
5. Otherwise, return indicating an unchanged file.
There are 2 problematic situations which may occur:
1. The cached working size is missing
--> In this case, we forget we ever tried to compare
and skip to the timestamp comparison. This is
because old working copies do not contain cached sizes
2. The cached timestamp is missing
--> In this case, we forget we ever tried to compare
and skip to full file comparison. This is because
the timestamp will be removed when the library
updates a locally changed file. (ie, this only happens
when the file was locally modified.)
*/
/* Compare the sizes, if applicable */
if (recorded_size != SVN_INVALID_FILESIZE
&& dirent->filesize != recorded_size)
goto compare_them;
/* Compare the timestamps
Note: recorded_mod_time == 0 means not available,
which also means the timestamps won't be equal,
so there's no need to explicitly check the 'absent' value. */
if (recorded_mod_time != dirent->mtime)
goto compare_them;
( run in 0.648 second using v1.01-cache-2.11-cpan-483215c6ad5 )