Exemple #1
0
void RCS::File::Rename( File& target, const OpenFlag flags, const uint64_t changesetId )
{
	GetInfo();
	target.GetInfo();

	if ( IsCheckedOutByMe() && m_Operation == Operations::Delete )
	{
		// here, we've already done this operation, effectively
		if ( target.IsCheckedOutByMe() && target.m_Operation == Operations::Branch )
		{
			return;
		}

		// else, we have a problem
		throw Exception( TXT( "Cannot rename the deleted file '%s'." ), m_LocalPath.c_str() );
	}

	if ( ( flags & OpenFlags::Exclusive ) == OpenFlags::Exclusive )
	{
		if (  IsCheckedOutBySomeoneElse() )
		{
			std::string usernames;
			GetOpenedByUsers( usernames );
			throw FileInUseException( m_LocalPath.c_str(), usernames.c_str() );
		}
		else if ( target.IsCheckedOutBySomeoneElse() )
		{
			std::string targetUsernames;
			target.GetOpenedByUsers( targetUsernames );
			throw FileInUseException( target.m_LocalPath.c_str(), targetUsernames.c_str() );
		}
	}

	if ( IsBinary() && !IsUpToDate() )
	{
		throw FileOutOfDateException( m_LocalPath.c_str(), m_LocalRevision, m_HeadRevision );
	}

	if ( !target.IsUpToDate() )
	{
		throw FileOutOfDateException( target.m_LocalPath.c_str(), target.m_LocalRevision, target.m_HeadRevision );
	}

	m_ChangesetId = changesetId;
	target.m_ChangesetId = changesetId;

	GetProvider()->Rename( *this, target );
}
Exemple #2
0
void RCS::File::Copy( File& target, const OpenFlag flags, const uint64_t changesetId )
{
	GetInfo();
	target.GetInfo();

	// here, we've already done this operation, effectively
	if ( target.IsCheckedOutByMe() && target.m_Operation == Operations::Branch )
	{
		return;
	}

	if ( ( ( flags & OpenFlags::Exclusive ) == OpenFlags::Exclusive ) && target.IsCheckedOutBySomeoneElse() )
	{
		std::string targetUsernames;
		target.GetOpenedByUsers( targetUsernames );
		throw FileInUseException( target.m_LocalPath.c_str(), targetUsernames.c_str() );
	}

	target.m_ChangesetId = changesetId;

	GetProvider()->Integrate( *this, target );
}