コード例 #1
0
ファイル: HgStore.cs プロジェクト: cornelius90/InnovatorAdmin
        internal virtual void Enlist(HgManifest hgManifest, HgTransaction hgTransaction)
        {
            log.Debug("enlisting manifest");

            hgTransaction.AddJournalEntry("00manifest.i", hgManifest.Revlog.IndexPath);

            if(!hgManifest.Revlog.InlineData)
                hgTransaction.AddJournalEntry("00manifest.d", hgManifest.Revlog.DataPath);
        }
コード例 #2
0
        public HgCommitStats Commit(HgBundle hgBundle)
        {
            log.Info("committing bundle");

            using(AcquireLock())
            {
                var hgJournal = new HgJournal(Store);
                var hgTransaction = new HgTransaction(Store, hgJournal);

                var tip = Changelog.Tip;

                try
                {
                    //
                    // Adding changesets
                    log.Info("committing changesets");
                    hgTransaction.Enlist(Changelog);
                    
                    int changesets;
                    var revisions = CommitChangelog(tip, hgBundle.Changelog, Changelog.Revlog, out changesets);

                    //
                    // Adding manifests
                    log.Info("committing manifests");
                    hgTransaction.Enlist(Manifest);

                    var manifests = 0;
                    Commit(revisions, hgBundle.Manifest, Manifest.Revlog, ref manifests);

                    //
                    // Adding file changes
                    log.Info("committing files");
                    var changedFiles = 0;
                    var changes = 0;

                    foreach(var file in hgBundle.Files)
                    {
                        changedFiles++;

                        log.Debug("committing '{0}'", file.Path.FullPath);

                        var filelog = Store.GetFilelog(file.Path) ?? Store.CreateFilelog(file.Path);
                        hgTransaction.Enlist(filelog);

                        var hgBundleGroup = file.File;

                        Commit(revisions, hgBundleGroup, filelog.Revlog, ref changes);
                    } // foreach

                    if(BundleCommitting != null)
                    {
                        var args = new HgBundleCommittedEventArgs(revisions.Keys.Select(k => Changelog[k]));
                        BundleCommitting(args);
                    } // if
                    
                    hgTransaction.Commit();

                    //
                    // We need to force changelog re-read since after CommitChangelog() the changelog is
                    // being read off a temp file.
                    changelog = null;

                    branchManager.RefreshBranchmap(tip == null ? 0 : tip.Metadata.Revision, Changelog.Tip.Metadata);

                    if(BundleCommitted != null)
                    {
                        var args = new HgBundleCommittedEventArgs(revisions.Keys.Select(k => Changelog[k]));
                        BundleCommitted(args);
                    } // if

                    return new HgCommitStats(changesets, manifests, changes, changedFiles);
                } // try
                catch(Exception e)
                {
                    log.ErrorException("could not commit bundle", e);

                    hgTransaction.Rollback();

                    //
                    // Reset changelog and manifest so that they'll be reread
                    changelog = null;
                    manifest = null;

                    throw;
                } // catch
            } // using
        }
コード例 #3
0
 internal override void Enlist(HgManifest hgManifest, HgTransaction hgTransaction)
 {
     underlyingStore.Enlist(hgManifest, hgTransaction);
 }
コード例 #4
0
 public HgLargefilesEnabledManifest(HgManifest underlyingManifest) :
     base(null, null, null)
 {
     this.underlyingManifest = underlyingManifest;
 }
コード例 #5
0
 public void Enlist(HgManifest hgManifest)
 {
     hgStore.Enlist(hgManifest, this);
 }