void sg_wc_tx__apply__delete_issue(SG_context * pCtx,
								   SG_wc_tx * pWcTx,
								   const SG_vhash * pvh)
{
	SG_pathname * pPath = NULL;
	const char * pszRepoPathTempDir = NULL;

	// During the APPLY phase, our only task is to delete
	// the item's private tempdir, if it had one.  Only items
	// with file-edit conflicts will actually have one.

	SG_ERR_CHECK(  SG_vhash__check__sz(pCtx, pvh, "repopath_tempdir", &pszRepoPathTempDir)  );

#if TRACE_WC_MERGE
	SG_ERR_IGNORE(  SG_console(pCtx, SG_CS_STDERR,
							   "sg_wc_tx__apply__delete_issue: tempdir '%s'\n",
							   ((pszRepoPathTempDir) ? pszRepoPathTempDir : "(null)"))  );
#endif

	if (pszRepoPathTempDir)
	{
		SG_ERR_CHECK(  sg_wc_db__path__sz_repopath_to_absolute(pCtx, pWcTx->pDb, pszRepoPathTempDir, &pPath)  );
		// actually deleting the tempdir can fail for any number of reasons,
		// but that should not abort the COMMIT.  so we use _IGNORE() here
		// rather than _CHECK().
		SG_ERR_IGNORE(  SG_fsobj__rmdir_recursive__pathname(pCtx, pPath)  );
	}

fail:
	SG_PATHNAME_NULLFREE(pCtx, pPath);
}
示例#2
0
int u0020_utf8pathnames__test(SG_context * pCtx)
{
	SG_pathname * pPathnameTmpDir;
	int k, kLimit;

	// create a temporary directory.

	VERIFY_ERR_CHECK_RETURN(  u0020_utf8pathnames__mkdir_tmp_dir(pCtx, &pPathnameTmpDir)  );

	INFOP("u0020_utf8pathnames",("Creating directory [%s]",SG_pathname__sz(pPathnameTmpDir)));

	// create a series of files in the temporary directory that have
	// various unicode characters in their names.

	kLimit = SG_NrElements(table);
	for (k=0; k<kLimit; k++)
	{
		_tableitem * pti = &table[k];

		INFOP("u0020_utf8pathnames",("[%d] starts with [%c]",k,pti->pa8[0]));
		VERIFY_ERR_CHECK_DISCARD(  u0020_utf8pathnames__create_file(pCtx,pPathnameTmpDir,pti)  );
	}

	// open the tmp dir for reading and read the filename of each file in it.
	// compare these with the version of the filename that we used to create
	// the file.

	VERIFY_ERR_CHECK_DISCARD(  u0020_utf8pathnames__readdir(pCtx, pPathnameTmpDir)  );

	// clean up our mess

	VERIFY_ERR_CHECK_DISCARD(  SG_fsobj__rmdir_recursive__pathname(pCtx, pPathnameTmpDir)  );

	SG_PATHNAME_NULLFREE(pCtx, pPathnameTmpDir);
	return 1;
}