񬯊Pythonic Low-Level Git Library | |
Áö±Ý ´Ù¿î·Îµå |
±¼»è ¼øÀ§ ¹× ¿ä¾à
±¤°í
- ƯÇã:
- BSD License
- °¡°Ý:
- FREE
- °Ô½ÃÀÚ À̸§:
- Andrew McNabb
- °Ô½ÃÀÚ À¥»çÀÌÆ®:
- http://www.mcnabbs.org/andrew/mrs/
±¼»è ű×
±¼»è ¼³¸í
Pythonic Low-Level Git Library. Gitlib´Â ¿ø·¡ ¹Ì¹¦ÇÑ ºÎºÐÀ¸·Î °³¹ß µÈ µµ¼°üÀÌÁö¸¸ µ¶¸³Çü ¶óÀ̺귯¸®·Î À¯¿ëÇÕ´Ï´Ù. Git Repository¸¦ »ý¼º, ¾×¼¼½º ¶Ç´Â ¼öÁ¤ÇϱâÀ§ÇÑ Pythonic API¸¦ Á¦°øÇÕ´Ï´Ù. GitLibÀÇ Many ±â´ÉÀº ±âº» ÆÄÀ̽㿡¼ ±¸ÇöµÇ´Â ¹Ý¸é ´Ù¸¥ »ç¿ëÀÚ´Â Git Plumbing ¸í·ÉÀ» ½ÇÇàÇؾßÇÕ´Ï´Ù. GitLibÀÇ ÁÖ¿ä ÀÌÁ¡ Áß Çϳª´Â ÀÛ¾÷ Æ®¸®°¡ ÇÊ¿äÇÒ ¼öÀÖ´Â º£¾î ¸®Æ÷ÁöÅ丮¿¡¼ ÀÛ¾÷À» ¼öÇà ÇÒ ¼ö ÀÖ´Ù´Â °ÍÀÔ´Ï´Ù .RepositoriesGitLib´Â °ÅÀÇ ÇÊ¿äÇÏÁö ¾ÊÁö¸¸ »õ·Î¿î Git ÀúÀå¼Ò¸¦ ¸¸µé ¼ö ÀÖ½À´Ï´Ù. >>> °æ·Î = tempfile.mkdtemp ()> >> repo = gitlib.repository (°æ·Î) >>> repo.create () git objectsyou blobs¸¦ ¸¸µé ¼ö ÀÖ½À´Ï´Ù. >>> blob = gitlib.blob () >>> blob.text = 'ÀÌ°ÍÀº Å×½ºÆ®ÀÔ´Ï´Ù. '>>> Blob.Freeze () >>> repo.write (BLOB) ³ª¹«¿¡ Ãß°¡ ÇÒ ¼ö ÀÖ½À´Ï´Ù. >>> testfile1 ='test.txt '>>> Æ®¸® = gitlib.tree () >>> ³ª¹«. add_file (testfile1, blob.name, 'blob') true >>> tree.freeze () >>> repo.write (Æ®¸®)¸¦ Ä¿¹Ô¿¡ Ãß°¡ ÇÒ ¼ö ÀÖ½À´Ï´Ù. >>> commit = gitlib.commit () >>> commit.tree = tree.name >>> commit.author = 'andrew mcnabb 1219616814 -0600'>>> commit.message = 'ù ¹ø° Ä¿¹Ô! '>>> Commit.Freeze () >>> Repo.write (Ä¿¹Ô)°¡ ºÐ±â¿¡ ÀúÀåÇÒ ¼ö ÀÖ½À´Ï´Ù. >>> repo.save_head (commit.name, none) true >>> branchesour Ä¿¹ÔÀº »õ Æ®¸®¸¦ ÀÛ¼ºÇß½À´Ï´Ù. ÀúÀå¼Ò, ÀÌÁ¦´Â "¸¶½ºÅÍ"ºÐ±âÀÇ ¸Ó¸®ÀÔ´Ï´Ù. ¿ì¸®°¡ Æ®¸® / Ä¿¹ÔÀ»º¸°í ½Í´Ù¸é ´ÙÀ½À» ¼öÇà ÇÒ ¼ö ÀÖ½À´Ï´Ù. >>> head = repo.find_head () >>> º¯¼ö Çìµå´Â 16 Áø¼ö¸¦ ³ªÅ¸³»´Â ¹®ÀÚ¿À» º¸À¯ÇÕ´Ï´Ù. ÀÌ ¹øÈ£´Â CommitÀÇ SHA-1 ÇؽÃÀÔ´Ï´Ù. °íÀ¯ ½Äº°ÀÚ·Î »ç¿ëµË´Ï´Ù. ¿ì¸®´ÂÀÌ Ä¿¹ÔÀÇ ID¸¦ »ç¿ëÇÏ¿© ¸®Æ÷ÁöÅ丮¿¡ ¹æ±Ý Ãß°¡ ÇÑ ÆÄÀÏÀÇ ID¸¦ ãÀ» ¼ö ÀÖÀ¸¸çÀÌ ÆÄÀÏÀ» ÆÄÀÏ ¸ð¾çÀÇ °´Ã¼·Î ¿ ¼ö ÀÖ½À´Ï´Ù. >>> fileID = Repo.getName (testfile1, treename = head) >>> Blob2 = repo.getblob (fileID) >>> Blob2.Contents, ÀÌ°ÍÀº Å×½ºÆ®ÀÔ´Ï´Ù. >>> ¸®Æ÷ÁöÅ丮¿¡ »õ ÆÄÀÏÀ» Ãß°¡ ÇÒ ¼ö ÀÖÁö¸¸, »õ Æ®¸®¸¦ ÂüÁ¶ ÇÒ ¶§±îÁö, ±×°ÍÀº ´ÜÁö ¸Å´Þ·Á °´Ã¼ ÀÏ»ÓÀÔ´Ï´Ù. >>> blob = gitlib.blob (µÎ ¹ø° Å×½ºÆ® ÆÄÀÏ. Å×½ºÆ®. ') >>> Repo.write (BLOB) À妽º ¸®Æ÷ÁöÅ丮¸¦ º¯°æÇÏ·Á¸é À妽º¸¦ º¯°æ ÇÑ ´ÙÀ½ »öÀÎÀ» »õ Æ®¸®·Î ÀúÀåÇؾßÇÕ´Ï´Ù. ÇÁ·Î¼¼½º¸¦ °ÈÀÚ. >>> testfile2 = 'test2.txt'>>> index = repo.readtree (head) >>> index.add (testfile2, blob.name) >>> newtree = index.write () ±×·¯³ª ÀÌÁ¦ »õ·Î¿î Æ®¸® (Newtree¿¡ÀÖ´Â ID°¡ÀÖ´Â)´Â ¿©ÀüÈ÷ ¸Å´Þ·ÁÀÖ´Â °´Ã¼ÀÔ´Ï´Ù. ¿ì¸®´Â ¿©ÀüÈ÷ Ä¿¹ÔÀ»ÇؾßÇÕ´Ï´Ù. ´ÙÀ½ Commit¿¡¼´ÂÀÌ Ä¿¹Ô (ÀÌ °æ¿ì Çìµå¿¡¼) ¹× ChangeLog ¹®ÀÚ¿¿¡ ´ëÇÑ »óÀ§ Ä¿¹Ô»Ó¸¸ ¾Æ´Ï¶ó Ä¿¹ÔÇÏ°íÀÖ´Â Æ®¸®ÀÇ ID¸¦ ÁöÁ¤ÇÕ´Ï´Ù. >>> NewCommit = reco.krommit (NewTree , , 'Gitlib·Î committing') ¿ì¸®´Â ¿©ÀüÈ÷ ¸Å´Þ·Á Ä¿¹Ô °´Ã¼¸¦ °¡Áö°í ÀÖ½À´Ï´Ù! ÀÌ ¸ðµç »õ °³Ã¼¸¦ ¸ðµÎ ¹´Â ¸¶Áö¸· ´Ü°è´Â Ä¿¹ÔÀÇ ID¸¦ ¸¶½ºÅÍ Çìµå Ref¿¡ ÀúÀåÇÏ´Â °ÍÀÔ´Ï´Ù. >>> repo.save_head (newcommit, head) true >>> ÀÌÁ¦ ¿ì¸®´Â ¿Ã¹Ù¸£°Ô ¿Ô´ø »õ ÆÄÀÏÀ» °Ë»ö ÇÒ ¼ö ÀÖ½À´Ï´Ù. committed. >>> fileId = repo.getname (testfile2) >>> repo.gettype (fileid) 'blob'>>> f = repo.getblob (fileid) >>> Àμâ f, µÎ ¹ø° Å×½ºÆ® ÆÄÀÏ. Å×½ºÆ®. >> > ¿ä±¸ »çÇ× : ¡¤ ÆÄÀ̽ã
±¼»è °ü·Ã ¼ÒÇÁÆ®¿þ¾î
FormLayout.
´Ù¾çÇÑ À¯ÇüÀÇ ¸Å°³ º¯¼ö¸¦ ÆíÁýÇÏ´Â PYQT4 ¾ç½Ä ´ëÈ »óÀÚ / À§Á¬À» ¸¸µé±âÀ§ÇÑ ¸ðµâ ...
191