; Fc@sdZdZdklZlZdklZdZdefdYZdefdYZ d efd YZ d efd YZ d S(s| Updatable sources are the simplest abstract wrappers around a working directory under some kind of version control system. sreStructuredText(s TailorBugsTailorException(s WorkingDirs The changeset %s caused conflicts on the following files: * %s This is quite unusual, and most probably it means someone else has changed the working dir, beyond tailor control, or maybe a tailor bug is showing up. Either abort the session with Ctrl-C, or manually correct the situation with a Ctrl-Z, explore and correct, and coming back from the shell with 'fg'. What would you like to do? sGetUpstreamChangesetsFailurecBstZdZRS(s Failure getting upstream changes(s__name__s __module__s__doc__(((sA/mnt/gmirror/ports/devel/tailor/work/tailor-0.9.29/vcpx/source.pysGetUpstreamChangesetsFailure(s sChangesetApplicationFailurecBstZdZRS(s!Failure applying upstream changes(s__name__s __module__s__doc__(((sA/mnt/gmirror/ports/devel/tailor/work/tailor-0.9.29/vcpx/source.pysChangesetApplicationFailure,s sInvocationErrorcBstZdZRS(s&Bad invocation, use --help for details(s__name__s __module__s__doc__(((sA/mnt/gmirror/ports/devel/tailor/work/tailor-0.9.29/vcpx/source.pysInvocationError0s sUpdatableSourceWorkingDircBstZdZeeeedZedZedZdZedZdZ dZ dZ d Z d Z d ZRS( s This is an abstract working dir able to follow an upstream source of ``changesets``. It has three main functionalities: getPendingChangesets to query the upstream server about new changesets applyPendingChangesets to apply them to the working directory checkoutUpstreamRevision to extract a new copy of the sources, actually initializing the mechanism. Subclasses MUST override at least the _underscoredMethods. c Csdkl} t}t}g} zHd}x;|iD]0}|d7}|i i d||i || o|i i d|iPn|iio| |iiny|i|}Wntj oH} |i id|i i dt| |i i d|nAtj o|i id Pn|i id |nX|oBy|i|| |Wqtj o|i id PqXn|i||o|oy||Wq6tj oH} |i id |i i dt| |i i d|q6|i id |q6Xq:n|}|ii|o||q2q2WWd |iiX|| fSd S(s Apply the collected upstream changes. Loop over the collected changesets, doing whatever is needed to apply each one to the working dir and if the changes do not raise conflicts call the `replay` function to mirror the changes on the target. Return a tuple of two elements: - the last applied changeset, if any - the sequence (potentially empty!) of conflicts. (ssleepiis Changeset #%ds#Stopping application at revision %rsCouldn't apply changesets Reason: %ss Changeset: %ssINTERRUPTED BY THE USER!sCouldn't apply changeset %ssCouldn't replay changesetsCouldn't replay changeset %sN( stimessleepsNonescslasts conflictssisselfs state_fileslogsinfos_willApplyChangesets applyablesdebugsrevisions repositorysdelay_before_applys_applyChangesetsressChangesetApplicationFailuresescriticalsstrsKeyboardInterruptswarnings exceptions_handleConflicts_didApplyChangesets replayablesreplaysappliedsfinalize( sselfs applyables replayablesreplaysappliedscslastsisresssleeps conflictsse((sA/mnt/gmirror/ports/devel/tailor/work/tailor-0.9.29/vcpx/source.pysapplyPendingChangesetsHsp         cCs|o||SntSdS(s This gets called just before applying each changeset. The whole process will be stopped if this returns False. Subclasses may use this to stop the process on some conditions, or to do whatever before application. N(s applyables changesetsTrue(sselfs changesets applyable((sA/mnt/gmirror/ports/devel/tailor/work/tailor-0.9.29/vcpx/source.pys_willApplyChangesetscCs|o||SntSdS(s( This gets called right after changeset application. The final commit on the target system won't be carried out if this returns False. Subclasses may use this to alter the changeset in any way, before committing its changes to the target system. N(s replayables changesetsTrue(sselfs changesets replayable((sA/mnt/gmirror/ports/devel/tailor/work/tailor-0.9.29/vcpx/source.pys_didApplyChangesetscCs:|i||fttt|di|fdS(s3 Handle the conflict raised by the application of the upstream changeset. This implementation just append a (changeset, conflict) to the list of all conflicts, and present a prompt to the user that may abort with Ctrl-C (that in turn generates a KeyboardInterrupt). s * N(s conflictssappends changesetsconflicts raw_inputsCONFLICTS_PROMPTsstrsjoin(sselfs changesets conflictssconflict((sA/mnt/gmirror/ports/devel/tailor/work/tailor-0.9.29/vcpx/source.pys_handleConflictscCsh|ii oL|ii}|o |i}n|}|i|}|ii |n|iSdS(s Load the pending changesets from the state file, or query the upstream repository if there's none. Return an iterator over pending changesets. N( sselfs state_filespendingslastAppliedChangesetslastsrevisionssincerevs_getUpstreamChangesetss changesetsssetPendingChangesets(sselfssincerevs changesetsslastsrevision((sA/mnt/gmirror/ports/devel/tailor/work/tailor-0.9.29/vcpx/source.pysgetPendingChangesetss cCstd|idS(s Query the upstream repository about what happened on the sources since last sync, returning a sequence of Changesets instances. This method must be overridden by subclasses. s%s should override this method!N(s TailorBugsselfs __class__(sselfssincerev((sA/mnt/gmirror/ports/devel/tailor/work/tailor-0.9.29/vcpx/source.pys_getUpstreamChangesetsscCstd|idS(s Do the actual work of applying the changeset to the working copy. Subclasses should reimplement this method performing the necessary steps to *merge* given `changeset`, returning a list with the conflicts, if any. s%s should override this method!N(s TailorBugsselfs __class__(sselfs changeset((sA/mnt/gmirror/ports/devel/tailor/work/tailor-0.9.29/vcpx/source.pys_applyChangesetscCs4|i|}|ii||ii|SdS(s} Extract a working copy of the given revision from a repository. Return the last applied changeset. N(sselfs_checkoutUpstreamRevisionsrevisionslasts state_filesappliedsfinalize(sselfsrevisionslast((sA/mnt/gmirror/ports/devel/tailor/work/tailor-0.9.29/vcpx/source.pyscheckoutUpstreamRevisions  cCstd|idS(sF Concretely do the checkout of the upstream revision. s%s should override this method!N(s TailorBugsselfs __class__(sselfsrevision((sA/mnt/gmirror/ports/devel/tailor/work/tailor-0.9.29/vcpx/source.pys_checkoutUpstreamRevisionscCs|idS(s] Do whatever is needed to setup or connect to the source repository. N(sselfs_prepareSourceRepository(sself((sA/mnt/gmirror/ports/devel/tailor/work/tailor-0.9.29/vcpx/source.pysprepareSourceRepository scCsdS(sb Possibly connect to the source repository, when overriden by subclasses. N((sself((sA/mnt/gmirror/ports/devel/tailor/work/tailor-0.9.29/vcpx/source.pys_prepareSourceRepositorys(s__name__s __module__s__doc__sNonesapplyPendingChangesetss_willApplyChangesets_didApplyChangesets_handleConflictsgetPendingChangesetss_getUpstreamChangesetss_applyChangesetscheckoutUpstreamRevisions_checkoutUpstreamRevisionsprepareSourceRepositorys_prepareSourceRepository(((sA/mnt/gmirror/ports/devel/tailor/work/tailor-0.9.29/vcpx/source.pysUpdatableSourceWorkingDir4s ^     N( s__doc__s __docformat__svcpxs TailorBugsTailorExceptions vcpx.workdirs WorkingDirsCONFLICTS_PROMPTsGetUpstreamChangesetsFailuresChangesetApplicationFailuresInvocationErrorsUpdatableSourceWorkingDir( sUpdatableSourceWorkingDirsCONFLICTS_PROMPTsGetUpstreamChangesetsFailures TailorBugs WorkingDirs __docformat__sChangesetApplicationFailuresTailorExceptionsInvocationError((sA/mnt/gmirror/ports/devel/tailor/work/tailor-0.9.29/vcpx/source.pys? s