/// <summary>
        /// Uses the a REST client to pull from the Paratext send/receive server. This overrides the base implementation
        /// to avoid needing the current user's Paratext registration code to get the base revision.
        /// </summary>
        public override string[] Pull(string repository, SharedRepository pullRepo)
        {
            string tip = GetBaseRevision(repository);

            // Get bundle
            string        guid  = Guid.NewGuid().ToString();
            List <string> query = new List <string> {
                "guid", guid, "proj", pullRepo.ScrTextName, "projid",
                pullRepo.SendReceiveId, "type", "zstd-v2"
            };

            if (tip != null)
            {
                query.Add("base1");
                query.Add(tip);
            }

            byte[] bundle = client.GetStreaming("pullbundle", query.ToArray());
            // Finish bundle
            client.Get("pullbundlefinish", "guid", guid);
            if (bundle.Length == 0)
            {
                return(new string[0]);
            }

            // Use bundle
            string[] changeSets = HgWrapper.Pull(repository, bundle);

            MarkSharedChangeSetsPublic(repository);
            return(changeSets);
        }
示例#2
0
        public CommitInfo ReadCommitInfo(string path, string branch = "master")
        {
            if (!string.IsNullOrWhiteSpace(path))
            {
                path = $"-- \"{path}\"";
            }
            var(data, code) = SharedRepository.ExecuteWithExitCode($"log -1 --pretty=\"%s\" \"{branch}\" {path}");
            if (code != 0)
            {
                return(null);
            }
            var      message     = System.Text.Encoding.UTF8.GetString(data).Trim();
            var      hashes      = System.Text.Encoding.UTF8.GetString(SharedRepository.Execute($"log -1 --pretty=\"%H %h\" \"{branch}\" -- {path}")).Trim().Split(" ");
            var      authorName  = System.Text.Encoding.UTF8.GetString(SharedRepository.Execute($"log -1 --pretty=\"%an\" \"{branch}\" -- {path}")).Trim();
            var      authorEmail = System.Text.Encoding.UTF8.GetString(SharedRepository.Execute($"log -1 --pretty=\"%ae\" \"{branch}\" -- {path}")).Trim();
            var      datestring  = System.Text.Encoding.UTF8.GetString(SharedRepository.Execute($"log -1 --pretty=\"%ad\" \"{branch}\" -- {path}")).Trim();
            DateTime date;

            DateTime.TryParseExact(datestring,
                                   "ddd MMM d HH:mm:ss yyyy K",
                                   System.Globalization.CultureInfo.InvariantCulture,
                                   System.Globalization.DateTimeStyles.None, out date);
            var shortHash = hashes.Count() >= 2 ? hashes[1] : "";

            return(new CommitInfo()
            {
                Message = message,
                Hash = hashes[0],
                ShortHash = shortHash,
                AuthorName = authorName,
                AuthorEmail = authorEmail,
                Date = date
            });
        }
示例#3
0
        public (MemoryStream, IRepositoryPair.FileType) ReadFile(string path, string branch = "master")
        {
            var(data, code) = SharedRepository.ExecuteWithExitCode($"show \"{branch}\":\"{path}\"");
            if (code != 0)
            {
                throw new FileNotFoundException($"File not found `{branch}:{path}'");
            }
            if (!string.IsNullOrWhiteSpace(path))
            {
                path = $"-- \"{path}\"";
            }
            var log = SharedRepository.Execute($"log -1 --pretty=\"\" \"{branch}\" --numstat {path}");

            using (var r = new StreamReader(new MemoryStream(log)))
            {
                if (r.ReadLine()[0] == '-')
                {
                    return(new MemoryStream(data), IRepositoryPair.FileType.Binary);
                }
                else
                {
                    return(new MemoryStream(data), IRepositoryPair.FileType.Text);
                }
            }
        }
示例#4
0
        public ActionResult OtherСompanys(int course)
        {
            var companys = SharedRepository.GetOtherAdminList(course);
            var json     = new JavaScriptSerializer().Serialize(companys);

            return(Json(json, JsonRequestBehavior.AllowGet));
        }
示例#5
0
        public IActionResult Index()
        {
            var dtoResult = SharedRepository.GetStatisics();

            var vm = new IndexViewModel()
            {
                CategoryCard = new StatisticEntityCardViewModel()
                {
                    LatestItemId   = dtoResult.CategoryStatistics.LatestItemId,
                    LatestItemName = dtoResult.CategoryStatistics.LatestItemName,
                    EntitiesCount  = dtoResult.CategoryStatistics.EntitiesCount,
                },
                RecipeCard = new StatisticEntityCardViewModel()
                {
                    LatestItemId   = dtoResult.RecipeStatistics.LatestItemId,
                    LatestItemName = dtoResult.RecipeStatistics.LatestItemName,
                    EntitiesCount  = dtoResult.RecipeStatistics.EntitiesCount,
                },
                IngredientCard = new StatisticEntityCardViewModel()
                {
                    LatestItemId   = dtoResult.IngredientStatistics.LatestItemId,
                    LatestItemName = dtoResult.IngredientStatistics.LatestItemName,
                    EntitiesCount  = dtoResult.IngredientStatistics.EntitiesCount,
                },
                PhotoCard = new StatisticEntityCardViewModel()
                {
                    LatestItemId   = dtoResult.PhotoStatistics.LatestItemId,
                    LatestItemName = dtoResult.PhotoStatistics.LatestItemName,
                    EntitiesCount  = dtoResult.PhotoStatistics.EntitiesCount,
                },
            };

            return(View(vm));
        }
示例#6
0
 public IList <BoxHeadline> GetBoxesOfPallet(string palletId, int maxRows)
 {
     if (string.IsNullOrWhiteSpace(palletId))
     {
         throw new ArgumentNullException("palletId");
     }
     return(SharedRepository.GetBoxes(_db, null, palletId, maxRows));
 }
示例#7
0
 public IEnumerable <string> ReadFileList(string path, string branch = "master")
 {
     if (!string.IsNullOrWhiteSpace(path))
     {
         path = $"-- \"{path}\"";
     }
     return(System.Text.Encoding.UTF8.GetString(SharedRepository.Execute($"ls-tree --full-tree -r -z --name-only \"{branch}\" {path}")).Split('\0').Select(x => x.Trim('"')).Where(x => !string.IsNullOrWhiteSpace(x)));
 }
示例#8
0
        public void Create()
        {
            var shared = new DirectoryInfo(SharedRepository.DirectoryPath);

            shared.Create();
            SharedRepository.Execute($"init --bare --shared {SharedRepository.DirectoryPath}");
            ClonedRepository.Execute($"clone {SharedRepository.DirectoryPath} {ClonedRepository.DirectoryPath}", working_dir: "/");
        }
示例#9
0
        //[TestCase]
        public void TestCase1()
        {
            // Arrange

            // Act
            var repository = new SharedRepository();

            // Assert
        }
示例#10
0
        public static void BindZoneLookup(ctlDropDownList ddl, ContextInfo SessionContext)
        {
            var list = new SharedRepository(SessionContext).GetZoneLookup().ToList();

            ddl.DataSource     = list;
            ddl.DataValueField = "ZoneId";
            ddl.DataTextField  = "ZoneName";
            ddl.DataBind();
        }
示例#11
0
        public static void BindSiteLookup(ctlDropDownList ddl, ContextInfo SessionContext, long ClusterId)
        {
            var list = new SharedRepository(SessionContext).GetSiteLookup().Where(x => x.ClusterId == ClusterId).ToList();

            ddl.DataSource     = list;
            ddl.DataValueField = "SiteId";
            ddl.DataTextField  = "SiteName";
            ddl.DataBind();
        }
示例#12
0
 public MemoryStream ReadFileWithoutTypeCheck(string path, string branch = "master")
 {
     var(data, code) = SharedRepository.ExecuteWithExitCode($"show --binary \"{branch}\":\"{path}\"");
     if (code != 0)
     {
         throw new FileNotFoundException($"File not found `{branch}:{path}'");
     }
     return(new MemoryStream(data));
 }
示例#13
0
        public static void BindHubLookup(ctlDropDownList ddl, ContextInfo SessionContext, long BranchId)
        {
            var list = new SharedRepository(SessionContext).GetHubLookup().Where(x => x.BranchId == BranchId).ToList();

            ddl.DataSource     = list;
            ddl.DataValueField = "HubId";
            ddl.DataTextField  = "HubName";
            ddl.DataBind();
        }
示例#14
0
 public ActionResult Shared(int id, int shared, string department, int course)
 {
     if (course == 0)
     {
         SharedRepository.SharedDepartment(id, department, shared);
     }
     else
     {
         SharedRepository.SharedCourse(id, course, shared);
     }
     return(Json("ok", JsonRequestBehavior.AllowGet));
 }
示例#15
0
 public IEnumerable <string> GetBranches()
 {
     try
     {
         return(System.Text.Encoding.UTF8.GetString(SharedRepository.Execute("branch --format=\"%(refname:short)\"")).Trim().Split().Where(x => !string.IsNullOrWhiteSpace(x)));
     }
     catch (Exception e)
     {
         Console.Error.WriteLine(e.GetBaseException().ToString());
         return(new string[0]);
     }
 }
示例#16
0
        public async Task GetAllSeasons()
        {
            // Arrange
            var dbContext = A.Fake <ProFootballDbEntities>();

            dbContext.SetUpFakeSeasonsAsync();

            // Act
            var repository = new SharedRepository();
            var result     = await repository.GetAllSeasons(dbContext);

            // Assert
            Assert.IsInstanceOf(typeof(IEnumerable <Season>), result);
        }
示例#17
0
        public async Task FindTeamSeasonAsync()
        {
            // Arrange
            var dbContext = A.Fake <ProFootballDbEntities>();

            dbContext.SetUpFakeTeamSeasonsAsync();

            var teamName = "Team";
            var seasonID = 2017;

            // Act
            var repository = new SharedRepository();
            var result     = await repository.FindTeamSeasonAsync(dbContext, teamName, seasonID);

            // Assert
            Assert.IsInstanceOf(typeof(TeamSeason), result);
        }
        /// <summary>
        /// Uses the a REST client to push to the Paratext send/receive server. This overrides the base implementation
        /// to avoid needing the current user's Paratext registration code to get the base revision.
        /// </summary>
        public override void Push(string repository, SharedRepository pushRepo)
        {
            string tip = GetBaseRevision(repository);

            // Create bundle
            byte[] bundle = HgWrapper.Bundle(repository, tip);
            if (bundle.Length == 0)
            {
                return;
            }

            // Send bundle
            string guid = Guid.NewGuid().ToString();

            client.PostStreaming(bundle, "pushbundle", "guid", guid, "proj", pushRepo.ScrTextName, "projid",
                                 pushRepo.SendReceiveId, "registered", "yes", "userschanged", "no");

            MarkSharedChangeSetsPublic(repository);
        }
示例#19
0
        /// <summary>
        /// Ensure the target project repository exists on the local SF server, cloning if necessary.
        /// </summary>
        private void EnsureProjectReposExists(UserSecret userSecret, ParatextProject target,
                                              IInternetSharedRepositorySource repositorySource)
        {
            string username          = GetParatextUsername(userSecret);
            bool   targetNeedsCloned =
                ScrTextCollection.FindById(username, target.ParatextId) == null;

            if (target is ParatextResource resource)
            {
                // If the target is a resource, install it
                InstallResource(resource, target.ParatextId, targetNeedsCloned);
            }
            else if (targetNeedsCloned)
            {
                SharedRepository targetRepo = new SharedRepository(target.ShortName, HexId.FromStr(target.ParatextId),
                                                                   RepositoryType.Shared);
                CloneProjectRepo(repositorySource, target.ParatextId, targetRepo);
            }
        }
示例#20
0
        public UnitOfWork(YapGetirComDbContext db)
        {
            _db = db;

            CampaignRepository           = new CampaignRepository(_db);
            CategoryRepository           = new CategoryRepository(_db);
            CategoryTypeRepository       = new CategoryTypeRepository(_db);
            CommentRepository            = new CommentRepository(_db);
            CookRepository               = new CookRepository(_db);
            MessageRepository            = new MessageRepository(_db);
            OrderRepository              = new OrderRepository(_db);
            PaymentRepository            = new PaymentRepository(_db);
            ProductOrderDetailRepository = new ProductOrderDetailRepository(_db);
            ProductOrderRepository       = new ProductOrderRepository(_db);
            ProductRepository            = new ProductRepository(_db);
            RecipeRepository             = new RecipeRepository(_db);
            RestaurantRepository         = new RestaurantRepository(_db);
            ScoringRepository            = new ScoringRepository(_db);
            SharedRepository             = new SharedRepository(_db);
            StockRepository              = new StockRepository(_db);
            SupplierRepository           = new SupplierRepository(_db);
            UserRepository               = new UserRepository(_db);
            UserTypeRepository           = new UserTypeRepository(_db);
        }
 /// <summary>
 /// This function will return orders summary of Customer for last 180 days.Summary is grouped on the basis of import date and we wont show more than 100 rows.
 /// </summary>
 /// <param name="customerId"></param>
 /// <returns></returns>
 public IList <PoHeadline> GetRecentOrders(string customerId, int maxRows)
 {
     return(SharedRepository.GetRecentOrders(_db, customerId, null, maxRows));
 }
 internal IList <BoxHeadline> GetBoxes(long pickslipId, int maxRows)
 {
     return(SharedRepository.GetBoxes(_db, pickslipId, null, maxRows));
 }
示例#23
0
 public IList <BoxHeadline> GetBoxesOfPickslip(long pickslipId, int maxRows)
 {
     Contract.Assert(_db != null);
     return(SharedRepository.GetBoxes(_db, pickslipId, null, maxRows));
 }
示例#24
0
        private void CloneProjectRepo(IInternetSharedRepositorySource source, string projectId, SharedRepository repo)
        {
            string clonePath = Path.Combine(SyncDir, projectId, "target");

            if (!_fileSystemService.DirectoryExists(clonePath))
            {
                _fileSystemService.CreateDirectory(clonePath);
                HgWrapper.Init(clonePath);
            }
            source.Pull(clonePath, repo);
            HgWrapper.Update(clonePath);
        }
 /// <summary>
 /// This looks like it would be important, but it doesn't seem to matter what it returns, to synchronize.
 /// </summary>
 public override string GetHgUri(SharedRepository sharedRepository)
 {
     return(string.Empty);
 }
示例#26
0
 public SharedDomain(SharedRepository sharedRepository)
 {
     this.sharedRepository = sharedRepository;
 }
示例#27
0
 public CompanyRepository(DatabaseContext context, SharedRepository sharedRepository)
 {
     this.context          = context;
     this.sharedRepository = sharedRepository;
 }
示例#28
0
 internal IList <Tuple <string, string> > GetPrinters()
 {
     return(SharedRepository.GetPrinters(_db, PrinterType.LabelPrinter));
 }
示例#29
0
 /// <summary>
 /// This function will return orders summary of Customer for last 180 days.Summary is grouped on the basis of import date and we wont show more than 100 rows.
 /// </summary>
 /// <param name="customerId"></param>
 /// <returns></returns>
 public IList <PoHeadline> GetRecentOrders(int skuId, int maxRows)
 {
     return(SharedRepository.GetRecentOrders(_db, null, skuId, maxRows));
 }
示例#30
0
 internal IList <BoxHeadline> GetRecentPitchedBoxList(int maxRows)
 {
     return(SharedRepository.GetBoxes(_db, null, string.Empty, maxRows));
 }
示例#31
0
 public SharedDomain(SharedRepository sharedRepository)
 {
     this.sharedRepository = sharedRepository;
 }