void SG_pull__abort( SG_context* pCtx, SG_pull** ppPull) { _sg_pull** ppMyPull = (_sg_pull**)ppPull; SG_NULL_PP_CHECK_RETURN(ppPull); SG_ERR_CHECK_RETURN( _sg_pull__nullfree(pCtx, ppMyPull) ); }
void SG_pull__commit( SG_context* pCtx, SG_pull** ppPull, SG_varray** ppvaZingErr, SG_varray** ppvaZingLog) { _sg_pull* pMyPull = NULL; sg_pull_instance_data* pMe = NULL; SG_vhash* pvhStatus = NULL; char* pszFragballName = NULL; const SG_pathname* pStagingPathname; SG_NULL_PP_CHECK_RETURN(ppPull); pMyPull = (_sg_pull*)*ppPull; pMe = pMyPull->pPullInstance; SG_ERR_CHECK( SG_staging__get_pathname(pCtx, pMe->pStaging, &pStagingPathname) ); SG_ERR_CHECK_RETURN( SG_context__msg__emit(pCtx, "Retrieving dagnodes...") ); SG_ERR_CHECK( SG_client__pull_request_fragball(pCtx, pMyPull->pClient, pMyPull->pvhFragballRequest, pStagingPathname, &pszFragballName, &pvhStatus) ); #if TRACE_PULL SG_ERR_CHECK( SG_vhash_debug__dump_to_console__named(pCtx, pvhStatus, "pull staging status") ); #endif /* Ian TODO: check status of pull request */ SG_ERR_CHECK( SG_VHASH_NULLFREE(pCtx, pvhStatus) ); SG_ERR_CHECK( SG_staging__slurp_fragball(pCtx, pMe->pStaging, pszFragballName) ); SG_ERR_CHECK( SG_staging__check_status(pCtx, pMe->pStaging, SG_TRUE, SG_FALSE, SG_FALSE, SG_FALSE, SG_FALSE, &pvhStatus) ); /* Finish the pull using the status data we got back. */ SG_ERR_CHECK( _pull_common(pCtx, pMyPull->pClient, &pvhStatus, pMe, ppvaZingErr, ppvaZingLog) ); /* fall through */ fail: SG_ERR_IGNORE( _sg_pull__nullfree(pCtx, (_sg_pull**)ppPull) ); SG_VHASH_NULLFREE(pCtx, pvhStatus); SG_NULLFREE(pCtx, pszFragballName); }
void sg_sync_client__http__push_end( SG_context * pCtx, SG_sync_client * pSyncClient, SG_sync_client_push_handle** ppPush) { sg_sync_client_http_push_handle* pMyPush = NULL; char* pszUrl = NULL; SG_string* pstr = NULL; SG_NULLARGCHECK_RETURN(pSyncClient); SG_NULL_PP_CHECK_RETURN(ppPush); pMyPush = (sg_sync_client_http_push_handle*)*ppPush; // Get the remote URL SG_ERR_CHECK( _get_sync_url(pCtx, pSyncClient->psz_remote_repo_spec, SYNC_URL_SUFFIX, pMyPush->pszPushId, NULL, &pszUrl) ); SG_ERR_CHECK( do_url( pCtx, pszUrl, "DELETE", NULL, pSyncClient->psz_username, pSyncClient->psz_password, &pstr, NULL, SG_TRUE ) ); // fall through fail: // We free the push handle even on failure, because SG_push_handle is opaque outside this file: // this is the only way to free it. _NULLFREE_PUSH_HANDLE(pCtx, pMyPush); *ppPush = NULL; SG_NULLFREE(pCtx, pszUrl); SG_STRING_NULLFREE(pCtx, pstr); }