Menu

[r35]: / trunk / log_entry.cpp  Maximize  Restore  History

Download this file

115 lines (102 with data), 3.5 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/*
* ====================================================================
* Copyright (c) 2002-2005 The RapidSvn Group. All rights reserved.
*
* This software is licensed as described in the file LICENSE.txt,
* which you should have received as part of this distribution.
*
* This software consists of voluntary contributions made by many
* individuals. For exact contribution history, see the revision
* history and logs, available at http://rapidsvn.tigris.org/.
* ====================================================================
*/
// stl
#include <string>
// subcpp
#include "log_entry.hpp"
#include "pool.hpp"
// subversion api
#include "svn_time.h"
#include <svn_string.h>
namespace svn
{
LogEntry::ChangedPath::ChangedPath( svn_log_changed_path2_t* svnLogChangedPath )
:
m_action( LogEntry::UnknownAction ),
m_copyFromPath(),
m_copyFromRevision( 0 ),
#if ( (SVN_VER_MAJOR > 1) || ((SVN_VER_MAJOR == 1) && (SVN_VER_MINOR >= 7)) )
m_nodeKind( svn_node_unknown ),
m_textModified( svn_tristate_unknown ),
m_propertiesModified( svn_tristate_unknown )
#else
m_nodeKind( svn_node_unknown )
#endif
{
if ( !svnLogChangedPath )
{
return;
}
m_action = static_cast< LogEntry::Action >( svnLogChangedPath->action );
if ( svnLogChangedPath->copyfrom_path )
{
m_copyFromPath = svnLogChangedPath->copyfrom_path;
}
m_copyFromRevision = svnLogChangedPath->copyfrom_rev;
m_nodeKind = svnLogChangedPath->node_kind;
#if ( (SVN_VER_MAJOR > 1) || ((SVN_VER_MAJOR == 1) && (SVN_VER_MINOR >= 7)) )
m_propertiesModified = svnLogChangedPath->props_modified;
m_textModified = svnLogChangedPath->text_modified;
#endif
}
LogEntry::LogEntry( svn_log_entry_t* svnLogEntry )
:
m_revision( 0 ),
m_hasChildren( false ),
m_nonInheritable( false ),
m_subtractiveMerge( false )
{
if ( !svnLogEntry )
{
return;
}
m_revision = svnLogEntry->revision;
m_hasChildren = (svnLogEntry->has_children != 0);
#if ( (SVN_VER_MAJOR > 1) || ((SVN_VER_MAJOR == 1) && (SVN_VER_MINOR >= 7)) )
m_nonInheritable = (svnLogEntry->non_inheritable != 0);
m_subtractiveMerge = (svnLogEntry->subtractive_merge != 0 );
#endif
Pool pool;
if ( svnLogEntry->revprops )
{
for ( apr_hash_index_t* revProp = apr_hash_first( pool, svnLogEntry->revprops ); revProp != NULL; revProp = apr_hash_next( revProp ) )
{
const char* key;
apr_ssize_t keySize;
svn_string_t* val;
apr_hash_this( revProp, reinterpret_cast< const void** >( &key ), &keySize, reinterpret_cast< void** >( &val ) );
m_revisionProperties[ std::string( key, keySize ) ] = std::string( val->data, val->len );
}
}
if ( svnLogEntry->changed_paths2 )
{
for ( apr_hash_index_t* changedPath = apr_hash_first( pool, svnLogEntry->changed_paths2 ); changedPath != NULL; changedPath = apr_hash_next( changedPath ) )
{
const char* key;
apr_ssize_t keySize;
svn_log_changed_path2_t* val;
apr_hash_this( changedPath, reinterpret_cast< const void** >( &key ), &keySize, reinterpret_cast< void** >( &val ) );
m_changedPaths[ std::string( key, keySize ) ] = ChangedPath( val );
}
}
}
std::string LogEntry::GetRevisionPropertyOrDefault( const std::string& name, const std::string& defaultVal ) const
{
std::map< std::string, std::string >::const_iterator property = m_revisionProperties.find( name );
if ( property != m_revisionProperties.end() )
{
return property->second;
}
return defaultVal;
}
}
MongoDB Logo MongoDB