def test_A_Breathing(self): with phlsys_fs.chtmpdir_context(): fetch_config = str( 'remote.origin.fetch=+refs/arcyd/landinglog' ':refs/arcyd/origin/landinglog') run = phlsys_subprocess.run_commands run('git init --bare origin') run('git clone origin dev --config ' + fetch_config) with phlsys_fs.chdir_context('dev'): # make an initial commit on the master branch run('touch README') run('git add README') run('git commit README -m initial_commit') run('git push origin master') run('git checkout -b myfeature') # create a new branch with unique content with open('README', 'w') as f: f.write('myfeature content') run('git add README') run('git commit README -m myfeature_content') run('git push -u origin myfeature') dev = phlsys_git.Repo('dev') # make sure we can prepend a branch to the landinglog when empty abdt_landinglog.prepend(dev, '1234', 'myfeature', '4567') log = abdt_landinglog.get_log(dev) self.assertEqual(1, len(log)) self.assertEqual(log[0].review_sha1, "1234") self.assertEqual(log[0].name, "myfeature") self.assertEqual(log[0].landed_sha1, "4567") # make sure we can prepend another branch abdt_landinglog.prepend(dev, '5678', 'newfeature', '8901') log = abdt_landinglog.get_log(dev) self.assertEqual(2, len(log)) self.assertEqual(log[0].review_sha1, "5678") self.assertEqual(log[0].name, "newfeature") self.assertEqual(log[0].landed_sha1, "8901") self.assertEqual(log[1].review_sha1, "1234") self.assertEqual(log[1].name, "myfeature") self.assertEqual(log[1].landed_sha1, "4567") # make a new, independent clone and make sure we get the same log abdt_landinglog.push_log(dev, 'origin') run('git clone origin dev2 --config ' + fetch_config) with phlsys_fs.chdir_context('dev2'): run('git fetch') dev2 = phlsys_git.Repo('dev2') self.assertListEqual( abdt_landinglog.get_log(dev), abdt_landinglog.get_log(dev2))
def test_A_Breathing(self): with phlsys_fs.chtmpdir_context(): fetch_config = str('remote.origin.fetch=+refs/arcyd/landinglog' ':refs/arcyd/origin/landinglog') run = phlsys_subprocess.run_commands run('git init --bare origin') run('git clone origin dev --config ' + fetch_config) with phlsys_fs.chdir_context('dev'): # make an initial commit on the master branch run('touch README') run('git add README') run('git commit README -m initial_commit') run('git push origin master') run('git checkout -b myfeature') # create a new branch with unique content with open('README', 'w') as f: f.write('myfeature content') run('git add README') run('git commit README -m myfeature_content') run('git push -u origin myfeature') dev = phlsys_git.Repo('dev') # make sure we can prepend a branch to the landinglog when empty abdt_landinglog.prepend(dev, '1234', 'myfeature', '4567') log = abdt_landinglog.get_log(dev) self.assertEqual(1, len(log)) self.assertEqual(log[0].review_sha1, "1234") self.assertEqual(log[0].name, "myfeature") self.assertEqual(log[0].landed_sha1, "4567") # make sure we can prepend another branch abdt_landinglog.prepend(dev, '5678', 'newfeature', '8901') log = abdt_landinglog.get_log(dev) self.assertEqual(2, len(log)) self.assertEqual(log[0].review_sha1, "5678") self.assertEqual(log[0].name, "newfeature") self.assertEqual(log[0].landed_sha1, "8901") self.assertEqual(log[1].review_sha1, "1234") self.assertEqual(log[1].name, "myfeature") self.assertEqual(log[1].landed_sha1, "4567") # make a new, independent clone and make sure we get the same log abdt_landinglog.push_log(dev, 'origin') run('git clone origin dev2 --config ' + fetch_config) with phlsys_fs.chdir_context('dev2'): run('git fetch') dev2 = phlsys_git.Repo('dev2') self.assertListEqual(abdt_landinglog.get_log(dev), abdt_landinglog.get_log(dev2))
def process(args): # XXX: only supports 'origin' remote at present clone = phlsys_git.GitClone('.') _fetch_log(clone, args.update, args.no_update, args.prompt_update) log = abdt_landinglog.get_log(clone) log_dict = {i.review_sha1: (i.name, i.landed_sha1) for i in log} local_branches = phlgit_branch.get_local_with_sha1(clone) if args.force: did_something = _prune_branches( clone, args, prune_force, log_dict, local_branches) if not did_something: print "nothing to do." else: print "done." else: assert args.interactive would_do_something = _prune_branches( clone, args, prune_dryrun, log_dict, local_branches) if not would_do_something: print "nothing to do." else: choice = phlsys_choice.yes_or_no("perform the pruning?", 'no') print if choice: _prune_branches( clone, args, prune_force, log_dict, local_branches) print "done." else: print "stopped."
def process(args): # XXX: only supports 'origin' remote at present print """ ::DEPRECATION NOTICE:: the 'refs/arcyd/landinglog' ref is no longer being updated, for new branches do: git fetch origin refs/arcyd/landed:refs/arcyd/landed git branch --merged refs/arcyd/landed | grep -v '*' | xargs git branch -D """.strip() print repo = phlsys_git.Repo('.') _fetch_log(repo, args.update, args.no_update, args.prompt_update) log = abdt_landinglog.get_log(repo) log_dict = {i.review_sha1: (i.name, i.landed_sha1) for i in log} local_branches = phlgit_branch.get_local_with_sha1(repo) if args.force: did_something = _prune_branches( repo, args, prune_force, log_dict, local_branches) if not did_something: print "nothing to do." else: print "done." else: assert args.interactive would_do_something = _prune_branches( repo, args, prune_dryrun, log_dict, local_branches) if not would_do_something: print "nothing to do." else: choice = phlsys_choice.yes_or_no("perform the pruning?", 'no') print if choice: _prune_branches( repo, args, prune_force, log_dict, local_branches) print "done." else: print "stopped."
def process(args): # XXX: only supports 'origin' remote at present print(""" ::DEPRECATION NOTICE:: the 'refs/arcyd/landinglog' ref is no longer being updated, for new branches do: git fetch origin refs/arcyd/landed:refs/arcyd/landed git branch --merged refs/arcyd/landed | grep -v '*' | xargs git branch -D """.strip()) print() repo = phlsys_git.Repo('.') _fetch_log(repo, args.update, args.no_update, args.prompt_update) log = abdt_landinglog.get_log(repo) log_dict = {i.review_sha1: (i.name, i.landed_sha1) for i in log} local_branches = phlgit_branch.get_local_with_sha1(repo) if args.force: did_something = _prune_branches( repo, args, prune_force, log_dict, local_branches) if not did_something: print("nothing to do.") else: print("done.") else: assert args.interactive would_do_something = _prune_branches( repo, args, prune_dryrun, log_dict, local_branches) if not would_do_something: print("nothing to do.") else: choice = phlsys_choice.yes_or_no("perform the pruning?", 'no') print() if choice: _prune_branches( repo, args, prune_force, log_dict, local_branches) print("done.") else: print("stopped.")