Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7989379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T12:44:14+00:00 2026-06-04T12:44:14+00:00

In pysvn , how do I test if a file is under version control?

  • 0

In pysvn, how do I test if a file is under version control?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T12:44:16+00:00Added an answer on June 4, 2026 at 12:44 pm

    Use client.status() and check the text_status attribute of the returned status object. Example:

    >>> import pysvn
    >>> c = pysvn.Client()
    >>> out = c.status("versioned.cpp")[0]  # .status() returns a list
    >>> out.text_status
    <wc_status_kind.normal>
    

    That shows the file is versioned and unmodified.

    >>> c.status("added.cpp")[0].text_status  # added file
    <wc_status_kind.added>
    >>> c.status("unversioned.cpp")[0].text_status  # unversioned file
    <wc_status_kind.unversioned>
    

    You can explore other possible statuses using dir (pysvn.wc_status_kind)

    You can therefore wrap that up in something like:

    def under_version_control(filename):
        "returns true if file is unversioned"
        c = pysvn.Client()
        s = c.status(filename)[0].text_status
        return s not in (
            pysvn.wc_status_kind.added, 
            pysvn.wc_status_kind.unversioned,
            pysvn.wc_status_kind.ignored)
    

    If you wish to also address files outside an svn working directory, you’ll need to catch and handle ClientError. E.g.

    def under_version_control(filename):
        "returns true if file is unversioned"
        c = pysvn.Client()
        try:
            s = c.status(filename)[0].text_status
        catch pysvn.ClientError:
            return False
        else:
            return s not in (
                pysvn.wc_status_kind.added, 
                pysvn.wc_status_kind.unversioned,
                pysvn.wc_status_kind.ignored)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've tried to find the 64bit version for pysvn for a while now. The
I'm registering pysvn.Client.callback_get_login callback , but I want my callback to be defined under
I installed the wrong version of pysvn in my system using the .dmg. I
I've tried psvn.el , but the command to diff the file you're currently looking
here is my code #!/usr/bin/python # -*- coding:utf-8 -*- import sys import pysvn def
I have Python 2.7.2 installed in the default location, C:\Python27. I've downloaded pysvn 2.7
I'm working with pysvn, and I'm trying to find a decent way to handle
I have written some python scripts that take advantage of pysvn to analyze a
I am getting the pysvn.Client.callback_ssl_server_trust_prompt required error when trying to commit. I understand it
I am using PySVN and the work-bench for my svn needs and I previously

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.